793b7da3ae75ab35f93cc65dd03745b51fd07a23
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / ewk_view.h
1 /*
2    Copyright (C) 2011 Samsung Electronics
3    Copyright (C) 2012 Intel Corporation. All rights reserved.
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Library General Public
7     License as published by the Free Software Foundation; either
8     version 2 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13     Library General Public License for more details.
14
15     You should have received a copy of the GNU Library General Public License
16     along with this library; see the file COPYING.LIB.  If not, write to
17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18     Boston, MA 02110-1301, USA.
19 */
20
21 /**
22  * @file    ewk_view.h
23  * @brief   WebKit main smart object.
24  *
25  * This object provides view related APIs of WebKit2 to EFL object.
26  *
27  * The following signals (see evas_object_smart_callback_add()) are emitted:
28  *
29  * - "download,cancelled", Ewk_Download_Job*: reports that a download was effectively cancelled.
30  * - "download,failed", Ewk_Download_Job_Error*: reports that a download failed with the given error.
31  * - "download,finished", Ewk_Download_Job*: reports that a download completed successfully.
32  * - "download,request", Ewk_Download_Job*: reports that a new download has been requested. The client should set the
33  *   destination path by calling ewk_download_job_destination_set() or the download will fail.
34  * - "form,submission,request", Ewk_Form_Submission_Request*: Reports that a form request is about to be submitted.
35  *   The Ewk_Form_Submission_Request passed contains information about the text fields of the form. This
36  *   is typically used to store login information that can be used later to pre-fill the form.
37  *   The form will not be submitted until ewk_form_submission_request_submit() is called.
38  *   It is possible to handle the form submission request asynchronously, by simply calling
39  *   ewk_form_submission_request_ref() on the request and calling ewk_form_submission_request_submit()
40  *   when done to continue with the form submission. If the last reference is removed on a
41  *   #Ewk_Form_Submission_Request and the form has not been submitted yet,
42  *   ewk_form_submission_request_submit() will be called automatically.
43  * - "intent,request,new", Ewk_Intent_Request*: reports new Web intent request.
44  * - "intent,service,register", Ewk_Intent_Service*: reports new Web intent service registration.
45  * - "load,error", const Ewk_Web_Error*: reports main frame load failed.
46  * - "load,finished", void: reports load finished.
47  * - "load,progress", double*: load progress has changed (value from 0.0 to 1.0).
48  * - "load,provisional,failed", const Ewk_Web_Error*: view provisional load failed.
49  * - "load,provisional,redirect", void: view received redirect for provisional load.
50  * - "load,provisional,started", void: view started provisional load.
51  * - "policy,decision,navigation", Ewk_Navigation_Policy_Decision*: a navigation policy decision should be taken.
52  *   To make a policy decision asynchronously, simply increment the reference count of the
53  *   #Ewk_Navigation_Policy_Decision object using ewk_navigation_policy_decision_ref().
54  * - "policy,decision,new,window", Ewk_Navigation_Policy_Decision*: a new window policy decision should be taken.
55  *   To make a policy decision asynchronously, simply increment the reference count of the
56  *   #Ewk_Navigation_Policy_Decision object using ewk_navigation_policy_decision_ref().
57  * - "resource,request,failed", const Ewk_Web_Resource_Load_Error*: a resource failed loading.
58  * - "resource,request,finished", const Ewk_Web_Resource*: a resource finished loading.
59  * - "resource,request,new", const Ewk_Web_Resource_Request*: a resource request was initiated.
60  * - "resource,request,response", Ewk_Web_Resource_Load_Response*: a response to a resource request was received.
61  * - "resource,request,sent", const Ewk_Web_Resource_Request*: a resource request was sent.
62  * - "text,found", unsigned int*: the requested text was found and it gives the number of matches.
63  * - "title,changed", const char*: title of the main frame was changed.
64  * - "uri,changed", const char*: uri of the main frame was changed.
65  * - "pageSave,success", void: page save operation was success.
66  * - "pageSave,error", void: page save operation has failed.
67  *
68  *
69  * Tizen specific signals
70  * - "magnifier,show", void: magifier of text selection was showed.
71  * - "magnifier,hide", void: magifier of text selection was hidden.
72  */
73
74 #ifndef ewk_view_h
75 #define ewk_view_h
76
77 #include "ewk_context.h"
78 #include "ewk_download_job.h"
79 #include "ewk_intent.h"
80 #include "ewk_touch.h"
81 #include "ewk_settings.h"
82 #include "ewk_url_request.h"
83 #include "ewk_url_response.h"
84 #include "ewk_web_error.h"
85 #include "ewk_web_resource.h"
86 #include <Evas.h>
87
88 // #if OS(TIZEN)
89 #include "ewk_frame.h"
90 // #endif
91
92 #include "ewk_history.h"
93
94 //#if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
95 #include "ewk_hit_test.h"
96 //#endif
97
98 //#if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
99 #include "ewk_enums.h"
100 //#endif
101
102 #ifdef __cplusplus
103 extern "C" {
104 #endif
105
106 /// Enum values containing text directionality values.
107 typedef enum {
108     EWK_TEXT_DIRECTION_RIGHT_TO_LEFT,
109     EWK_TEXT_DIRECTION_LEFT_TO_RIGHT
110 } Ewk_Text_Direction;
111
112 typedef struct _Ewk_View_Smart_Data Ewk_View_Smart_Data;
113 typedef struct _Ewk_View_Smart_Class Ewk_View_Smart_Class;
114
115 // #if OS(TIZEN)
116 /// Creates a type name for _Ewk_Event_Gesture.
117 typedef struct _Ewk_Event_Gesture Ewk_Event_Gesture;
118
119 /// Represents a gesture event.
120 struct _Ewk_Event_Gesture {
121     Ewk_Gesture_Type type; /**< type of the gesture event */
122     Evas_Coord_Point position; /**< position of the gesture event */
123     Evas_Point velocity; /**< velocity of the gesture event. The unit is pixel per second. */
124     double scale; /**< scale of the gesture event */
125     int count; /**< count of the gesture */
126     unsigned int timestamp; /**< timestamp of the gesture */
127 };
128
129 // #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
130 /**
131  * \enum    Ewk_Input_Type
132  * @brief   Provides type of focused input element
133  */
134 enum _Ewk_Input_Type {
135     EWK_INPUT_TYPE_TEXT,
136     EWK_INPUT_TYPE_TELEPHONE,
137     EWK_INPUT_TYPE_NUMBER,
138     EWK_INPUT_TYPE_EMAIL,
139     EWK_INPUT_TYPE_URL,
140     EWK_INPUT_TYPE_PASSWORD,
141     EWK_INPUT_TYPE_COLOR,
142     EWK_INPUT_TYPE_DATE,
143     EWK_INPUT_TYPE_DATETIME,
144     EWK_INPUT_TYPE_DATETIMELOCAL,
145     EWK_INPUT_TYPE_MONTH,
146     EWK_INPUT_TYPE_TIME,
147     EWK_INPUT_TYPE_WEEK
148 };
149 typedef enum _Ewk_Input_Type Ewk_Input_Type;
150 // #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
151 // #endif // #if OS(TIZEN)
152
153 /// Ewk view's class, to be overridden by sub-classes.
154 struct _Ewk_View_Smart_Class {
155     Evas_Smart_Class sc; /**< all but 'data' is free to be changed. */
156     unsigned long version;
157
158     Eina_Bool (*popup_menu_show)(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items, int selected_index);
159 //#if ENABLE(TIZEN_MULTIPLE_SELECT)
160     Eina_Bool (*multiple_popup_menu_show)(Ewk_View_Smart_Data *sd, Eina_Rectangle rect,Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items);
161 //#endif
162     Eina_Bool (*popup_menu_hide)(Ewk_View_Smart_Data *sd);
163     Eina_Bool (*popup_menu_update)(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, Eina_List* items, int selected_index);
164
165 // #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
166     Eina_Bool (*text_selection_down)(Ewk_View_Smart_Data *sd, int x, int y);
167     Eina_Bool (*text_selection_move)(Ewk_View_Smart_Data *sd, int x, int y);
168     Eina_Bool (*text_selection_up)(Ewk_View_Smart_Data *sd, int x, int y);
169 // #endif
170
171 //#if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
172     Eina_Bool (*input_picker_show)(Ewk_View_Smart_Data *sd, Ewk_Input_Type inputType, const char* inputValue);
173 //#endif
174
175 //#if ENABLE(TIZEN_DATALIST_ELEMENT)
176     Eina_Bool (*data_list_show)(Ewk_View_Smart_Data *sd, Ewk_Input_Type inputType, Eina_List *optionList);
177     Eina_Bool (*data_list_hide)(Ewk_View_Smart_Data *sd, Ewk_Input_Type inputType);
178 // #endif
179
180 // #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
181     Eina_Bool (*orientation_lock)(Ewk_View_Smart_Data *sd, int orientations);
182     void (*orientation_unlock)(Ewk_View_Smart_Data *sd);
183 // #endif
184
185     // event handling:
186     //  - returns true if handled
187     //  - if overridden, have to call parent method if desired
188     Eina_Bool (*focus_in)(Ewk_View_Smart_Data *sd);
189     Eina_Bool (*focus_out)(Ewk_View_Smart_Data *sd);
190     Eina_Bool (*mouse_wheel)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Wheel *ev);
191     Eina_Bool (*mouse_down)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Down *ev);
192     Eina_Bool (*mouse_up)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Up *ev);
193     Eina_Bool (*mouse_move)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Move *ev);
194     Eina_Bool (*key_down)(Ewk_View_Smart_Data *sd, const Evas_Event_Key_Down *ev);
195     Eina_Bool (*key_up)(Ewk_View_Smart_Data *sd, const Evas_Event_Key_Up *ev);
196
197 // #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
198     // color picker:
199     //   - Shows and hides color picker.
200     Eina_Bool (*input_picker_color_request)(Ewk_View_Smart_Data *sd, int r, int g, int b, int a);
201     Eina_Bool (*input_picker_color_dismiss)(Ewk_View_Smart_Data *sd);
202 // #endif
203
204 // #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
205     Eina_Bool (*formdata_candidate_show)(Ewk_View_Smart_Data *sd, int x, int y, int w, int h);
206     Eina_Bool (*formdata_candidate_hide)(Ewk_View_Smart_Data *sd);
207     Eina_Bool (*formdata_candidate_update_data)(Ewk_View_Smart_Data *sd, Eina_List *dataList);
208     Eina_Bool (*formdata_candidate_is_showing)(Ewk_View_Smart_Data *sd);
209 // #endif
210
211 //#if OS(TIZEN)
212     Eina_Bool (*gesture_start)(Ewk_View_Smart_Data *sd, const Ewk_Event_Gesture *ev);
213     Eina_Bool (*gesture_end)(Ewk_View_Smart_Data *sd, const Ewk_Event_Gesture *ev);
214     Eina_Bool (*gesture_move)(Ewk_View_Smart_Data *sd, const Ewk_Event_Gesture *ev);
215 //#endif
216
217 //#if ENABLE(TIZEN_SCREEN_READER)
218     Eina_Bool (*screen_reader_command_execute)(Ewk_View_Smart_Data *sd, unsigned int command, int data1, int data2);
219 //#endif
220 };
221
222 // #if OS(TIZEN)
223 /**
224  * Callback for ewk_view_web_app_capable_get
225  *
226  * @param capable web application capable
227  * @param user_data user_data will be passsed when ewk_view_web_app_capable_get is called
228  */
229 typedef void (*Ewk_Web_App_Capable_Get_Callback)(Eina_Bool capable, void* user_data);
230
231 /**
232  * Callback for ewk_view_web_app_icon_get
233  *
234  * @param icon_url web application icon
235  * @param user_data user_data will be passsed when ewk_view_web_app_icon_get is called
236  */
237 typedef void (*Ewk_Web_App_Icon_URL_Get_Callback)(const char* icon_url, void* user_data);
238 // #endif
239
240 /**
241  * The version you have to put into the version field
242  * in the @a Ewk_View_Smart_Class structure.
243  */
244 #define EWK_VIEW_SMART_CLASS_VERSION 1UL
245
246 /**
247  * Initializer for whole Ewk_View_Smart_Class structure.
248  *
249  * @param smart_class_init initializer to use for the "base" field
250  * (Evas_Smart_Class).
251  *
252  * @see EWK_VIEW_SMART_CLASS_INIT_NULL
253  * @see EWK_VIEW_SMART_CLASS_INIT_VERSION
254  * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION
255  */
256 #define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
257
258 /**
259  * Initializer to zero a whole Ewk_View_Smart_Class structure.
260  *
261  * @see EWK_VIEW_SMART_CLASS_INIT_VERSION
262  * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION
263  * @see EWK_VIEW_SMART_CLASS_INIT
264  */
265 #define EWK_VIEW_SMART_CLASS_INIT_NULL EWK_VIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
266
267 /**
268  * Initializer to zero a whole Ewk_View_Smart_Class structure and set
269  * name and version.
270  *
271  * Similar to EWK_VIEW_SMART_CLASS_INIT_NULL, but will set version field of
272  * Evas_Smart_Class (base field) to latest EVAS_SMART_CLASS_VERSION and name
273  * to the specific value.
274  *
275  * It will keep a reference to name field as a "const char *", that is,
276  * name must be available while the structure is used (hint: static or global!)
277  * and will not be modified.
278  *
279  * @see EWK_VIEW_SMART_CLASS_INIT_NULL
280  * @see EWK_VIEW_SMART_CLASS_INIT_VERSION
281  * @see EWK_VIEW_SMART_CLASS_INIT
282  */
283 #define EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION(name) EWK_VIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NAME_VERSION(name))
284
285 typedef struct _Ewk_View_Private_Data Ewk_View_Private_Data;
286 typedef struct EwkViewImpl EwkViewImpl;
287
288 /**
289  * @brief Contains an internal View data.
290  *
291  * It is to be considered private by users, but may be extended or
292  * changed by sub-classes (that's why it's in public header file).
293  */
294 struct _Ewk_View_Smart_Data {
295     Evas_Object_Smart_Clipped_Data base;
296     const Ewk_View_Smart_Class* api; /**< reference to casted class instance */
297     Evas_Object* self; /**< reference to owner object */
298     Evas_Object* image; /**< reference to evas_object_image for drawing web contents */
299     // FIXME: Ewk_View_Private_Data was replaced with EwkViewImpl in the webkit opensource.
300     // So, we have both Ewk_View_Private_Data and EwkViewImpl now,
301     // but Ewk_View_Private_Data should be removed later.
302     Ewk_View_Private_Data* priv; /**< should never be accessed, c++ stuff */
303     EwkViewImpl* ewkViewImpl; /**< should never be accessed, c++ stuff */
304     struct {
305         Evas_Coord x, y, w, h; /**< last used viewport */
306     } view;
307     struct { /**< what changed since last smart_calculate */
308         Eina_Bool any:1;
309         Eina_Bool size:1;
310         Eina_Bool position:1;
311     } changed;
312 };
313
314 /// Creates a type name for _Ewk_Web_Resource_Request.
315 typedef struct _Ewk_Web_Resource_Request Ewk_Web_Resource_Request;
316
317 /**
318  * @brief Structure containing details about a resource request.
319  */
320 struct _Ewk_Web_Resource_Request {
321     Ewk_Web_Resource *resource; /**< resource being requested */
322     Ewk_Url_Request *request; /**< URL request for the resource */
323     Ewk_Url_Response *redirect_response; /**< Possible redirect response for the resource or @c NULL */
324 };
325
326 /// Creates a type name for _Ewk_Web_Resource_Load_Response.
327 typedef struct _Ewk_Web_Resource_Load_Response Ewk_Web_Resource_Load_Response;
328
329 /**
330  * @brief Structure containing details about a response to a resource request.
331  */
332 struct _Ewk_Web_Resource_Load_Response {
333      Ewk_Web_Resource *resource; /**< resource requested */
334      Ewk_Url_Response *response; /**< resource load response */
335 };
336
337 /// Creates a type name for _Ewk_Web_Resource_Load_Error.
338 typedef struct _Ewk_Web_Resource_Load_Error Ewk_Web_Resource_Load_Error;
339
340 /**
341  * @brief Structure containing details about a resource load error.
342  *
343  * Details given about a resource load failure.
344  */
345 struct _Ewk_Web_Resource_Load_Error {
346     Ewk_Web_Resource *resource; /**< resource that failed loading */
347     Ewk_Web_Error *error; /**< load error */
348 };
349
350 /// Creates a type name for _Ewk_Download_Job_Error.
351 typedef struct _Ewk_Download_Job_Error Ewk_Download_Job_Error;
352
353 /**
354  * @brief Structure containing details about a download failure.
355  */
356 struct _Ewk_Download_Job_Error {
357     Ewk_Download_Job *download_job; /**< download that failed */
358     Ewk_Web_Error *error; /**< download error */
359 };
360
361 /// Enum values containing page contents type values.
362 typedef enum {
363     EWK_PAGE_CONTENTS_TYPE_MHTML,
364     EWK_PAGE_CONTENTS_TYPE_STRING
365 } Ewk_Page_Contents_Type;
366
367 /**
368  * Creates a type name for the callback function used to get the page contents.
369  *
370  * @param type type of the contents
371  * @param data string buffer of the contents
372  */
373 typedef void (*Ewk_Page_Contents_Cb)(Ewk_Page_Contents_Type type, const char *data);
374
375 /// Creates a type name for Ewk_Page_Contents_Context.
376 typedef struct Ewk_Page_Contents_Context Ewk_Page_Contents_Context;
377
378 /*
379  * @brief Structure containing page contents context used for ewk_view_page_contents_get() API.
380  */
381 struct Ewk_Page_Contents_Context {
382     Ewk_Page_Contents_Type type;
383     Ewk_Page_Contents_Cb callback;
384 };
385
386 /**
387  * Sets the smart class APIs, enabling view to be inherited.
388  *
389  * @param api class definition to set, all members with the
390  *        exception of @a Evas_Smart_Class->data may be overridden, must
391  *        @b not be @c NULL
392  *
393  * @note @a Evas_Smart_Class->data is used to implement type checking and
394  *       is not supposed to be changed/overridden. If you need extra
395  *       data for your smart class to work, just extend
396  *       Ewk_View_Smart_Class instead.
397  *       The Evas_Object which inherits the ewk_view should use
398  *       ewk_view_smart_add() to create Evas_Object instead of
399  *       evas_object_smart_add() because it performs additional initialization
400  *       for the ewk_view.
401  *
402  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure (probably
403  *         version mismatch)
404  *
405  * @see ewk_view_smart_add()
406  */
407 EAPI Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class *api);
408
409 /**
410  * Creates a new EFL WebKit view object with Evas_Smart and Ewk_Context.
411  *
412  * @note The Evas_Object which inherits the ewk_view should create its
413  *       Evas_Object using this API instead of evas_object_smart_add()
414  *       because the default initialization for ewk_view is done in this API.
415  *
416  * @param e canvas object where to create the view object
417  * @param smart Evas_Smart object. Its type should be EWK_VIEW_TYPE_STR
418  * @param context Ewk_Context object which is used for initializing
419  *
420  * @return view object on success or @c NULL on failure
421  */
422 EAPI Evas_Object *ewk_view_smart_add(Evas *e, Evas_Smart *smart, Ewk_Context *context);
423
424 /**
425  * Creates a new EFL WebKit view object.
426  *
427  * @param e canvas object where to create the view object
428  *
429  * @return view object on success or @c NULL on failure
430  */
431 EAPI Evas_Object *ewk_view_add(Evas *e);
432
433 /**
434  * Creates a new EFL WebKit view object based on specific Ewk_Context.
435  *
436  * @param e canvas object where to create the view object
437  * @param context Ewk_Context object to declare process model
438  *
439  * @return view object on success or @c NULL on failure
440  */
441 EAPI Evas_Object *ewk_view_add_with_context(Evas *e, Ewk_Context *context);
442
443 /**
444  * Asks the object to load the given URI.
445  *
446  * @param o view object to load @a URI
447  * @param uri uniform resource identifier to load
448  *
449  * @return @c EINA_TRUE is returned if @a o is valid, irrespective of load,
450  *         or @c EINA_FALSE on failure
451  */
452 EAPI Eina_Bool ewk_view_url_set(Evas_Object *o, const char *uri);
453
454 /**
455  * Returns the current URI string of view object.
456  *
457  * It returns an internal string and should not
458  * be modified. The string is guaranteed to be stringshared.
459  *
460  * @param o view object to get current URI
461  *
462  * @return current URI on success or @c NULL on failure
463  */
464 EAPI const char *ewk_view_url_get(const Evas_Object *o);
465
466 /**
467  * Asks the main frame to reload the current document.
468  *
469  * @param o view object to reload current document
470  *
471  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
472  *
473  * @see ewk_view_reload_bypass_cache()
474  */
475 EAPI Eina_Bool    ewk_view_reload(Evas_Object *o);
476
477 /**
478  * Reloads the current page's document without cache.
479  *
480  * @param o view object to reload current document
481  *
482  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
483  */
484 EAPI Eina_Bool ewk_view_reload_bypass_cache(Evas_Object *o);
485
486 /**
487  * Asks the main frame to stop loading.
488  *
489  * @param o view object to stop loading
490  *
491  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise.
492  */
493 EAPI Eina_Bool ewk_view_stop(Evas_Object* o);
494
495 /**
496  * Gets the Ewk_Settings of this view.
497  *
498  * @param o view object to get Ewk_Settings
499  *
500  * @return the Ewk_Settings of this view or @c NULL on failure
501  */
502 EAPI Ewk_Settings *ewk_view_settings_get(const Evas_Object *o);
503
504 // #if OS(TIZEN)
505
506 enum _Ewk_Page_Visibility_State {
507     EWK_PAGE_VISIBILITY_STATE_VISIBLE,
508     EWK_PAGE_VISIBILITY_STATE_HIDDEN,
509     EWK_PAGE_VISIBILITY_STATE_PRERENDER
510 };
511 typedef enum _Ewk_Page_Visibility_State Ewk_Page_Visibility_State;
512
513 enum _Ewk_Http_Method {
514     EWK_HTTP_METHOD_GET,
515     EWK_HTTP_METHOD_HEAD,
516     EWK_HTTP_METHOD_POST,
517     EWK_HTTP_METHOD_PUT,
518     EWK_HTTP_METHOD_DELETE,
519 };
520 typedef enum _Ewk_Http_Method Ewk_Http_Method;
521
522 /**
523  * Enum values used to specify search options.
524  * @brief   Provides option to find text
525  * @info    Keep this in sync with WKFindOptions.h
526  */
527 enum _Ewk_Find_Options {
528     EWK_FIND_OPTIONS_NONE, /**< no search flags, this means a case sensitive, no wrap, forward only search. */
529     EWK_FIND_OPTIONS_CASE_INSENSITIVE = 1 << 0, /**< case insensitive search. */
530     EWK_FIND_OPTIONS_AT_WORD_STARTS = 1 << 1, /**< search text only at the beginning of the words. */
531     EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START = 1 << 2, /**< treat capital letters in the middle of words as word start. */
532     EWK_FIND_OPTIONS_BACKWARDS = 1 << 3, /**< search backwards. */
533     EWK_FIND_OPTIONS_WRAP_AROUND = 1 << 4, /**< if not present search will stop at the end of the document. */
534     EWK_FIND_OPTIONS_SHOW_OVERLAY = 1 << 5, /**< show overlay */
535     EWK_FIND_OPTIONS_SHOW_FIND_INDICATOR = 1 << 6, /**< show indicator */
536     EWK_FIND_OPTIONS_SHOW_HIGHLIGHT = 1 << 7 /**< show highlight */
537 };
538 typedef enum _Ewk_Find_Options Ewk_Find_Options;
539
540 /**
541  * Callback for ewk_view_script_execute
542  *
543  * @param o the view object
544  * @param result_value value returned by script
545  * @param user_data user data
546  */
547 typedef void (*Ewk_View_Script_Execute_Callback)(Evas_Object* o, const char* result_value, void* user_data);
548
549 /**
550  * Callback for ewk_view_plain_text_get
551  *
552  * @param o the view object
553  * @param plain_text the contents of the given frame converted to plain text
554  * @param user_data user data
555  */
556 typedef void (*Ewk_View_Plain_Text_Get_Callback)(Evas_Object* o, const char* plain_text, void* user_data);
557
558 // #if ENABLE(TIZEN_SUPPORT_MHTML)
559 /**
560  * Creates a type name for the callback function used to get the page contents.
561  *
562  * @param o view object
563  * @param data mhtml data of the page contents
564  * @param user_data user data will be passed when ewk_view_mhtml_data_get is called
565  */
566 typedef void (*Ewk_View_MHTML_Data_Get_Callback)(Evas_Object *o, const char *data, void *user_data);
567 // #endif // ENABLE(TIZEN_SUPPORT_MHTML)
568
569 // #if OS(TIZEN)
570 /**
571  * Sets whether the ewk_view supports the mouse events or not.
572  *
573  * The ewk_view will support the mouse events if EINA_TRUE or not support the
574  * mouse events otherwise. The default value is EINA_TRUE.
575  *
576  * @param o view object to enable/disable the mouse events
577  * @param enabled a state to set
578  *
579  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
580  */
581 EAPI Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object *o, Eina_Bool enabled);
582
583 /**
584  * Queries if the ewk_view supports the mouse events.
585  *
586  * @param o view object to query if the mouse events are enabled
587  *
588  * @return @c EINA_TRUE if the mouse events are enabled or @c EINA_FALSE otherwise
589  */
590 EAPI Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object *o);
591 // #endif // #if OS(TIZEN)
592
593 /**
594  * Gets the Ewk_Context of this view.
595  *
596  * @param o the view object to get the WKPageRef
597  *
598  * @return the Ewk_Context of this view
599  */
600 EAPI Ewk_Context* ewk_view_context_get(const Evas_Object* o);
601
602 /**
603  * Gets the reference object for frame that represents the main frame.
604  *
605  * @param o view object to get main frame
606  *
607  * @return frame reference of frame object on success, or NULL on failure
608  */
609 EAPI Ewk_Frame_Ref ewk_view_main_frame_get(Evas_Object* o);
610
611 /**
612  * Gets the reference obect for the currently focused frame.
613  *
614  * @param o view object to get main frame
615  *
616  * @return frame reference of frame object on success, or NULL on failure
617  */
618 EAPI Ewk_Frame_Ref ewk_view_focused_frame_get(Evas_Object* o);
619
620 EAPI Eina_Bool ewk_view_horizontal_panning_hold_get(Evas_Object* o);
621 EAPI void ewk_view_horizontal_panning_hold_set(Evas_Object* o, Eina_Bool hold);
622 EAPI Eina_Bool ewk_view_vertical_panning_hold_get(Evas_Object* o);
623 EAPI void ewk_view_vertical_panning_hold_set(Evas_Object* o, Eina_Bool hold);
624 // #if ENABLE(TIZEN_GESTURE)
625 EAPI void ewk_view_use_smart_selection_set(Evas_Object* ewkView, Eina_Bool use);
626 // #endif
627 EAPI void ewk_view_top_of_contents_go(Evas_Object* ewkView);
628
629 /**
630  * Gets the minimum and maximum value of the scale range or -1 on failure
631  *
632  * @param o view object to get the minimum and maximum value of the scale range
633  * @param min_scale Pointer to an double in which to store the minimum scale factor of the object.
634  * @param max_scale Pointer to an double in which to store the maximum scale factor of the object.
635  *
636  * @note Use @c NULL pointers on the scale components you're not
637  * interested in: they'll be ignored by the function.
638  */
639 EAPI void ewk_view_scale_range_get(Evas_Object* o, double* min_scale, double* max_scale);
640
641 /**
642  * Gets the current text zoom level.
643  *
644  * @param o view object to get the zoom level
645  *
646  * @return current zoom level in use on success or @c -1.0 on failure
647  */
648 EAPI double ewk_view_text_zoom_get(const Evas_Object* o);
649
650 /**
651  * Sets the current text zoom level.
652  *
653  * @param o view object to set the zoom level
654  * @param textZoomFactor a new level to set
655  *
656  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
657  */
658 EAPI Eina_Bool ewk_view_text_zoom_set(Evas_Object* o, double text_zoom_factor);
659
660 EAPI void ewk_view_suspend(Evas_Object* o);
661 EAPI void ewk_view_resume(Evas_Object* o);
662
663 typedef Eina_Bool (*Ewk_View_JavaScript_Alert_Callback)(Evas_Object* o, const char* alert_text, void* user_data);
664 EAPI void ewk_view_javascript_alert_callback_set(Evas_Object* o, Ewk_View_JavaScript_Alert_Callback callback, void* user_data);
665 EAPI void ewk_view_javascript_alert_reply(Evas_Object* o);
666
667 typedef Eina_Bool (*Ewk_View_JavaScript_Confirm_Callback)(Evas_Object* o, const char* message, void* user_data);
668 EAPI void ewk_view_javascript_confirm_callback_set(Evas_Object* o, Ewk_View_JavaScript_Confirm_Callback callback, void* user_data);
669 EAPI void ewk_view_javascript_confirm_reply(Evas_Object* o, Eina_Bool result);
670
671 typedef Eina_Bool (*Ewk_View_JavaScript_Prompt_Callback)(Evas_Object* o, const char* message, const char* default_value, void* user_data);
672 EAPI void ewk_view_javascript_prompt_callback_set(Evas_Object* o, Ewk_View_JavaScript_Prompt_Callback callback, void* user_data);
673 EAPI void ewk_view_javascript_prompt_reply(Evas_Object* o, const char* result);
674
675 //#if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
676 typedef Eina_Bool (*Ewk_View_Before_Unload_Confirm_Panel_Callback)(Evas_Object* o, const char* message, void* user_data);
677 EAPI void ewk_view_before_unload_confirm_panel_callback_set(Evas_Object* o, Ewk_View_Before_Unload_Confirm_Panel_Callback callback, void* user_data);
678 EAPI void ewk_view_before_unload_confirm_panel_reply(Evas_Object* o, Eina_Bool result);
679 //#endif
680
681 typedef Eina_Bool (*Ewk_View_Open_Panel_Callback)(Evas_Object* o, Eina_Bool allow_multiple_files, Eina_List* accepted_mime_types, const char* capture, void* user_data);
682 EAPI void ewk_view_open_panel_callback_set(Evas_Object* o, Ewk_View_Open_Panel_Callback callback, void* user_data);
683 EAPI void ewk_view_open_panel_reply(Evas_Object* o, Eina_List* file_url, Eina_Bool result);
684
685 /**
686  * Delivers a Web intent to the view's main frame.
687  *
688  * @param o view object to deliver the intent to
689  *
690  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise.
691  */
692 EAPI Eina_Bool    ewk_view_intent_deliver(Evas_Object *o, Ewk_Intent *intent);
693
694 /**
695  * Asks the main frame to navigate back in the history.
696  *
697  * @param o view object to navigate back
698  *
699  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
700  *
701  * @see ewk_frame_back()
702  */
703 EAPI Eina_Bool    ewk_view_back(Evas_Object *o);
704
705 /**
706  * Asks the main frame to navigate forward in the history.
707  *
708  * @param o view object to navigate forward
709  *
710  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
711  *
712  * @see ewk_frame_forward()
713  */
714 EAPI Eina_Bool    ewk_view_forward(Evas_Object *o);
715
716 /**
717  * Queries if it is possible to navigate backwards one item in the history.
718  *
719  * @param o view object to query if backward navigation is possible
720  *
721  * @return @c EINA_TRUE if it is possible to navigate backwards in the history, @c EINA_FALSE otherwise
722  */
723 EAPI Eina_Bool    ewk_view_back_possible(Evas_Object *o);
724
725 /**
726  * Queries if it is possible to navigate forwards one item in the history.
727  *
728  * @param o view object to query if forward navigation is possible
729  *
730  * @return @c EINA_TRUE if it is possible to navigate forwards in the history, @c EINA_FALSE otherwise
731  */
732 EAPI Eina_Bool    ewk_view_forward_possible(Evas_Object *o);
733
734 /**
735  * Gets the current title of the main frame.
736  *
737  * It returns an internal string and should not
738  * be modified. The string is guaranteed to be stringshared.
739  *
740  * @param o view object to get current title
741  *
742  * @return current title on success or @c NULL on failure
743  */
744 EAPI const char *ewk_view_title_get(const Evas_Object *o);
745
746 /**
747  * Gets the current load progress of page.
748  *
749  * The progress estimation from 0.0 to 1.0.
750  *
751  * @param o view object to get the current progress
752  *
753  * @return the load progress of page, value from 0.0 to 1.0,
754  *         or @c -1.0 on failure
755  */
756 EAPI double ewk_view_load_progress_get(const Evas_Object *o);
757
758 /*
759  * Requests loading of the given request data.
760  *
761  * @param o view object to load
762  * @param url uniform resource identifier to load
763  * @param method http method
764  * @param headers http headers
765  * @param body http body data
766  *
767  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
768  */
769 EAPI Eina_Bool ewk_view_url_request_set(Evas_Object* o, const char* url, Ewk_Http_Method method, Eina_Hash* headers, const char* body);
770
771 /**
772  * Requests the specified plain text string into the view object
773  *
774  * @note The mime type of document will be "text/plain".
775  *
776  * @return the load progress of page, value from 0.0 to 1.0,
777  *         or @c -1.0 on failure
778  */
779 EAPI Eina_Bool ewk_view_plain_text_set(Evas_Object* o, const char* plain_text);
780
781 /**
782  * Requests loading the given contents by mime type into the view object.
783  *
784  * @param o view object to load
785  * @param contents what to load
786  * @param contents_size size of @a contents (in bytes),
787  * @param mime_type type of @a contents data, if @c 0 is given "text/html" is assumed
788  * @param encoding encoding for @a contents data, if @c 0 is given "UTF-8" is assumed
789  * @param base_uri base uri to use for relative resources, may be @c 0,
790  *        if provided @b must be an absolute uri
791  *
792  * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors
793  */
794 EAPI Eina_Bool ewk_view_contents_set(Evas_Object* o, const char* contents, size_t contents_size, char* mime_type, char* encoding, char* base_uri);
795
796 /**
797  * Requests loading the given contents.
798  *
799  * @param o view object to load document
800  * @param html what to load
801  * @param base_uri base uri to use for relative resources, may be @c 0,
802  *        if provided @b must be an absolute uri
803  *
804  * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors
805  */
806 EAPI Eina_Bool ewk_view_html_contents_set(Evas_Object* o, const char* html, const char* base_uri);
807
808 /**
809  * Requests for setting page visibility state.
810  *
811  * @param o view object to set the page visibility
812  * @param page_visibility_state visible state of the page to set
813  * @param initial_state @c EINA_TRUE if this function is called at page initialization time,
814  *                     @c EINA_FALSE otherwise
815  *
816  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
817  */
818 EAPI Eina_Bool ewk_view_page_visibility_state_set(Evas_Object* o, Ewk_Page_Visibility_State page_visibility_state, Eina_Bool initial_state);
819
820 /**
821 * Request to set the user agent string.
822 *
823 * @param o view object to set the user agent string
824 *
825 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
826 */
827 EAPI Eina_Bool ewk_view_user_agent_set(Evas_Object* o, const char* user_agent);
828
829 /**
830 * Returns user agent string.
831 *
832 * @param o view object to get the user agent string
833 *
834 * @return @c user agent string
835 */
836 EAPI const char* ewk_view_user_agent_get(const Evas_Object* o);
837 //#if ENABLE(TIZEN_CUSTOM_HEADERS)
838 /**
839 * add custom header
840 *
841 * @param o view object to add custom header
842 *
843 * @param name custom header name to add the custom header
844 *
845 * @param value custom header value to add the custom header
846 *
847 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
848 */
849 EAPI Eina_Bool ewk_view_custom_header_add(const Evas_Object* o, const char* name, const char* value);
850 /**
851 * remove custom header
852 *
853 * @param o view object to remove custom header
854 *
855 * @param name custom header name to remove the custom header
856 *
857 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
858 */
859 EAPI Eina_Bool ewk_view_custom_header_remove(const Evas_Object* o, const char* name);
860 /**
861 * clears all custom headers
862 *
863 * @param o view object to clear custom headers
864 *
865 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
866 */
867 EAPI Eina_Bool ewk_view_custom_header_clear(const Evas_Object* o);
868 //#endif
869
870 /**
871  * Searches and hightlights the given string in the document.
872  *
873  * @param o view object to find text
874  * @param text text to find
875  * @param options options to find
876  * @param max_match_count maximum match count to find, unlimited if 0
877  *
878  * @return @c EINA_TRUE on success, @c EINA_FALSE on errors
879  */
880 EAPI Eina_Bool ewk_view_text_find(Evas_Object *o, const char *text, Ewk_Find_Options options, unsigned max_match_count);
881
882 /**
883  * Clears the highlight of searched text.
884  *
885  * @param o view object to find text
886  *
887  * @return @c EINA_TRUE on success, @c EINA_FALSE on errors
888  */
889 EAPI Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object *o);
890
891 //#if ENABLE(TIZEN_WEBKIT2_VIEW_VISIBILITY)
892 /**
893  * Request to set the current page's visibility.
894  *
895  * @param o view object to set the visibility.
896  * @param enable EINA_TRUE to set on the visibility of the page, EINA_FALSE otherwise.
897  *
898  * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors
899  */
900 EAPI Eina_Bool ewk_view_visibility_set(Evas_Object* o, Eina_Bool enable);
901 //#endif
902
903 /**
904  * Returns the evas image object of the specified viewArea of page
905  *
906  * The returned evas image object @b should be freed after use.
907  *
908  * @param o view object to get specified rectangle of cairo surface.
909  * @param viewArea rectangle of cairo surface.
910  * @param scaleFactor scale factor of cairo surface.
911  * @param canvas canvas for creating evas image.
912  *
913  * @return newly allocated evas image object on sucess or @c 0 on failure.
914  */
915 EAPI Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* o, Eina_Rectangle viewArea, float scaleFactor, Evas* canvas);
916
917 // #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
918 /**
919  * Start a server for inspecting web pages
920  * This server will be used by Remote Web Browser to transfer messages over network
921  *
922  * @param [o] view object to debug
923  * @param [in] port It is a port number for the server. A free port on system will be allocated if port is 0
924  *
925  * @return @c assigned port number on success or @c 0 on failure
926  */
927 EAPI unsigned int ewk_view_inspector_server_start(Evas_Object* o, unsigned int port);
928
929 /**
930  * Stop a server for inspecting web pages
931  *
932  * @param [o] view object to debug
933  *
934  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
935  */
936 EAPI Eina_Bool ewk_view_inspector_server_stop(Evas_Object* o);
937 // #endif
938 //
939 /**
940  * Scrolls webpage of view by dx and dy.
941  *
942  * @param o view object to scroll
943  * @param dx horizontal offset to scroll
944  * @param dy vertical offset to scroll
945  */
946 EAPI void ewk_view_scroll_by(Evas_Object* o, int dx, int dy);
947
948 /**
949  * Gets the current scroll position of given view.
950  *
951  * @param o view object to get the current scroll position
952  * @param x the pointer to store the horizontal position, may be @c 0
953  * @param y the pointer to store the vertical position, may be @c 0
954  *
955  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise and
956  *         values are zeroed.
957  */
958 EAPI Eina_Bool ewk_view_scroll_pos_get(Evas_Object* o, int* x, int* y);
959
960 /**
961  * Sets an absolute scroll of the given view.
962  *
963  * Both values are from zero to the contents size minus the viewport
964  * size.
965  *
966  * @param o view object to scroll
967  * @param x horizontal position to scroll
968  * @param y vertical position to scroll
969  *
970  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
971  */
972 EAPI Eina_Bool ewk_view_scroll_set(Evas_Object* o, int x, int y);
973
974 /**
975  * Gets the possible scroll size of the given view.
976  *
977  * Possible scroll size is contents size minus the viewport size.
978  *
979  * @param o view object to get scroll size
980  * @param w the pointer to store the horizontal size that is possible to scroll,
981  *        may be @c 0
982  * @param h the pointer to store the vertical size that is possible to scroll,
983  *        may be @c 0
984  *
985  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise and
986  *         values are zeroed
987  */
988 EAPI Eina_Bool ewk_view_scroll_size_get(const Evas_Object* o, int* w, int* h);
989
990 /**
991  * Requests for getting web application capable.
992  *
993  * @param callback result callback to get web database quota
994  * @param user_data user_data will be passed when result_callback is called
995  *    -I.e., user data will be kept until callback is called
996  *
997  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
998  */
999 EAPI Eina_Bool ewk_view_web_application_capable_get(Evas_Object* o, Ewk_Web_App_Capable_Get_Callback callback, void* user_data);
1000
1001 /**
1002  * Requests for getting web application icon string.
1003  *
1004  * @param callback result callback to get web database quota
1005  * @param user_data user_data will be passed when result_callback is called
1006  *    -I.e., user data will be kept until callback is called
1007  *
1008  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
1009  */
1010 EAPI Eina_Bool ewk_view_web_application_icon_url_get(Evas_Object* o, Ewk_Web_App_Icon_URL_Get_Callback callback, void* user_data);
1011
1012 /**
1013  * Executes editor command.
1014  *
1015  * @param o view object to execute command
1016  * @param command editor command to execute
1017  * @param value the value to be passed into command
1018  *
1019  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
1020  */
1021 EAPI Eina_Bool ewk_view_command_execute(Evas_Object* o, const char* command, const char* value);
1022
1023 /**
1024  * Gets last known contents size.
1025  *
1026  * @param o view object to get contents size
1027  * @param width pointer to store contents size width, may be @c 0
1028  * @param height pointer to store contents size height, may be @c 0
1029  *
1030  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure and
1031  *         @a width and @a height will be zeroed
1032  */
1033 EAPI Eina_Bool ewk_view_contents_size_get(Evas_Object* o, Evas_Coord* width, Evas_Coord* height);
1034
1035 /**
1036  * Create PDF file of page contents
1037  *
1038  * @param o view object to get page contents.
1039  * @param width the suface width of PDF file.
1040  * @param height the suface height of PDF file.
1041  * @param fileName the file name for creating PDF file.
1042  *
1043  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
1044  */
1045 EAPI Eina_Bool ewk_view_contents_pdf_get_temp(Evas_Object* o, int width, int height, const char* fileName);
1046 EAPI Eina_Bool ewk_view_contents_pdf_get(Evas_Object* o, int width, int height, const char* fileName);
1047
1048 // #if ENABLE(TIZEN_WEB_STORAGE)
1049 /**
1050  * Callback for ewk_view_web_storage_quota_get
1051  *
1052  * @param quota web storage quota
1053  * @param user_data user_data will be passed when ewk_view_web_storage_quota_get is called
1054  */
1055 typedef void (*Ewk_Web_Storage_Quota_Get_Callback)(uint32_t quota, void* user_data);
1056
1057 /**
1058  * Requests for getting web storage quota.
1059  *
1060  * @param o view object to get web storage quota
1061  * @param result_cb callback to get web database origins
1062  * @param user_data user_data will be passed when result_cb is called
1063  *    -I.e., user data will be kept until callback is called
1064  *
1065  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
1066  */
1067 EAPI Eina_Bool ewk_view_web_storage_quota_get(const Evas_Object* o, Ewk_Web_Storage_Quota_Get_Callback result_callback, void* user_data);
1068
1069 /**
1070  * Requests for setting web storage quota.
1071  *
1072  * @param o view object to set web storage quota
1073  * @param quota quota to store web storage db.
1074  *
1075  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
1076  */
1077 EAPI Eina_Bool ewk_view_web_storage_quota_set(Evas_Object* o, uint32_t quota);
1078 // #endif // #if ENABLE(TIZEN_WEB_STORAGE)
1079
1080 /**
1081  * Requests execution of the given script.
1082  *
1083  * @note This allows to use NULL for the callback parameter.
1084  *       So, if the result data from the script is not required, NULL might be used for the callback parameter.
1085  *
1086  * @param o view object to execute script
1087  * @param script Java Script to execute
1088  * @param callback result callback
1089  * @param user_data user data
1090  *
1091  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
1092  */
1093 EAPI Eina_Bool ewk_view_script_execute(Evas_Object* o, const char* script, Ewk_View_Script_Execute_Callback callback, void* user_data);
1094
1095 /**
1096  * Retrieve the contents in plain text.
1097  *
1098  * @param o view object whose contents to retrieve.
1099  * @param callback result callback
1100  * @param user_data user data
1101  *
1102  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
1103  */
1104 EAPI Eina_Bool ewk_view_plain_text_get(Evas_Object* o, Ewk_View_Plain_Text_Get_Callback callback, void* user_data);
1105
1106 // #if ENABLE(TIZEN_SUPPORT_MHTML)
1107 /**
1108  * Get page contents as MHTML data
1109  *
1110  * @param o view object to get the page contents
1111  * @param callback callback function to be called when the operation is finished
1112  * @param user_data user data to be passed to the callback function
1113  *
1114  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
1115  */
1116 EAPI Eina_Bool ewk_view_mhtml_data_get(Evas_Object *o, Ewk_View_MHTML_Data_Get_Callback callback, void *user_data);
1117 // #endif // ENABLE(TIZEN_SUPPORT_MHTML)
1118
1119 // #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
1120 /**
1121  * Creates a new hit test for the given veiw object and point.
1122  *
1123  * The returned object should be freed by ewk_hit_test_free().
1124  *
1125  * @param o view object to do hit test on
1126  * @param x the horizontal position to query
1127  * @param y the vertical position to query
1128  * @param hit_test_mode the Ewk_Hit_Test_Mode enum value to query
1129  *
1130  * @return a newly allocated hit test on success, @c 0 otherwise
1131  */
1132 EAPI Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* o, int x, int y, int hit_test_mode);
1133 // #endif // #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
1134
1135 /**
1136  * Get the whole history(whole back & forward list) associated with this view.
1137  *
1138  * @param o view object to get the history(whole back & forward list)
1139  *
1140  * @return a newly allocated history of @b newly allocated item
1141  *         instance. This memory of each item must be released with
1142  *         ewk_history_free() after use.
1143  *
1144  * @see ewk_history_free()
1145  */
1146 EAPI Ewk_History* ewk_view_history_get(Evas_Object* o);
1147
1148 /**
1149  * Requests to set recording surface.
1150  *
1151  * @param o view object to set recording surface
1152  * @param enable @c EINA_TRUE to enable recording surface
1153  *        @c EINA_FALSE to disable
1154  *
1155  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
1156  */
1157 EINA_DEPRECATED EAPI Eina_Bool ewk_view_recording_surface_enable_set(Evas_Object* o, Eina_Bool enable);
1158
1159 /*
1160  * Notify that notification is closed.
1161  *
1162  * @param notification_list list of Ewk_Notification pointer
1163  *        notification_list is freed in this function.
1164  *
1165  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
1166  */
1167 EAPI Eina_Bool ewk_view_notification_closed(Evas_Object* o, Eina_List* notification_list);
1168
1169 /*
1170  * Sends the orientation of the device.
1171  *
1172  * If orientation value is changed, orientationchanged event will occur.
1173  *
1174  * @param o view object to receive orientation event.
1175  * @param orientation the new orientation of the device. (degree)
1176  *
1177  * orientation will be 0 degrees when the device is oriented to natural position,
1178  *                     90 degrees when it's left side is at the top,
1179  *                    -90 degrees when it's right side is at the top,
1180  *                     180 degrees when it is upside down.
1181  */
1182 EAPI void ewk_view_orientation_send(Evas_Object *o, int orientation);
1183
1184 /**
1185  * Gets the current encoding.
1186  *
1187  * @param o view object to get the current encoding
1188  *
1189  * @return @c current encoding, or @c 0 if it's not setted
1190  */
1191 EAPI const char* ewk_view_encoding_custom_get(const Evas_Object* o);
1192
1193 /**
1194  * Sets the encoding and reloads the page.
1195  *
1196  * @param o view to set the encoding
1197  * @param encoding the new encoding to set or @c 0 to restore the default one
1198  */
1199 EAPI void ewk_view_encoding_custom_set(Evas_Object* o, const char* encoding);
1200
1201 // #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
1202 EINA_DEPRECATED EAPI Eina_Bool ewk_view_text_selection_enable_set(Evas_Object* o, Eina_Bool enable);
1203 EAPI Eina_Bool ewk_view_text_selection_range_get(Evas_Object* o, Eina_Rectangle* left_rect, Eina_Rectangle* right_rect);
1204 EAPI const char* ewk_view_text_selection_text_get(Evas_Object* o);
1205 EINA_DEPRECATED EAPI Eina_Bool ewk_view_auto_clear_text_selection_mode_set(Evas_Object* o, Eina_Bool enable);
1206 EINA_DEPRECATED EAPI Eina_Bool ewk_view_auto_clear_text_selection_mode_get(Evas_Object* o);
1207 // #endif // #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
1208
1209 // #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1210 /**
1211  * Sets the focused input element value
1212  *
1213  * @param o view object to send the value
1214  * @param value the string value to be set
1215  */
1216 EAPI void ewk_view_focused_input_element_value_set(Evas_Object* o, const char* value);
1217 // #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1218
1219 // #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1220 /**
1221  * Gets the focused input element's value
1222  *
1223  * @param o view object to get the value
1224  *
1225  * @return focused input element's value on success or NULL on failure.
1226  */
1227 EAPI const char* ewk_view_focused_input_element_value_get(Evas_Object* o);
1228 // #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1229
1230 // #if ENABLE(TIZEN_DATALIST_ELEMENT)
1231 /**
1232  * Closes data list picker
1233  *
1234  * @param o view object contains data list element
1235  * @param value value to be set to the input element
1236  */
1237 EAPI void ewk_view_data_list_close(Evas_Object *o, const char *value);
1238 //#endif // ENABLE(TIZEN_DATALIST_ELEMENT)
1239
1240 /**
1241  * Selects index of current popup menu.
1242  *
1243  * @param o view object contains popup menu.
1244  * @param index index of item to select
1245  *
1246  * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably
1247  *         popup menu is not selected or index is out of range)
1248  */
1249 EAPI Eina_Bool ewk_view_popup_menu_select(Evas_Object *o, unsigned int index);
1250
1251 //#if ENABLE(TIZEN_MULTIPLE_SELECT)
1252 /**
1253  * Selects Multiple indexes  of current popup menu.
1254  *
1255  * @param o view object contains popup menu.
1256  * @param changedlist  list of item selected and deselected
1257  *
1258  * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably
1259  *         popup menu is not selected or index is out of range)
1260  */
1261 EAPI Eina_Bool ewk_view_popup_menu_multiple_select(Evas_Object *o, Eina_Inarray* changedlist);
1262 //l#endif
1263
1264 /**
1265  * Closes current popup menu.
1266  *
1267  * @param o view object contains popup menu.
1268  *
1269  * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably
1270  *         popup menu is not selected)
1271  */
1272 EAPI Eina_Bool ewk_view_popup_menu_close(Evas_Object *o);
1273
1274 typedef Eina_Bool (*Ewk_Orientation_Lock_Cb)(Evas_Object* o, Eina_Bool need_lock, int orientation, void* user_data);
1275  /**
1276  * Deprecated
1277  * Sets callback of orientation lock function
1278  *
1279  * func will be called when screen lock is called or unlock is called.
1280  * When screen.lockOrientation is called, need_lock will be true and orientation
1281  * will be the flags which should be locked.
1282  * For example, when contents called 'screen.lockOrientation("portrait"), orientation
1283  * will be EWK_SCREEN_ORIENTATION_PORTRAIT_PRIMARY | EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY
1284  * When screen.unlockOrientation is called, need_lock will be false.
1285  *
1286  * @param o view object to set the callback of orientation
1287  * @param func callback function to be called when screen orientation is locked or unlocked.
1288  * @param use_data user_data will be passsed when ewk_view_web_app_icon_get is called
1289  *
1290  * @return current URI on success or @c 0 on failure
1291  */
1292 EINA_DEPRECATED EAPI void ewk_view_orientation_lock_callback_set(Evas_Object *o, Ewk_Orientation_Lock_Cb func, void* user_data);
1293
1294  // #endif // #if OS(TIZEN)
1295
1296 /**
1297  * Loads the specified @a html string as the content of the view.
1298  *
1299  * External objects such as stylesheets or images referenced in the HTML
1300  * document are located relative to @a baseUrl.
1301  *
1302  * If an @a unreachableUrl is passed it is used as the url for the loaded
1303  * content. This is typically used to display error pages for a failed
1304  * load.
1305  *
1306  * @param o view object to load the HTML into
1307  * @param html HTML data to load
1308  * @param baseUrl Base URL used for relative paths to external objects (optional)
1309  * @param unreachableUrl URL that could not be reached (optional)
1310  *
1311  * @return @c EINA_TRUE if it the HTML was successfully loaded, @c EINA_FALSE otherwise
1312  */
1313 EAPI Eina_Bool ewk_view_html_string_load(Evas_Object *o, const char *html, const char *baseUrl, const char *unreachableUrl);
1314
1315 /**
1316  * Scales the current page, centered at the given point.
1317  *
1318  * @param o view object to set the zoom level
1319  * @param scale_factor a new level to set
1320  * @param cx x of center coordinate
1321  * @param cy y of center coordinate
1322  *
1323  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
1324  */
1325 EAPI Eina_Bool ewk_view_scale_set(Evas_Object *o, double scaleFactor, int x, int y);
1326
1327 /**
1328  * Queries the current scale factor of the page.
1329  *
1330  * It returns previous scale factor after ewk_view_scale_set is called immediately
1331  * until scale factor of page is really changed.
1332  *
1333  * @param o view object to get the scale factor
1334  *
1335  * @return current scale factor in use on success or @c -1.0 on failure
1336  */
1337 EAPI double ewk_view_scale_get(const Evas_Object *o);
1338
1339 /**
1340  * Queries the ratio between the CSS units and device pixels when the content is unscaled.
1341  *
1342  * When designing touch-friendly contents, knowing the approximated target size on a device
1343  * is important for contents providers in order to get the intented layout and element
1344  * sizes.
1345  *
1346  * As most first generation touch devices had a PPI of approximately 160, this became a
1347  * de-facto value, when used in conjunction with the viewport meta tag.
1348  *
1349  * Devices with a higher PPI learning towards 240 or 320, applies a pre-scaling on all
1350  * content, of either 1.5 or 2.0, not affecting the CSS scale or pinch zooming.
1351  *
1352  * This value can be set using this property and it is exposed to CSS media queries using
1353  * the -webkit-device-pixel-ratio query.
1354  *
1355  * For instance, if you want to load an image without having it upscaled on a web view
1356  * using a device pixel ratio of 2.0 it can be done by loading an image of say 100x100
1357  * pixels but showing it at half the size.
1358  *
1359  * @media (-webkit-min-device-pixel-ratio: 1.5) {
1360  *     .icon {
1361  *         width: 50px;
1362  *         height: 50px;
1363  *         url: "/images/icon@2x.png"; // This is actually a 100x100 image
1364  *     }
1365  * }
1366  *
1367  * If the above is used on a device with device pixel ratio of 1.5, it will be scaled
1368  * down but still provide a better looking image.
1369  *
1370  * @param o view object to get device pixel ratio
1371  *
1372  * @return the ratio between the CSS units and device pixels,
1373  *         or @c -1.0 on failure
1374  */
1375 EAPI float ewk_view_device_pixel_ratio_get(const Evas_Object *o);
1376
1377 /**
1378  * Sets the ratio between the CSS units and device pixels when the content is unscaled.
1379  *
1380  * @param o view object to set device pixel ratio
1381  *
1382  * @return @c EINA_TRUE if the device pixel ratio was set, @c EINA_FALSE otherwise
1383  *
1384  * @see ewk_view_device_pixel_ratio_get()
1385  */
1386 EAPI Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object *o, float ratio);
1387
1388 /**
1389  * Sets the theme path that will be used by this view.
1390  *
1391  * This also sets the theme on the main frame. As frames inherit theme
1392  * from their parent, this will have all frames with unset theme to
1393  * use this one.
1394  *
1395  * @param o view object to change theme
1396  * @param path theme path, may be @c NULL to reset to the default theme
1397  */
1398 EAPI void ewk_view_theme_set(Evas_Object *o, const char *path);
1399
1400 /**
1401  * Gets the theme set on this view.
1402  *
1403  * This returns the value set by ewk_view_theme_set().
1404  *
1405  * @param o view object to get theme path
1406  *
1407  * @return the theme path, may be @c NULL if not set
1408  */
1409 EAPI const char *ewk_view_theme_get(const Evas_Object *o);
1410
1411 /**
1412  * Gets the current custom character encoding name.
1413  *
1414  * @param o view object to get the current encoding
1415  *
1416  * @return @c eina_strinshare containing the current encoding, or
1417  *         @c NULL if it's not set
1418  */
1419 EAPI const char  *ewk_view_custom_encoding_get(const Evas_Object *o);
1420
1421 /**
1422  * Sets the custom character encoding and reloads the page.
1423  *
1424  * @param o view to set the encoding
1425  * @param encoding the new encoding to set or @c NULL to restore the default one
1426  *
1427  * @return @c EINA_TRUE on success @c EINA_FALSE otherwise
1428  */
1429 EAPI Eina_Bool    ewk_view_custom_encoding_set(Evas_Object *o, const char *encoding);
1430
1431 // #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
1432 /*
1433  * Sets the user chosen color. To be used when implementing a color picker.
1434  *
1435  * The function should only be called when a color has been requested by the document.
1436  * If called when this is not the case or when the input picker has been dismissed, this
1437  * function will fail and return EINA_FALSE.
1438  *
1439  * @param o view object contains color picker
1440  * @param r red channel value to be set
1441  * @param g green channel value to be set
1442  * @param b blue channel value to be set
1443  * @param a alpha channel value to be set
1444  *
1445  * @return @c EINA_TRUE on success @c EINA_FALSE otherwise
1446  */
1447 EAPI Eina_Bool ewk_view_color_picker_color_set(Evas_Object *o, int r, int g, int b, int a);
1448 // #endif
1449
1450 /**
1451  * Feeds the touch event to the view.
1452  *
1453  * @param o view object to feed touch event
1454  * @param type the type of touch event
1455  * @param points a list of points (Ewk_Touch_Point) to process
1456  * @param modifiers an Evas_Modifier handle to the list of modifier keys
1457  *        registered in the Evas. Users can get the Evas_Modifier from the Evas
1458  *        using evas_key_modifier_get() and can set each modifier key using
1459  *        evas_key_modifier_on() and evas_key_modifier_off()
1460  *
1461  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
1462  */
1463 EAPI Eina_Bool ewk_view_feed_touch_event(Evas_Object *o, Ewk_Touch_Event_Type type, const Eina_List *points, const Evas_Modifier *modifiers);
1464
1465 /**
1466  * Sets whether the ewk_view supports the touch events or not.
1467  *
1468  * The ewk_view will support the touch events if @c EINA_TRUE or not support the
1469  * touch events otherwise. The default value is @c EINA_FALSE.
1470  *
1471  * @param o view object to enable/disable the touch events
1472  * @param enabled a state to set
1473  *
1474  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
1475  */
1476 EAPI Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object *o, Eina_Bool enabled);
1477
1478 /**
1479  * Queries if the ewk_view supports the touch events.
1480  *
1481  * @param o view object to query if the touch events are enabled
1482  *
1483  * @return @c EINA_TRUE if the touch events are enabled or @c EINA_FALSE otherwise
1484  */
1485 EAPI Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object *o);
1486
1487 /**
1488  * Sets the visibility of main frame scrollbar.
1489  *
1490  * @param o view object
1491  * @param visible visibility of main frame scrollbar
1492  *
1493  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
1494  */
1495 Eina_Bool ewk_view_main_frame_scrollbar_visible_set(Evas_Object *o, Eina_Bool visible);
1496
1497 /**
1498  * Gets the visibility of main frame scrollbar.
1499  *
1500  * @param o view object
1501  *
1502  * @return @c EINA_TRUE if scrollbar is visible or @c EINA_FALSE on failure
1503  */
1504 Eina_Bool ewk_view_main_frame_scrollbar_visible_get(const Evas_Object *o);
1505
1506 /**
1507  * Get contents of the current web page.
1508  *
1509  * @param o view object to get the page contents
1510  * @param context context of the page contents which has contents type and callback function
1511  *
1512  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
1513  */
1514 EAPI Eina_Bool ewk_view_page_contents_get(const Evas_Object *o, Ewk_Page_Contents_Context *context);
1515
1516 /**
1517  * Scroll to the position of the given view with animation
1518  *
1519  * Both values are from zero to the contents size minus the viewport
1520  * size.
1521  *
1522  * @param o view object to scroll
1523  * @param x horizontal position to scroll
1524  * @param y vertical position to scroll
1525  *
1526  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
1527  */
1528 EAPI Eina_Bool ewk_view_animated_scroll_set(Evas_Object *o, int x, int y);
1529
1530 /**
1531  * Clear back forward list of a page.
1532  *
1533  * @param o view object to clear back forward list
1534  */
1535 EAPI void ewk_view_back_forward_list_clear(const Evas_Object *o);
1536
1537 /// Enum values containing Content Security Policy header types.
1538 enum _Ewk_CSP_Header_Type {
1539     EWK_REPORT_ONLY,
1540     EWK_ENFORCE_POLICY
1541 };
1542 typedef enum _Ewk_CSP_Header_Type Ewk_CSP_Header_Type;
1543
1544 /*
1545  * Set received Content Security Policy data from web app
1546  *
1547  * @param o view object
1548  * @param policy Content Security Policy data
1549  * @param type Content Security Policy header type
1550  *
1551  */
1552 EAPI void ewk_view_content_security_policy_set(Evas_Object* o, const char* policy, Ewk_CSP_Header_Type type);
1553
1554 /*
1555  * Starts offline page save.
1556  *
1557  * @param o view object to start offline page save
1558  * @param path directory path to save offline page
1559  *
1560  * @return @c EINA_TRUE on success, @c EINA_FALSE on errors
1561  */
1562 EAPI Eina_Bool ewk_view_page_save(Evas_Object* o, const char* path);
1563
1564 #ifdef __cplusplus
1565 }
1566 #endif
1567 #endif // ewk_view_h