2 Copyright (C) 2011 Samsung Electronics
3 Copyright (C) 2012 Intel Corporation. All rights reserved.
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.
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.
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.
23 * @brief WebKit main smart object.
25 * This object provides view related APIs of WebKit2 to EFL object.
27 * The following signals (see evas_object_smart_callback_add()) are emitted:
29 * - "back,forward,list,changed", void: reports that the view's back / forward list had changed.
30 * - "close,window", void: window is closed.
31 * - "create,window", Evas_Object**: a new window is created.
32 * - "download,cancelled", Ewk_Download_Job*: reports that a download was effectively cancelled.
33 * - "download,failed", Ewk_Download_Job_Error*: reports that a download failed with the given error.
34 * - "download,finished", Ewk_Download_Job*: reports that a download completed successfully.
35 * - "download,request", Ewk_Download_Job*: reports that a new download has been requested. The client should set the
36 * destination path by calling ewk_download_job_destination_set() or the download will fail.
37 * - "form,submission,request", Ewk_Form_Submission_Request*: Reports that a form request is about to be submitted.
38 * The Ewk_Form_Submission_Request passed contains information about the text fields of the form. This
39 * is typically used to store login information that can be used later to pre-fill the form.
40 * The form will not be submitted until ewk_form_submission_request_submit() is called.
41 * It is possible to handle the form submission request asynchronously, by simply calling
42 * ewk_form_submission_request_ref() on the request and calling ewk_form_submission_request_submit()
43 * when done to continue with the form submission. If the last reference is removed on a
44 * #Ewk_Form_Submission_Request and the form has not been submitted yet,
45 * ewk_form_submission_request_submit() will be called automatically.
46 * - "icon,changed", void: reports that the view's favicon has changed.
47 * - "intent,request,new", Ewk_Intent*: reports new Web intent request.
48 * - "intent,service,register", Ewk_Intent_Service*: reports new Web intent service registration.
49 * - "load,error", const Ewk_Error*: reports main frame load failed.
50 * - "load,finished", void: reports load finished.
51 * - "load,progress", double*: load progress has changed (value from 0.0 to 1.0).
52 * - "load,provisional,failed", const Ewk_Error*: view provisional load failed.
53 * - "load,provisional,redirect", void: view received redirect for provisional load.
54 * - "load,provisional,started", void: view started provisional load.
55 * - "pageSave,success", void: page save operation was success.
56 * - "pageSave,error", void: page save operation has failed.
57 * - "policy,decision,navigation", Ewk_Navigation_Policy_Decision*: a navigation policy decision should be taken.
58 * To make a policy decision asynchronously, simply increment the reference count of the
59 * #Ewk_Navigation_Policy_Decision object using ewk_navigation_policy_decision_ref().
60 * - "policy,decision,new,window", Ewk_Navigation_Policy_Decision*: a new window policy decision should be taken.
61 * To make a policy decision asynchronously, simply increment the reference count of the
62 * #Ewk_Navigation_Policy_Decision object using ewk_navigation_policy_decision_ref().
63 * - "resource,request,failed", const Ewk_Resource_Load_Error*: a resource failed loading.
64 * - "resource,request,finished", const Ewk_Resource*: a resource finished loading.
65 * - "resource,request,new", const Ewk_Resource_Request*: a resource request was initiated.
66 * - "resource,request,response", Ewk_Resource_Load_Response*: a response to a resource request was received.
67 * - "resource,request,sent", const Ewk_Resource_Request*: a resource request was sent.
68 * - "text,found", unsigned int*: the requested text was found and it gives the number of matches.
69 * - "title,changed", const char*: title of the main frame was changed.
70 * - "tooltip,text,set", const char*: tooltip was set.
71 * - "tooltip,text,unset", void: tooltip was unset.
72 * - "url,changed", const char*: url of the main frame was changed.
73 * - "webprocess,crashed", Eina_Bool*: expects a @c EINA_TRUE if web process crash is handled; @c EINA_FALSE, otherwise.
76 * Tizen specific signals
77 * - "magnifier,show", void: magifier of text selection was showed.
78 * - "magnifier,hide", void: magifier of text selection was hidden.
84 #include "ewk_back_forward_list.h"
85 #include "ewk_context.h"
86 #include "ewk_download_job.h"
87 #include "ewk_error.h"
88 #include "ewk_intent.h"
89 #include "ewk_resource.h"
90 #include "ewk_settings.h"
91 #include "ewk_touch.h"
92 #include "ewk_url_request.h"
93 #include "ewk_url_response.h"
97 #include "ewk_frame.h"
100 #include "ewk_history.h"
102 //#if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
103 #include "ewk_hit_test.h"
106 //#if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
107 #include "ewk_enums.h"
110 // #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
111 #include "ewk_web_application_icon_data.h"
118 /// Enum values containing text directionality values.
120 EWK_TEXT_DIRECTION_RIGHT_TO_LEFT,
121 EWK_TEXT_DIRECTION_LEFT_TO_RIGHT
122 } Ewk_Text_Direction;
124 typedef struct Ewk_View_Smart_Data Ewk_View_Smart_Data;
125 typedef struct Ewk_View_Smart_Class Ewk_View_Smart_Class;
128 /// Creates a type name for _Ewk_Event_Gesture.
129 typedef struct Ewk_Event_Gesture Ewk_Event_Gesture;
131 /// Represents a gesture event.
132 struct Ewk_Event_Gesture {
133 Ewk_Gesture_Type type; /**< type of the gesture event */
134 Evas_Coord_Point position; /**< position of the gesture event */
135 Evas_Point velocity; /**< velocity of the gesture event. The unit is pixel per second. */
136 double scale; /**< scale of the gesture event */
137 int count; /**< count of the gesture */
138 unsigned int timestamp; /**< timestamp of the gesture */
141 // #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
143 * \enum Ewk_Input_Type
144 * @brief Provides type of focused input element
146 enum Ewk_Input_Type {
148 EWK_INPUT_TYPE_TELEPHONE,
149 EWK_INPUT_TYPE_NUMBER,
150 EWK_INPUT_TYPE_EMAIL,
152 EWK_INPUT_TYPE_PASSWORD,
153 EWK_INPUT_TYPE_COLOR,
155 EWK_INPUT_TYPE_DATETIME,
156 EWK_INPUT_TYPE_DATETIMELOCAL,
157 EWK_INPUT_TYPE_MONTH,
161 typedef enum Ewk_Input_Type Ewk_Input_Type;
162 // #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
163 // #endif // #if OS(TIZEN)
165 /// Ewk view's class, to be overridden by sub-classes.
166 struct Ewk_View_Smart_Class {
167 Evas_Smart_Class sc; /**< all but 'data' is free to be changed. */
168 unsigned long version;
170 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);
171 //#if ENABLE(TIZEN_MULTIPLE_SELECT)
172 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);
174 Eina_Bool (*popup_menu_hide)(Ewk_View_Smart_Data *sd);
175 Eina_Bool (*popup_menu_update)(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, Eina_List* items, int selected_index);
177 // #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
178 Eina_Bool (*text_selection_down)(Ewk_View_Smart_Data *sd, int x, int y);
179 Eina_Bool (*text_selection_move)(Ewk_View_Smart_Data *sd, int x, int y);
180 Eina_Bool (*text_selection_up)(Ewk_View_Smart_Data *sd, int x, int y);
183 //#if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
184 Eina_Bool (*input_picker_show)(Ewk_View_Smart_Data *sd, Ewk_Input_Type inputType, const char* inputValue);
187 //#if ENABLE(TIZEN_DATALIST_ELEMENT)
188 Eina_Bool (*data_list_show)(Ewk_View_Smart_Data *sd, Ewk_Input_Type inputType, Eina_List *optionList);
189 Eina_Bool (*data_list_hide)(Ewk_View_Smart_Data *sd, Ewk_Input_Type inputType);
192 // #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
193 Eina_Bool (*orientation_lock)(Ewk_View_Smart_Data *sd, int orientations);
194 void (*orientation_unlock)(Ewk_View_Smart_Data *sd);
198 // - returns true if handled
199 // - if overridden, have to call parent method if desired
200 Eina_Bool (*focus_in)(Ewk_View_Smart_Data *sd);
201 Eina_Bool (*focus_out)(Ewk_View_Smart_Data *sd);
202 Eina_Bool (*fullscreen_enter)(Ewk_View_Smart_Data *sd);
203 Eina_Bool (*fullscreen_exit)(Ewk_View_Smart_Data *sd);
204 Eina_Bool (*mouse_wheel)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Wheel *ev);
205 Eina_Bool (*mouse_down)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Down *ev);
206 Eina_Bool (*mouse_up)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Up *ev);
207 Eina_Bool (*mouse_move)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Move *ev);
208 Eina_Bool (*key_down)(Ewk_View_Smart_Data *sd, const Evas_Event_Key_Down *ev);
209 Eina_Bool (*key_up)(Ewk_View_Smart_Data *sd, const Evas_Event_Key_Up *ev);
212 // - All strings should be guaranteed to be stringshared.
213 void (*run_javascript_alert)(Ewk_View_Smart_Data *sd, const char *message);
214 Eina_Bool (*run_javascript_confirm)(Ewk_View_Smart_Data *sd, const char *message);
215 const char *(*run_javascript_prompt)(Ewk_View_Smart_Data *sd, const char *message, const char *default_value); /**< return string should be stringshared. */
218 // - Shows and hides color picker.
219 Eina_Bool (*input_picker_color_request)(Ewk_View_Smart_Data *sd, int r, int g, int b, int a);
220 Eina_Bool (*input_picker_color_dismiss)(Ewk_View_Smart_Data *sd);
224 unsigned long long (*exceeded_database_quota)(Ewk_View_Smart_Data *sd, const char *databaseName, const char *displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage);
226 // #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
227 Eina_Bool (*formdata_candidate_show)(Ewk_View_Smart_Data *sd, int x, int y, int w, int h);
228 Eina_Bool (*formdata_candidate_hide)(Ewk_View_Smart_Data *sd);
229 Eina_Bool (*formdata_candidate_update_data)(Ewk_View_Smart_Data *sd, Eina_List *dataList);
230 Eina_Bool (*formdata_candidate_is_showing)(Ewk_View_Smart_Data *sd);
234 Eina_Bool (*gesture_start)(Ewk_View_Smart_Data *sd, const Ewk_Event_Gesture *ev);
235 Eina_Bool (*gesture_end)(Ewk_View_Smart_Data *sd, const Ewk_Event_Gesture *ev);
236 Eina_Bool (*gesture_move)(Ewk_View_Smart_Data *sd, const Ewk_Event_Gesture *ev);
239 //#if ENABLE(TIZEN_SCREEN_READER)
240 Eina_Bool (*screen_reader_command_execute)(Ewk_View_Smart_Data *sd, unsigned int command, int data1, int data2);
246 * Callback for ewk_view_web_app_capable_get
248 * @param capable web application capable
249 * @param user_data user_data will be passsed when ewk_view_web_app_capable_get is called
251 typedef void (*Ewk_Web_App_Capable_Get_Callback)(Eina_Bool capable, void* user_data);
254 * Callback for ewk_view_web_app_icon_get
256 * @param icon_url web application icon
257 * @param user_data user_data will be passsed when ewk_view_web_app_icon_get is called
259 typedef void (*Ewk_Web_App_Icon_URL_Get_Callback)(const char* icon_url, void* user_data);
262 * Callback for ewk_view_web_app_icon_urls_get.
264 * @param icon_urls list of Ewk_Web_App_Icon_Data for web app
265 * @param user_data user_data will be passsed when ewk_view_web_app_icon_urls_get is called
267 typedef void (*Ewk_Web_App_Icon_URLs_Get_Callback)(Eina_List *icon_urls, void *user_data);
271 * The version you have to put into the version field
272 * in the @a Ewk_View_Smart_Class structure.
274 #define EWK_VIEW_SMART_CLASS_VERSION 6UL
277 * Initializer for whole Ewk_View_Smart_Class structure.
279 * @param smart_class_init initializer to use for the "base" field
280 * (Evas_Smart_Class).
282 * @see EWK_VIEW_SMART_CLASS_INIT_NULL
283 * @see EWK_VIEW_SMART_CLASS_INIT_VERSION
284 * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION
286 #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, 0, 0, 0, 0, 0, 0, 0}
289 * Initializer to zero a whole Ewk_View_Smart_Class structure.
291 * @see EWK_VIEW_SMART_CLASS_INIT_VERSION
292 * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION
293 * @see EWK_VIEW_SMART_CLASS_INIT
295 #define EWK_VIEW_SMART_CLASS_INIT_NULL EWK_VIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
298 * Initializer to zero a whole Ewk_View_Smart_Class structure and set
301 * Similar to EWK_VIEW_SMART_CLASS_INIT_NULL, but will set version field of
302 * Evas_Smart_Class (base field) to latest EVAS_SMART_CLASS_VERSION and name
303 * to the specific value.
305 * It will keep a reference to name field as a "const char *", that is,
306 * name must be available while the structure is used (hint: static or global!)
307 * and will not be modified.
309 * @see EWK_VIEW_SMART_CLASS_INIT_NULL
310 * @see EWK_VIEW_SMART_CLASS_INIT_VERSION
311 * @see EWK_VIEW_SMART_CLASS_INIT
313 #define EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION(name) EWK_VIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NAME_VERSION(name))
315 typedef struct EwkViewImpl EwkViewImpl;
317 * @brief Contains an internal View data.
319 * It is to be considered private by users, but may be extended or
320 * changed by sub-classes (that's why it's in public header file).
322 struct Ewk_View_Smart_Data {
323 Evas_Object_Smart_Clipped_Data base;
324 const Ewk_View_Smart_Class* api; /**< reference to casted class instance */
325 Evas_Object* self; /**< reference to owner object */
326 Evas_Object* image; /**< reference to evas_object_image for drawing web contents */
327 EwkViewImpl* priv; /**< should never be accessed, c++ stuff */
329 Evas_Coord x, y, w, h; /**< last used viewport */
331 struct { /**< what changed since last smart_calculate */
334 Eina_Bool position:1;
338 /// Creates a type name for Ewk_Resource_Request.
339 typedef struct Ewk_Resource_Request Ewk_Resource_Request;
342 * @brief Structure containing details about a resource request.
344 struct Ewk_Resource_Request {
345 Ewk_Resource *resource; /**< resource being requested */
346 Ewk_Url_Request *request; /**< URL request for the resource */
347 Ewk_Url_Response *redirect_response; /**< Possible redirect response for the resource or @c NULL */
350 /// Creates a type name for Ewk_Resource_Load_Response.
351 typedef struct Ewk_Resource_Load_Response Ewk_Resource_Load_Response;
354 * @brief Structure containing details about a response to a resource request.
356 struct Ewk_Resource_Load_Response {
357 Ewk_Resource *resource; /**< resource requested */
358 Ewk_Url_Response *response; /**< resource load response */
361 /// Creates a type name for Ewk_Resource_Load_Error.
362 typedef struct Ewk_Resource_Load_Error Ewk_Resource_Load_Error;
365 * @brief Structure containing details about a resource load error.
367 * Details given about a resource load failure.
369 struct Ewk_Resource_Load_Error {
370 Ewk_Resource *resource; /**< resource that failed loading */
371 Ewk_Error *error; /**< load error */
374 /// Creates a type name for Ewk_Download_Job_Error.
375 typedef struct Ewk_Download_Job_Error Ewk_Download_Job_Error;
378 * @brief Structure containing details about a download failure.
380 struct Ewk_Download_Job_Error {
381 Ewk_Download_Job *download_job; /**< download that failed */
382 Ewk_Error *error; /**< download error */
385 /// Enum values containing page contents type values.
387 EWK_PAGE_CONTENTS_TYPE_MHTML,
388 EWK_PAGE_CONTENTS_TYPE_STRING
389 } Ewk_Page_Contents_Type;
392 * Creates a type name for the callback function used to get the page contents.
394 * @param type type of the contents
395 * @param data string buffer of the contents
397 typedef void (*Ewk_Page_Contents_Cb)(Ewk_Page_Contents_Type type, const char *data);
399 /// Creates a type name for Ewk_Page_Contents_Context.
400 typedef struct Ewk_Page_Contents_Context Ewk_Page_Contents_Context;
403 * @brief Structure containing page contents context used for ewk_view_page_contents_get() API.
405 struct Ewk_Page_Contents_Context {
406 Ewk_Page_Contents_Type type;
407 Ewk_Page_Contents_Cb callback;
411 * Sets the smart class APIs, enabling view to be inherited.
413 * @param api class definition to set, all members with the
414 * exception of @a Evas_Smart_Class->data may be overridden, must
417 * @note @a Evas_Smart_Class->data is used to implement type checking and
418 * is not supposed to be changed/overridden. If you need extra
419 * data for your smart class to work, just extend
420 * Ewk_View_Smart_Class instead.
421 * The Evas_Object which inherits the ewk_view should use
422 * ewk_view_smart_add() to create Evas_Object instead of
423 * evas_object_smart_add() because it performs additional initialization
426 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure (probably
429 * @see ewk_view_smart_add()
431 EAPI Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class *api);
434 * Creates a new EFL WebKit view object with Evas_Smart and Ewk_Context.
436 * @note The Evas_Object which inherits the ewk_view should create its
437 * Evas_Object using this API instead of evas_object_smart_add()
438 * because the default initialization for ewk_view is done in this API.
440 * @param e canvas object where to create the view object
441 * @param smart Evas_Smart object. Its type should be EWK_VIEW_TYPE_STR
442 * @param context Ewk_Context object which is used for initializing
444 * @return view object on success or @c NULL on failure
446 EAPI Evas_Object *ewk_view_smart_add(Evas *e, Evas_Smart *smart, Ewk_Context *context);
449 * Enum values used to specify search options.
450 * @brief Provides option to find text
451 * @info Keep this in sync with WKFindOptions.h
453 enum Ewk_Find_Options {
454 EWK_FIND_OPTIONS_NONE, /**< no search flags, this means a case sensitive, no wrap, forward only search. */
455 EWK_FIND_OPTIONS_CASE_INSENSITIVE = 1 << 0, /**< case insensitive search. */
456 EWK_FIND_OPTIONS_AT_WORD_STARTS = 1 << 1, /**< search text only at the beginning of the words. */
457 EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START = 1 << 2, /**< treat capital letters in the middle of words as word start. */
458 EWK_FIND_OPTIONS_BACKWARDS = 1 << 3, /**< search backwards. */
459 EWK_FIND_OPTIONS_WRAP_AROUND = 1 << 4, /**< if not present search will stop at the end of the document. */
460 EWK_FIND_OPTIONS_SHOW_OVERLAY = 1 << 5, /**< show overlay */
461 EWK_FIND_OPTIONS_SHOW_FIND_INDICATOR = 1 << 6, /**< show indicator */
462 EWK_FIND_OPTIONS_SHOW_HIGHLIGHT = 1 << 7 /**< show highlight */
464 typedef enum Ewk_Find_Options Ewk_Find_Options;
467 * Creates a new EFL WebKit view object.
469 * @param e canvas object where to create the view object
471 * @return view object on success or @c NULL on failure
473 EAPI Evas_Object *ewk_view_add(Evas *e);
476 * Creates a new EFL WebKit view object based on specific Ewk_Context.
478 * @param e canvas object where to create the view object
479 * @param context Ewk_Context object to declare process model
481 * @return view object on success or @c NULL on failure
483 EAPI Evas_Object *ewk_view_add_with_context(Evas *e, Ewk_Context *context);
486 * Gets the Ewk_Context of this view.
488 * @param o the view object to get the Ewk_Context
490 * @return the Ewk_Context of this view or @c NULL on failure
492 EAPI Ewk_Context *ewk_view_context_get(const Evas_Object *o);
495 * Asks the object to load the given URL.
497 * @param o view object to load @a URL
498 * @param url uniform resource identifier to load
500 * @return @c EINA_TRUE is returned if @a o is valid, irrespective of load,
501 * or @c EINA_FALSE on failure
503 EAPI Eina_Bool ewk_view_url_set(Evas_Object *o, const char *url);
506 * Returns the current URL string of view object.
508 * It returns an internal string and should not
509 * be modified. The string is guaranteed to be stringshared.
511 * @param o view object to get current URL
513 * @return current URL on success or @c NULL on failure
515 EAPI const char *ewk_view_url_get(const Evas_Object *o);
518 * Returns the current icon URL of view object.
520 * It returns an internal string and should not
521 * be modified. The string is guaranteed to be stringshared.
523 * @param o view object to get current icon URL
525 * @return current icon URL on success or @c NULL if unavailable or on failure
527 EAPI const char *ewk_view_icon_url_get(const Evas_Object *o);
530 * Asks the main frame to reload the current document.
532 * @param o view object to reload current document
534 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
536 * @see ewk_view_reload_bypass_cache()
538 EAPI Eina_Bool ewk_view_reload(Evas_Object *o);
541 * Reloads the current page's document without cache.
543 * @param o view object to reload current document
545 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
547 EAPI Eina_Bool ewk_view_reload_bypass_cache(Evas_Object *o);
550 * Asks the main frame to stop loading.
552 * @param o view object to stop loading
554 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise.
556 EAPI Eina_Bool ewk_view_stop(Evas_Object* o);
559 * Gets the Ewk_Settings of this view.
561 * @param o view object to get Ewk_Settings
563 * @return the Ewk_Settings of this view or @c NULL on failure
565 EAPI Ewk_Settings *ewk_view_settings_get(const Evas_Object *o);
569 enum Ewk_Page_Visibility_State {
570 EWK_PAGE_VISIBILITY_STATE_VISIBLE,
571 EWK_PAGE_VISIBILITY_STATE_HIDDEN,
572 EWK_PAGE_VISIBILITY_STATE_PRERENDER
574 typedef enum Ewk_Page_Visibility_State Ewk_Page_Visibility_State;
576 enum Ewk_Http_Method {
578 EWK_HTTP_METHOD_HEAD,
579 EWK_HTTP_METHOD_POST,
581 EWK_HTTP_METHOD_DELETE,
583 typedef enum Ewk_Http_Method Ewk_Http_Method;
586 * Callback for ewk_view_script_execute
588 * @param o the view object
589 * @param result_value value returned by script
590 * @param user_data user data
592 typedef void (*Ewk_View_Script_Execute_Callback)(Evas_Object* o, const char* result_value, void* user_data);
595 * Callback for ewk_view_plain_text_get
597 * @param o the view object
598 * @param plain_text the contents of the given frame converted to plain text
599 * @param user_data user data
601 typedef void (*Ewk_View_Plain_Text_Get_Callback)(Evas_Object* o, const char* plain_text, void* user_data);
603 // #if ENABLE(TIZEN_SUPPORT_MHTML)
605 * Creates a type name for the callback function used to get the page contents.
607 * @param o view object
608 * @param data mhtml data of the page contents
609 * @param user_data user data will be passed when ewk_view_mhtml_data_get is called
611 typedef void (*Ewk_View_MHTML_Data_Get_Callback)(Evas_Object *o, const char *data, void *user_data);
612 // #endif // ENABLE(TIZEN_SUPPORT_MHTML)
615 * Gets the Ewk_Context of this view.
617 * @param o the view object to get the WKPageRef
619 * @return the Ewk_Context of this view
621 EAPI Ewk_Context* ewk_view_context_get(const Evas_Object* o);
624 * Gets the reference object for frame that represents the main frame.
626 * @param o view object to get main frame
628 * @return frame reference of frame object on success, or NULL on failure
630 EAPI Ewk_Frame_Ref ewk_view_main_frame_get(Evas_Object* o);
633 * Gets the reference obect for the currently focused frame.
635 * @param o view object to get main frame
637 * @return frame reference of frame object on success, or NULL on failure
639 EAPI Ewk_Frame_Ref ewk_view_focused_frame_get(Evas_Object* o);
641 EAPI Eina_Bool ewk_view_horizontal_panning_hold_get(Evas_Object* o);
642 EAPI void ewk_view_horizontal_panning_hold_set(Evas_Object* o, Eina_Bool hold);
643 EAPI Eina_Bool ewk_view_vertical_panning_hold_get(Evas_Object* o);
644 EAPI void ewk_view_vertical_panning_hold_set(Evas_Object* o, Eina_Bool hold);
647 * Gets the minimum and maximum value of the scale range or -1 on failure
649 * @param o view object to get the minimum and maximum value of the scale range
650 * @param min_scale Pointer to an double in which to store the minimum scale factor of the object.
651 * @param max_scale Pointer to an double in which to store the maximum scale factor of the object.
653 * @note Use @c NULL pointers on the scale components you're not
654 * interested in: they'll be ignored by the function.
656 EAPI void ewk_view_scale_range_get(Evas_Object* o, double* min_scale, double* max_scale);
659 * Gets the current text zoom level.
661 * @param o view object to get the zoom level
663 * @return current zoom level in use on success or @c -1.0 on failure
665 EAPI double ewk_view_text_zoom_get(const Evas_Object* o);
668 * Sets the current text zoom level.
670 * @param o view object to set the zoom level
671 * @param textZoomFactor a new level to set
673 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
675 EAPI Eina_Bool ewk_view_text_zoom_set(Evas_Object* o, double text_zoom_factor);
677 EAPI void ewk_view_suspend(Evas_Object* o);
678 EAPI void ewk_view_resume(Evas_Object* o);
680 typedef Eina_Bool (*Ewk_View_JavaScript_Alert_Callback)(Evas_Object* o, const char* alert_text, void* user_data);
681 EAPI void ewk_view_javascript_alert_callback_set(Evas_Object* o, Ewk_View_JavaScript_Alert_Callback callback, void* user_data);
682 EAPI void ewk_view_javascript_alert_reply(Evas_Object* o);
684 typedef Eina_Bool (*Ewk_View_JavaScript_Confirm_Callback)(Evas_Object* o, const char* message, void* user_data);
685 EAPI void ewk_view_javascript_confirm_callback_set(Evas_Object* o, Ewk_View_JavaScript_Confirm_Callback callback, void* user_data);
686 EAPI void ewk_view_javascript_confirm_reply(Evas_Object* o, Eina_Bool result);
688 typedef Eina_Bool (*Ewk_View_JavaScript_Prompt_Callback)(Evas_Object* o, const char* message, const char* default_value, void* user_data);
689 EAPI void ewk_view_javascript_prompt_callback_set(Evas_Object* o, Ewk_View_JavaScript_Prompt_Callback callback, void* user_data);
690 EAPI void ewk_view_javascript_prompt_reply(Evas_Object* o, const char* result);
692 //#if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
693 typedef Eina_Bool (*Ewk_View_Before_Unload_Confirm_Panel_Callback)(Evas_Object* o, const char* message, void* user_data);
694 EAPI void ewk_view_before_unload_confirm_panel_callback_set(Evas_Object* o, Ewk_View_Before_Unload_Confirm_Panel_Callback callback, void* user_data);
695 EAPI void ewk_view_before_unload_confirm_panel_reply(Evas_Object* o, Eina_Bool result);
698 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);
699 EAPI void ewk_view_open_panel_callback_set(Evas_Object* o, Ewk_View_Open_Panel_Callback callback, void* user_data);
700 EAPI void ewk_view_open_panel_reply(Evas_Object* o, Eina_List* file_url, Eina_Bool result);
702 //#if ENABLE(TIZEN_APPLICATION_CACHE)
703 typedef Eina_Bool (*Ewk_View_Applicacion_Cache_Permission_Callback)(Evas_Object* o, Ewk_Security_Origin* origin, void* user_data);
704 EAPI void ewk_view_application_cache_permission_callback_set(Evas_Object* o, Ewk_View_Applicacion_Cache_Permission_Callback callback, void* user_data);
705 EAPI void ewk_view_application_cache_permission_reply(Evas_Object* o, Eina_Bool allow);
708 //#if ENABLE(TIZEN_INDEXED_DATABASE)
709 typedef Eina_Bool (*Ewk_View_Exceeded_Indexed_Database_Quota_Callback)(Evas_Object* o, Ewk_Security_Origin* origin, long long currentQuota, void* user_data);
710 EAPI void ewk_view_exceeded_indexed_database_quota_callback_set(Evas_Object* o, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, void* user_data);
711 EAPI void ewk_view_exceeded_indexed_database_quota_reply(Evas_Object* o, Eina_Bool allow);
715 * Gets the Ewk_Settings of this view.
717 * @param o view object to get Ewk_Settings
719 * @return the Ewk_Settings of this view or @c NULL on failure
721 EAPI Ewk_Settings *ewk_view_settings_get(const Evas_Object *o);
724 * Delivers a Web intent to the view's main frame.
726 * @param o view object to deliver the intent to
728 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise.
730 EAPI Eina_Bool ewk_view_intent_deliver(Evas_Object *o, Ewk_Intent *intent);
733 * Asks the main frame to navigate back in the history.
735 * @param o view object to navigate back
737 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
739 * @see ewk_frame_back()
741 EAPI Eina_Bool ewk_view_back(Evas_Object *o);
744 * Asks the main frame to navigate forward in the history.
746 * @param o view object to navigate forward
748 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
750 * @see ewk_frame_forward()
752 EAPI Eina_Bool ewk_view_forward(Evas_Object *o);
755 * Queries if it is possible to navigate backwards one item in the history.
757 * @param o view object to query if backward navigation is possible
759 * @return @c EINA_TRUE if it is possible to navigate backwards in the history, @c EINA_FALSE otherwise
761 EAPI Eina_Bool ewk_view_back_possible(Evas_Object *o);
764 * Queries if it is possible to navigate forwards one item in the history.
766 * @param o view object to query if forward navigation is possible
768 * @return @c EINA_TRUE if it is possible to navigate forwards in the history, @c EINA_FALSE otherwise
770 EAPI Eina_Bool ewk_view_forward_possible(Evas_Object *o);
773 * Gets the back-forward list associated with this view.
775 * The returned instance is unique for this view and thus multiple calls
776 * to this function with the same view as parameter returns the same
777 * handle. This handle is alive while view is alive, thus one
778 * might want to listen for EVAS_CALLBACK_DEL on given view
779 * (@a o) to know when to stop using returned handle.
781 * @param o view object to get navigation back-forward list
783 * @return the back-forward list instance handle associated with this view
785 EAPI Ewk_Back_Forward_List *ewk_view_back_forward_list_get(const Evas_Object *o);
788 * Gets the current title of the main frame.
790 * It returns an internal string and should not
791 * be modified. The string is guaranteed to be stringshared.
793 * @param o view object to get current title
795 * @return current title on success or @c NULL on failure
797 EAPI const char *ewk_view_title_get(const Evas_Object *o);
800 * Gets the current load progress of page.
802 * The progress estimation from 0.0 to 1.0.
804 * @param o view object to get the current progress
806 * @return the load progress of page, value from 0.0 to 1.0,
807 * or @c -1.0 on failure
809 EAPI double ewk_view_load_progress_get(const Evas_Object *o);
812 * Requests loading of the given request data.
814 * @param o view object to load
815 * @param url uniform resource identifier to load
816 * @param method http method
817 * @param headers http headers
818 * @param body http body data
820 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
822 EAPI Eina_Bool ewk_view_url_request_set(Evas_Object* o, const char* url, Ewk_Http_Method method, Eina_Hash* headers, const char* body);
825 * Requests the specified plain text string into the view object
827 * @note The mime type of document will be "text/plain".
829 * @return the load progress of page, value from 0.0 to 1.0,
830 * or @c -1.0 on failure
832 EAPI Eina_Bool ewk_view_plain_text_set(Evas_Object* o, const char* plain_text);
835 * Requests loading the given contents by mime type into the view object.
837 * @param o view object to load
838 * @param contents what to load
839 * @param contents_size size of @a contents (in bytes),
840 * @param mime_type type of @a contents data, if @c 0 is given "text/html" is assumed
841 * @param encoding encoding for @a contents data, if @c 0 is given "UTF-8" is assumed
842 * @param base_uri base uri to use for relative resources, may be @c 0,
843 * if provided @b must be an absolute uri
845 * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors
847 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);
850 * Requests loading the given contents.
852 * @param o view object to load document
853 * @param html what to load
854 * @param base_uri base uri to use for relative resources, may be @c 0,
855 * if provided @b must be an absolute uri
857 * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors
859 EAPI Eina_Bool ewk_view_html_contents_set(Evas_Object* o, const char* html, const char* base_uri);
862 * Requests for setting page visibility state.
864 * @param o view object to set the page visibility
865 * @param page_visibility_state visible state of the page to set
866 * @param initial_state @c EINA_TRUE if this function is called at page initialization time,
867 * @c EINA_FALSE otherwise
869 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
871 EAPI Eina_Bool ewk_view_page_visibility_state_set(Evas_Object* o, Ewk_Page_Visibility_State page_visibility_state, Eina_Bool initial_state);
874 * Request to set the user agent string.
876 * @param o view object to set the user agent string
878 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
880 EAPI Eina_Bool ewk_view_user_agent_set(Evas_Object* o, const char* user_agent);
883 * Returns user agent string.
885 * @param o view object to get the user agent string
887 * @return @c user agent string
889 EAPI const char* ewk_view_user_agent_get(const Evas_Object* o);
890 //#if ENABLE(TIZEN_CUSTOM_HEADERS)
894 * @param o view object to add custom header
896 * @param name custom header name to add the custom header
898 * @param value custom header value to add the custom header
900 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
902 EAPI Eina_Bool ewk_view_custom_header_add(const Evas_Object* o, const char* name, const char* value);
904 * remove custom header
906 * @param o view object to remove custom header
908 * @param name custom header name to remove the custom header
910 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
912 EAPI Eina_Bool ewk_view_custom_header_remove(const Evas_Object* o, const char* name);
914 * clears all custom headers
916 * @param o view object to clear custom headers
918 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
920 EAPI Eina_Bool ewk_view_custom_header_clear(const Evas_Object* o);
923 //#if ENABLE(TIZEN_WEBKIT2_VIEW_VISIBILITY)
925 * Request to set the current page's visibility.
927 * @param o view object to set the visibility.
928 * @param enable EINA_TRUE to set on the visibility of the page, EINA_FALSE otherwise.
930 * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors
932 EAPI Eina_Bool ewk_view_visibility_set(Evas_Object* o, Eina_Bool enable);
936 * Returns the evas image object of the specified viewArea of page
938 * The returned evas image object @b should be freed after use.
940 * @param o view object to get specified rectangle of cairo surface.
941 * @param viewArea rectangle of cairo surface.
942 * @param scaleFactor scale factor of cairo surface.
943 * @param canvas canvas for creating evas image.
945 * @return newly allocated evas image object on sucess or @c 0 on failure.
947 EAPI Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* o, Eina_Rectangle viewArea, float scaleFactor, Evas* canvas);
949 // #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
951 * Start a server for inspecting web pages
952 * This server will be used by Remote Web Browser to transfer messages over network
954 * @param [o] view object to debug
955 * @param [in] port It is a port number for the server. A free port on system will be allocated if port is 0
957 * @return @c assigned port number on success or @c 0 on failure
959 EAPI unsigned int ewk_view_inspector_server_start(Evas_Object* o, unsigned int port);
962 * Stop a server for inspecting web pages
964 * @param [o] view object to debug
966 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
968 EAPI Eina_Bool ewk_view_inspector_server_stop(Evas_Object* o);
972 * Scrolls webpage of view by dx and dy.
974 * @param o view object to scroll
975 * @param dx horizontal offset to scroll
976 * @param dy vertical offset to scroll
978 EAPI void ewk_view_scroll_by(Evas_Object* o, int dx, int dy);
981 * Gets the current scroll position of given view.
983 * @param o view object to get the current scroll position
984 * @param x the pointer to store the horizontal position, may be @c 0
985 * @param y the pointer to store the vertical position, may be @c 0
987 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise and
990 EAPI Eina_Bool ewk_view_scroll_pos_get(Evas_Object* o, int* x, int* y);
993 * Sets an absolute scroll of the given view.
995 * Both values are from zero to the contents size minus the viewport
998 * @param o view object to scroll
999 * @param x horizontal position to scroll
1000 * @param y vertical position to scroll
1002 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
1004 EAPI Eina_Bool ewk_view_scroll_set(Evas_Object* o, int x, int y);
1007 * Gets the possible scroll size of the given view.
1009 * Possible scroll size is contents size minus the viewport size.
1011 * @param o view object to get scroll size
1012 * @param w the pointer to store the horizontal size that is possible to scroll,
1014 * @param h the pointer to store the vertical size that is possible to scroll,
1017 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise and
1020 EAPI Eina_Bool ewk_view_scroll_size_get(const Evas_Object* o, int* w, int* h);
1023 * Requests for getting web application capable.
1025 * @param callback result callback to get web database quota
1026 * @param user_data user_data will be passed when result_callback is called
1027 * -I.e., user data will be kept until callback is called
1029 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
1031 EAPI Eina_Bool ewk_view_web_application_capable_get(Evas_Object* o, Ewk_Web_App_Capable_Get_Callback callback, void* user_data);
1034 * Requests for getting web application icon string.
1036 * @param callback result callback to get web database quota
1037 * @param user_data user_data will be passed when result_callback is called
1038 * -I.e., user data will be kept until callback is called
1040 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
1042 EAPI Eina_Bool ewk_view_web_application_icon_url_get(Evas_Object* o, Ewk_Web_App_Icon_URL_Get_Callback callback, void* user_data);
1045 * Requests for getting web application icon list of Ewk_Web_App_Icon_Data.
1047 * @param callback result callback to get web application icon urls
1048 * @param user_data user_data will be passed when result_callback is called
1049 * -I.e., user data will be kept until callback is called
1051 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
1053 EAPI Eina_Bool ewk_view_web_application_icon_urls_get(Evas_Object *o, Ewk_Web_App_Icon_URLs_Get_Callback callback, void *user_data);
1056 * Executes editor command.
1058 * @param o view object to execute command
1059 * @param command editor command to execute
1060 * @param value the value to be passed into command
1062 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
1064 EAPI Eina_Bool ewk_view_command_execute(Evas_Object* o, const char* command, const char* value);
1067 * Gets last known contents size.
1069 * @param o view object to get contents size
1070 * @param width pointer to store contents size width, may be @c 0
1071 * @param height pointer to store contents size height, may be @c 0
1073 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure and
1074 * @a width and @a height will be zeroed
1076 EAPI Eina_Bool ewk_view_contents_size_get(Evas_Object* o, Evas_Coord* width, Evas_Coord* height);
1079 * Create PDF file of page contents
1081 * @param o view object to get page contents.
1082 * @param width the suface width of PDF file.
1083 * @param height the suface height of PDF file.
1084 * @param fileName the file name for creating PDF file.
1086 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
1088 EAPI Eina_Bool ewk_view_contents_pdf_get_temp(Evas_Object* o, int width, int height, const char* fileName);
1089 EAPI Eina_Bool ewk_view_contents_pdf_get(Evas_Object* o, int width, int height, const char* fileName);
1091 // #if ENABLE(TIZEN_WEB_STORAGE)
1093 * Callback for ewk_view_web_storage_quota_get
1095 * @param quota web storage quota
1096 * @param user_data user_data will be passed when ewk_view_web_storage_quota_get is called
1098 typedef void (*Ewk_Web_Storage_Quota_Get_Callback)(uint32_t quota, void* user_data);
1101 * Requests for getting web storage quota.
1103 * @param o view object to get web storage quota
1104 * @param result_cb callback to get web database origins
1105 * @param user_data user_data will be passed when result_cb is called
1106 * -I.e., user data will be kept until callback is called
1108 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
1110 EAPI Eina_Bool ewk_view_web_storage_quota_get(const Evas_Object* o, Ewk_Web_Storage_Quota_Get_Callback result_callback, void* user_data);
1113 * Requests for setting web storage quota.
1115 * @param o view object to set web storage quota
1116 * @param quota quota to store web storage db.
1118 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
1120 EAPI Eina_Bool ewk_view_web_storage_quota_set(Evas_Object* o, uint32_t quota);
1121 // #endif // #if ENABLE(TIZEN_WEB_STORAGE)
1124 * Requests execution of the given script.
1126 * @note This allows to use NULL for the callback parameter.
1127 * So, if the result data from the script is not required, NULL might be used for the callback parameter.
1129 * @param o view object to execute script
1130 * @param script Java Script to execute
1131 * @param callback result callback
1132 * @param user_data user data
1134 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
1136 EAPI Eina_Bool ewk_view_script_execute(Evas_Object* o, const char* script, Ewk_View_Script_Execute_Callback callback, void* user_data);
1139 * Retrieve the contents in plain text.
1141 * @param o view object whose contents to retrieve.
1142 * @param callback result callback
1143 * @param user_data user data
1145 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
1147 EAPI Eina_Bool ewk_view_plain_text_get(Evas_Object* o, Ewk_View_Plain_Text_Get_Callback callback, void* user_data);
1149 // #if ENABLE(TIZEN_SUPPORT_MHTML)
1151 * Get page contents as MHTML data
1153 * @param o view object to get the page contents
1154 * @param callback callback function to be called when the operation is finished
1155 * @param user_data user data to be passed to the callback function
1157 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
1159 EAPI Eina_Bool ewk_view_mhtml_data_get(Evas_Object *o, Ewk_View_MHTML_Data_Get_Callback callback, void *user_data);
1160 // #endif // ENABLE(TIZEN_SUPPORT_MHTML)
1162 // #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
1164 * Creates a new hit test for the given veiw object and point.
1166 * The returned object should be freed by ewk_hit_test_free().
1168 * @param o view object to do hit test on
1169 * @param x the horizontal position to query
1170 * @param y the vertical position to query
1171 * @param hit_test_mode the Ewk_Hit_Test_Mode enum value to query
1173 * @return a newly allocated hit test on success, @c 0 otherwise
1175 EAPI Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* o, int x, int y, int hit_test_mode);
1176 // #endif // #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
1179 * Get the whole history(whole back & forward list) associated with this view.
1181 * @param o view object to get the history(whole back & forward list)
1183 * @return a newly allocated history of @b newly allocated item
1184 * instance. This memory of each item must be released with
1185 * ewk_history_free() after use.
1187 * @see ewk_history_free()
1189 EAPI Ewk_History* ewk_view_history_get(Evas_Object* o);
1192 * Requests to set recording surface.
1194 * @param o view object to set recording surface
1195 * @param enable @c EINA_TRUE to enable recording surface
1196 * @c EINA_FALSE to disable
1198 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
1200 EINA_DEPRECATED EAPI Eina_Bool ewk_view_recording_surface_enable_set(Evas_Object* o, Eina_Bool enable);
1203 * Notify that notification is closed.
1205 * @param notification_list list of Ewk_Notification pointer
1206 * notification_list is freed in this function.
1208 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
1210 EAPI Eina_Bool ewk_view_notification_closed(Evas_Object* o, Eina_List* notification_list);
1213 * Sends the orientation of the device.
1215 * If orientation value is changed, orientationchanged event will occur.
1217 * @param o view object to receive orientation event.
1218 * @param orientation the new orientation of the device. (degree)
1220 * orientation will be 0 degrees when the device is oriented to natural position,
1221 * 90 degrees when it's left side is at the top,
1222 * -90 degrees when it's right side is at the top,
1223 * 180 degrees when it is upside down.
1225 EAPI void ewk_view_orientation_send(Evas_Object *o, int orientation);
1228 * Gets the current encoding.
1230 * @param o view object to get the current encoding
1232 * @return @c current encoding, or @c 0 if it's not setted
1234 EAPI const char* ewk_view_encoding_custom_get(const Evas_Object* o);
1237 * Sets the encoding and reloads the page.
1239 * @param o view to set the encoding
1240 * @param encoding the new encoding to set or @c 0 to restore the default one
1242 EAPI void ewk_view_encoding_custom_set(Evas_Object* o, const char* encoding);
1244 // #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
1245 EINA_DEPRECATED EAPI Eina_Bool ewk_view_text_selection_enable_set(Evas_Object* o, Eina_Bool enable);
1246 EAPI Eina_Bool ewk_view_text_selection_range_get(Evas_Object* o, Eina_Rectangle* left_rect, Eina_Rectangle* right_rect);
1247 EAPI const char* ewk_view_text_selection_text_get(Evas_Object* o);
1248 EINA_DEPRECATED EAPI Eina_Bool ewk_view_auto_clear_text_selection_mode_set(Evas_Object* o, Eina_Bool enable);
1249 EINA_DEPRECATED EAPI Eina_Bool ewk_view_auto_clear_text_selection_mode_get(Evas_Object* o);
1250 // #endif // #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
1252 // #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1254 * Sets the focused input element value
1256 * @param o view object to send the value
1257 * @param value the string value to be set
1259 EAPI void ewk_view_focused_input_element_value_set(Evas_Object* o, const char* value);
1260 // #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1262 // #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1264 * Gets the focused input element's value
1266 * @param o view object to get the value
1268 * @return focused input element's value on success or NULL on failure.
1270 EAPI const char* ewk_view_focused_input_element_value_get(Evas_Object* o);
1271 // #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1273 // #if ENABLE(TIZEN_DATALIST_ELEMENT)
1275 * Closes data list picker
1277 * @param o view object contains data list element
1278 * @param value value to be set to the input element
1280 EAPI void ewk_view_data_list_close(Evas_Object *o, const char *value);
1281 //#endif // ENABLE(TIZEN_DATALIST_ELEMENT)
1284 * Selects index of current popup menu.
1286 * @param o view object contains popup menu.
1287 * @param index index of item to select
1289 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably
1290 * popup menu is not selected or index is out of range)
1292 EAPI Eina_Bool ewk_view_popup_menu_select(Evas_Object *o, unsigned int index);
1294 //#if ENABLE(TIZEN_MULTIPLE_SELECT)
1296 * Selects Multiple indexes of current popup menu.
1298 * @param o view object contains popup menu.
1299 * @param changedlist list of item selected and deselected
1301 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably
1302 * popup menu is not selected or index is out of range)
1304 EAPI Eina_Bool ewk_view_popup_menu_multiple_select(Evas_Object *o, Eina_Inarray* changedlist);
1308 * Closes current popup menu.
1310 * @param o view object contains popup menu.
1312 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably
1313 * popup menu is not selected)
1315 EAPI Eina_Bool ewk_view_popup_menu_close(Evas_Object *o);
1318 * Sets whether the ewk_view supports the mouse events or not.
1320 * The ewk_view will support the mouse events if EINA_TRUE or not support the
1321 * mouse events otherwise. The default value is EINA_TRUE.
1323 * @param o view object to enable/disable the mouse events
1324 * @param enabled a state to set
1326 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
1328 EAPI Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object *o, Eina_Bool enabled);
1331 * Queries if the ewk_view supports the mouse events.
1333 * @param o view object to query if the mouse events are enabled
1335 * @return @c EINA_TRUE if the mouse events are enabled or @c EINA_FALSE otherwise
1337 EAPI Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object *o);
1339 typedef Eina_Bool (*Ewk_Orientation_Lock_Cb)(Evas_Object* o, Eina_Bool need_lock, int orientation, void* user_data);
1342 * Sets callback of orientation lock function
1344 * func will be called when screen lock is called or unlock is called.
1345 * When screen.lockOrientation is called, need_lock will be true and orientation
1346 * will be the flags which should be locked.
1347 * For example, when contents called 'screen.lockOrientation("portrait"), orientation
1348 * will be EWK_SCREEN_ORIENTATION_PORTRAIT_PRIMARY | EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY
1349 * When screen.unlockOrientation is called, need_lock will be false.
1351 * @param o view object to set the callback of orientation
1352 * @param func callback function to be called when screen orientation is locked or unlocked.
1353 * @param use_data user_data will be passsed when ewk_view_web_app_icon_get is called
1355 * @return current URI on success or @c 0 on failure
1357 EINA_DEPRECATED EAPI void ewk_view_orientation_lock_callback_set(Evas_Object *o, Ewk_Orientation_Lock_Cb func, void* user_data);
1359 // #endif // #if OS(TIZEN)
1362 * Loads the specified @a html string as the content of the view.
1364 * External objects such as stylesheets or images referenced in the HTML
1365 * document are located relative to @a baseUrl.
1367 * If an @a unreachableUrl is passed it is used as the url for the loaded
1368 * content. This is typically used to display error pages for a failed
1371 * @param o view object to load the HTML into
1372 * @param html HTML data to load
1373 * @param baseUrl Base URL used for relative paths to external objects (optional)
1374 * @param unreachableUrl URL that could not be reached (optional)
1376 * @return @c EINA_TRUE if it the HTML was successfully loaded, @c EINA_FALSE otherwise
1378 EAPI Eina_Bool ewk_view_html_string_load(Evas_Object *o, const char *html, const char *baseUrl, const char *unreachableUrl);
1381 * Scales the current page, centered at the given point.
1383 * @param o view object to set the zoom level
1384 * @param scale_factor a new level to set
1385 * @param cx x of center coordinate
1386 * @param cy y of center coordinate
1388 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
1390 EAPI Eina_Bool ewk_view_scale_set(Evas_Object *o, double scaleFactor, int x, int y);
1393 * Queries the current scale factor of the page.
1395 * It returns previous scale factor after ewk_view_scale_set is called immediately
1396 * until scale factor of page is really changed.
1398 * @param o view object to get the scale factor
1400 * @return current scale factor in use on success or @c -1.0 on failure
1402 EAPI double ewk_view_scale_get(const Evas_Object *o);
1405 * Queries the ratio between the CSS units and device pixels when the content is unscaled.
1407 * When designing touch-friendly contents, knowing the approximated target size on a device
1408 * is important for contents providers in order to get the intented layout and element
1411 * As most first generation touch devices had a PPI of approximately 160, this became a
1412 * de-facto value, when used in conjunction with the viewport meta tag.
1414 * Devices with a higher PPI learning towards 240 or 320, applies a pre-scaling on all
1415 * content, of either 1.5 or 2.0, not affecting the CSS scale or pinch zooming.
1417 * This value can be set using this property and it is exposed to CSS media queries using
1418 * the -webkit-device-pixel-ratio query.
1420 * For instance, if you want to load an image without having it upscaled on a web view
1421 * using a device pixel ratio of 2.0 it can be done by loading an image of say 100x100
1422 * pixels but showing it at half the size.
1424 * @media (-webkit-min-device-pixel-ratio: 1.5) {
1428 * url: "/images/icon@2x.png"; // This is actually a 100x100 image
1432 * If the above is used on a device with device pixel ratio of 1.5, it will be scaled
1433 * down but still provide a better looking image.
1435 * @param o view object to get device pixel ratio
1437 * @return the ratio between the CSS units and device pixels,
1438 * or @c -1.0 on failure
1440 EAPI float ewk_view_device_pixel_ratio_get(const Evas_Object *o);
1443 * Sets the ratio between the CSS units and device pixels when the content is unscaled.
1445 * @param o view object to set device pixel ratio
1447 * @return @c EINA_TRUE if the device pixel ratio was set, @c EINA_FALSE otherwise
1449 * @see ewk_view_device_pixel_ratio_get()
1451 EAPI Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object *o, float ratio);
1454 * Sets the theme path that will be used by this view.
1456 * This also sets the theme on the main frame. As frames inherit theme
1457 * from their parent, this will have all frames with unset theme to
1460 * @param o view object to change theme
1461 * @param path theme path
1463 EAPI void ewk_view_theme_set(Evas_Object *o, const char *path);
1466 * Gets the theme set on this view.
1468 * This returns the value set by ewk_view_theme_set().
1470 * @param o view object to get theme path
1472 * @return the theme path, may be @c NULL if not set
1474 EAPI const char *ewk_view_theme_get(const Evas_Object *o);
1477 * Gets the current custom character encoding name.
1479 * @param o view object to get the current encoding
1481 * @return @c eina_strinshare containing the current encoding, or
1482 * @c NULL if it's not set
1484 EAPI const char *ewk_view_custom_encoding_get(const Evas_Object *o);
1487 * Sets the custom character encoding and reloads the page.
1489 * @param o view to set the encoding
1490 * @param encoding the new encoding to set or @c NULL to restore the default one
1492 * @return @c EINA_TRUE on success @c EINA_FALSE otherwise
1494 EAPI Eina_Bool ewk_view_custom_encoding_set(Evas_Object *o, const char *encoding);
1497 * Searches and hightlights the given string in the document.
1499 * @param o view object to find text
1500 * @param text text to find, must @b not be @c NULL
1501 * @param options options to find
1502 * @param max_match_count maximum match count to find, unlimited if 0
1504 * @return @c EINA_TRUE on success, @c EINA_FALSE on errors
1506 EAPI Eina_Bool ewk_view_text_find(Evas_Object *o, const char *text, Ewk_Find_Options options, unsigned max_match_count);
1509 * Clears the highlight of searched text.
1511 * @param o view object to find text
1513 * @return @c EINA_TRUE on success, @c EINA_FALSE on errors
1515 EAPI Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object *o);
1518 * Counts the given string in the document.
1520 * This does not highlight the matched string and just count the matched string.
1522 * As the search is carried out through the whole document,
1523 * only the following EWK_FIND_OPTIONS are valid.
1524 * - EWK_FIND_OPTIONS_NONE
1525 * - EWK_FIND_OPTIONS_CASE_INSENSITIVE
1526 * - EWK_FIND_OPTIONS_AT_WORD_START
1527 * - EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START
1529 * The "text,found" callback will be called with the number of matched string.
1531 * @param o view object to find text
1532 * @param text text to find
1533 * @param options options to find
1534 * @param max_match_count maximum match count to find, unlimited if 0
1536 * @return @c EINA_TRUE on success, @c EINA_FALSE on errors
1538 EAPI Eina_Bool ewk_view_text_matches_count(Evas_Object *o, const char *text, Ewk_Find_Options options, unsigned max_match_count);
1541 * Sets the user chosen color. To be used when implementing a color picker.
1543 * The function should only be called when a color has been requested by the document.
1544 * If called when this is not the case or when the input picker has been dismissed, this
1545 * function will fail and return EINA_FALSE.
1547 * @param o view object contains color picker
1548 * @param r red channel value to be set
1549 * @param g green channel value to be set
1550 * @param b blue channel value to be set
1551 * @param a alpha channel value to be set
1553 * @return @c EINA_TRUE on success @c EINA_FALSE otherwise
1555 EAPI Eina_Bool ewk_view_color_picker_color_set(Evas_Object *o, int r, int g, int b, int a);
1558 * Feeds the touch event to the view.
1560 * @param o view object to feed touch event
1561 * @param type the type of touch event
1562 * @param points a list of points (Ewk_Touch_Point) to process
1563 * @param modifiers an Evas_Modifier handle to the list of modifier keys
1564 * registered in the Evas. Users can get the Evas_Modifier from the Evas
1565 * using evas_key_modifier_get() and can set each modifier key using
1566 * evas_key_modifier_on() and evas_key_modifier_off()
1568 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
1570 EAPI Eina_Bool ewk_view_feed_touch_event(Evas_Object *o, Ewk_Touch_Event_Type type, const Eina_List *points, const Evas_Modifier *modifiers);
1573 * Sets whether the ewk_view supports the touch events or not.
1575 * The ewk_view will support the touch events if @c EINA_TRUE or not support the
1576 * touch events otherwise. The default value is @c EINA_FALSE.
1578 * @param o view object to enable/disable the touch events
1579 * @param enabled a state to set
1581 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
1583 EAPI Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object *o, Eina_Bool enabled);
1586 * Queries if the ewk_view supports the touch events.
1588 * @param o view object to query if the touch events are enabled
1590 * @return @c EINA_TRUE if the touch events are enabled or @c EINA_FALSE otherwise
1592 EAPI Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object *o);
1595 * Sets the visibility of main frame scrollbar.
1597 * @param o view object
1598 * @param visible visibility of main frame scrollbar
1600 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
1602 Eina_Bool ewk_view_main_frame_scrollbar_visible_set(Evas_Object *o, Eina_Bool visible);
1605 * Gets the visibility of main frame scrollbar.
1607 * @param o view object
1609 * @return @c EINA_TRUE if scrollbar is visible or @c EINA_FALSE on failure
1611 Eina_Bool ewk_view_main_frame_scrollbar_visible_get(const Evas_Object *o);
1614 * Get contents of the current web page.
1616 * @param o view object to get the page contents
1617 * @param context context of the page contents which has contents type and callback function
1619 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
1621 EAPI Eina_Bool ewk_view_page_contents_get(const Evas_Object *o, Ewk_Page_Contents_Context *context);
1624 * Scroll to the position of the given view with animation
1626 * Both values are from zero to the contents size minus the viewport
1629 * @param o view object to scroll
1630 * @param x horizontal position to scroll
1631 * @param y vertical position to scroll
1633 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
1635 EAPI Eina_Bool ewk_view_animated_scroll_set(Evas_Object *o, int x, int y);
1638 * Clear back forward list of a page.
1640 * @param o view object to clear back forward list
1642 EAPI void ewk_view_back_forward_list_clear(const Evas_Object *o);
1644 /// Enum values containing Content Security Policy header types.
1645 enum _Ewk_CSP_Header_Type {
1649 typedef enum _Ewk_CSP_Header_Type Ewk_CSP_Header_Type;
1652 * Set received Content Security Policy data from web app
1654 * @param o view object
1655 * @param policy Content Security Policy data
1656 * @param type Content Security Policy header type
1659 EAPI void ewk_view_content_security_policy_set(Evas_Object* o, const char* policy, Ewk_CSP_Header_Type type);
1662 * Starts offline page save.
1664 * @param o view object to start offline page save
1665 * @param path directory path to save offline page
1667 * @return @c EINA_TRUE on success, @c EINA_FALSE on errors
1669 EAPI Eina_Bool ewk_view_page_save(Evas_Object* o, const char* path);
1674 #endif // ewk_view_h