[M69 Dev][API] Add mockup EWK APIs
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / public / ewk_view_product.h
1 /*
2  * Copyright (C) 2011-2016 Samsung Electronics. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS
14  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 /**
27  * @file    ewk_view_product.h
28  * @brief   Chromium main smart object.
29  *
30  * This object provides view related APIs of Chromium to EFL object.
31  */
32
33 #ifndef ewk_view_product_h
34 #define ewk_view_product_h
35
36 #include "ewk_context_product.h"
37 #include "ewk_value_product.h"
38 #include "ewk_view_internal.h"
39
40 #if defined(TIZEN_PEPPER_EXTENSIONS)
41 #include "ewk_value_product.h"
42 #endif
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 /**
49  * A callback to check whether allowed to run mixed content or not
50  *
51  * @param ewkView view object
52  * @param user_data user_data will be passed when callback is called
53  * @return true: allow to run mixed content. false: not allow to run mixed content
54  */
55 typedef Eina_Bool (*Ewk_View_Run_Mixed_Content_Confirm_Callback)(Evas_Object* ewkView, void* user_data);
56
57 /**
58  * @brief Creates a new EFL Chromium view object.
59  *
60  * @since_tizen 2.3
61  *
62  * @param[in] e canvas object where to create the view object
63  * @param[in] data a pointer to data to restore session data
64  * @param[in] length length of session data to restore session data
65  *
66  * @return view object on success or @c NULL on failure
67  */
68 EXPORT_API Evas_Object* ewk_view_add_with_session_data(Evas* e, const char* data, unsigned length);
69
70 /**
71  * @brief Gets the reference object for frame that represents the main frame.
72  *
73  * @since_tizen 2.3
74  *
75  * @param[in] o view object to get main frame
76  *
77  * @return frame reference of frame object on success, or NULL on failure
78  */
79 EXPORT_API Ewk_Frame_Ref ewk_view_main_frame_get(Evas_Object* o);
80
81 /**
82  * @brief Reply of javascript alert popup
83  *
84  * @since_tizen 2.3
85  *
86  * @param[in] o view object
87  */
88 EXPORT_API void ewk_view_javascript_alert_reply(Evas_Object* o);
89
90 /**
91  * @brief Reply of javascript confirm popup
92  *
93  * @since_tizen 2.3
94  *
95  * @param[in] o view object
96  * @param[in] result result of javascript confirm popup
97  */
98 EXPORT_API void ewk_view_javascript_confirm_reply(Evas_Object* o, Eina_Bool result);
99
100 /**
101  * @brief Reply of javascript prompt popup
102  *
103  * @since_tizen 2.3
104  *
105  * @param[in] o view object
106  * @param[in] result entered characters of javascript prompt popup
107  */
108 EXPORT_API void ewk_view_javascript_prompt_reply(Evas_Object* o, const char* result);
109
110 /**
111  * @brief Callback for before unload popup
112  *
113  * @since_tizen 2.3
114  *
115  * @param[in] o view object
116  * @param[in] message the contents of before unload popup
117  * @param[in] user_data user data
118  */
119 typedef Eina_Bool (*Ewk_View_Before_Unload_Confirm_Panel_Callback)(Evas_Object* o, const char* message, void* user_data);
120
121 /**
122  * @brief Sets callback of before unload popup
123  *
124  * @since_tizen 2.3
125  *
126  * @param[in] o view object to set the callback
127  * @param[in] callback callback function for before unload popoup
128  * @param[in] user_data user data
129  */
130 EXPORT_API void ewk_view_before_unload_confirm_panel_callback_set(Evas_Object* o, Ewk_View_Before_Unload_Confirm_Panel_Callback callback, void* user_data);
131
132 /**
133  * @brief Reply of before unload popup
134  *
135  * @since_tizen 2.3
136  *
137  * @param[in] o view object
138  * @param[in] result result of before unload popup
139  */
140 EXPORT_API void ewk_view_before_unload_confirm_panel_reply(Evas_Object* o, Eina_Bool result);
141
142 /**
143  * @brief Sets callback of getting application cache permission.
144  *
145  * @since_tizen 2.3
146  *
147  * @param[in] o view object to set the callback of application cache permission
148  * @param[in] callback function to be called when application cache need to
149  *            get permission
150  * @param[in] user_data user data
151  */
152 EXPORT_API void ewk_view_application_cache_permission_callback_set(Evas_Object* o, Ewk_View_Applicacion_Cache_Permission_Callback callback, void* user_data);
153
154 /**
155  * @brief Application cache permission confirm popup reply
156  *
157  * @since_tizen 2.3
158  *
159  * @param[in] o view object to reply permission confirm popup
160  * @param[in] allow of response
161  */
162 EXPORT_API void ewk_view_application_cache_permission_reply(Evas_Object* o, Eina_Bool allow);
163
164 /**
165  * @brief Set to callback to controll unfocus operation from the arrow of
166  *        h/w keyboard.
167  *
168  * @since_tizen 2.3
169  *
170  * @param[in] o view object
171  * @param[in] callback callback to controll unfocus operation from the arrow of
172  *            h/w keyboard
173  * @param[in] user_data user data
174  */
175 EXPORT_API void ewk_view_unfocus_allow_callback_set(Evas_Object* o, Ewk_View_Unfocus_Allow_Callback callback, void* user_data);
176
177 /**
178  * @brief Requests loading the given contents.
179  *
180  * @since_tizen 2.3
181  *
182  * @param[in] o view object to load document
183  * @param[in] html what to load
184  * @param[in] base_uri base uri to use for relative resources, may be @c 0,\n
185  *        if provided @b must be an absolute uri
186  *
187  * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors
188  */
189 EXPORT_API Eina_Bool ewk_view_html_contents_set(Evas_Object* o, const char* html, const char* base_uri);
190
191 /**
192  * @brief Callback for ewk_view_cache_image_get
193  *
194  * @since_tizen 3.0
195  *
196  * @param[in] o view object
197  * @param[in] image_url url of the image in the cache
198  * @param[in] image cache image @b should be freed after use
199  * @param[in] user_data user data
200  */
201 typedef void (*Ewk_View_Cache_Image_Get_Callback)(Evas_Object* o, const char* image_url, Evas_Object* image, void* user_data);
202
203 /**
204  * @brief Asynchronous request for get the cache image specified in url.
205  *
206  * @since_tizen 3.0
207  *
208  * @param[in] o view object
209  * @param[in] image_url url of the image in the cache
210  * @param[in] canvas canvas for creating evas image
211  * @param[in] callback result callback to get cache image
212  * @param[in] user_data user_data will be passed when @a callback is called
213  *
214  * @return @c EINA_TRUE on successful request, @c EINA_FALSE on failure
215  */
216 EXPORT_API Eina_Bool ewk_view_cache_image_get(const Evas_Object* o, const char* image_url, Evas* canvas,
217                                               Ewk_View_Cache_Image_Get_Callback callback, void* user_data);
218
219 /**
220  * @brief Requests for getting web application capable.
221  *
222  * @since_tizen 2.3
223  *
224  * @param[in] o view object
225  * @param[in] callback result callback to get web database quota
226  * @param[in] user_data user_data will be passed when result_callback is
227  *            called\n -I.e., user data will be kept until callback is called
228  *
229  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
230  */
231 EXPORT_API Eina_Bool ewk_view_web_application_capable_get(Evas_Object* o, Ewk_Web_App_Capable_Get_Callback callback, void* user_data);
232
233 /**
234  * @brief Requests for getting web application icon string.
235  *
236  * @since_tizen 2.3
237  *
238  * @param[in] o view object
239  * @param[in] callback result callback to get web database quota
240  * @param[in] user_data user_data will be passed when result_callback is
241  *            called\n -I.e., user data will be kept until callback is called
242  *
243  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
244  */
245 EXPORT_API Eina_Bool ewk_view_web_application_icon_url_get(Evas_Object* o, Ewk_Web_App_Icon_URL_Get_Callback callback, void* user_data);
246
247 /**
248  * @brief Requests for getting web application icon list of
249  *        Ewk_Web_App_Icon_Data.
250  *
251  * @since_tizen 2.3
252  *
253  * @param[in] o view object
254  * @param[in] callback result callback to get web application icon urls
255  * @param[in] user_data user_data will be passed when result_callback is
256  *            called\n -I.e., user data will be kept until callback is called
257  *
258  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
259  */
260 EXPORT_API Eina_Bool ewk_view_web_application_icon_urls_get(Evas_Object* o, Ewk_Web_App_Icon_URLs_Get_Callback callback, void* user_data);
261
262 /**
263  * @brief Get the whole history(whole back & forward list) associated with this
264  *        view.
265  *
266  * @since_tizen 2.3
267  *
268  * @param[in] o view object to get the history(whole back & forward list)
269  *
270  * @return a newly allocated history of @b newly allocated item\n
271  *         instance. This memory of each item must be released with\n
272  *         ewk_history_free() after use
273  *
274  * @see ewk_history_free()
275  */
276 EXPORT_API Ewk_History* ewk_view_history_get(Evas_Object* o);
277
278 /**
279  * @brief Gets the selection ranges
280  *
281  * @since_tizen 2.3
282  *
283  * @param[in] o view object to get theselection ranges
284  * @param[out] left_rect the start lect(left rect) of the selection ranges
285  * @param[out] right_rect the end lect(right rect) of the selection ranges
286  *
287  * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
288  */
289 EXPORT_API Eina_Bool ewk_view_text_selection_range_get(Evas_Object* o, Eina_Rectangle* left_rect, Eina_Rectangle* right_rect);
290
291 /**
292  * @brief Sets the focused input element value
293  *
294  * @since_tizen 2.3
295  *
296  * @param[in] o view object to send the value
297  * @param[in] value the string value to be set
298  */
299 EXPORT_API void ewk_view_focused_input_element_value_set(Evas_Object* o, const char* value);
300
301 /**
302  * @brief Gets the focused input element's value
303  *
304  * @since_tizen 2.3
305  *
306  * @param[in] o view object to get the value
307  *
308  * @return focused input element's value on success or NULL on failure
309  */
310 EXPORT_API const char* ewk_view_focused_input_element_value_get(Evas_Object* o);
311
312 /**
313  * @brief Selects index of current popup menu.
314  *
315  * @since_tizen 2.3
316  *
317  * @param[in] o view object contains popup menu
318  * @param[in] index index of item to select
319  *
320  * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably\n
321  *         popup menu is not selected or index is out of range)
322  */
323 EXPORT_API Eina_Bool ewk_view_popup_menu_select(Evas_Object* o, unsigned int index);
324
325 /**
326  * @brief Selects Multiple indexes  of current popup menu.
327  *
328  * @since_tizen 2.3
329  *
330  * @param[in] o view object contains popup menu.
331  * @param[in] changed_list  list of item selected and deselected
332  *
333  * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably\n
334  *         popup menu is not selected or index is out of range)
335  */
336 EXPORT_API Eina_Bool ewk_view_popup_menu_multiple_select(Evas_Object* o, Eina_Inarray* changed_list);
337
338 /*
339  * @brief Sets the user chosen color. To be used when implementing a color
340  *        picker.
341  *
342  * @details The function should only be called when a color has been requested
343  *          by the document.\n If called when this is not the case or when the
344  *          input picker has been dismissed, this\n function will fail and
345  *          return EINA_FALSE.
346  *
347  * @since_tizen 2.3
348  *
349  * @param[in] o view object contains color picker
350  * @param[in] r red channel value to be set
351  * @param[in] g green channel value to be set
352  * @param[in] b blue channel value to be set
353  * @param[in] a alpha channel value to be set
354  *
355  * @return @c EINA_TRUE on success @c EINA_FALSE otherwise
356  */
357 EXPORT_API Eina_Bool ewk_view_color_picker_color_set(Evas_Object* o, int r, int g, int b, int a);
358
359 /**
360  * @brief Feeds the touch event to the view.
361  *
362  * @since_tizen 2.3
363  *
364  * @param[in] o view object to feed touch event
365  * @param[in] type the type of touch event
366  * @param[in] points a list of points (Ewk_Touch_Point) to process
367  * @param[in] modifiers an Evas_Modifier handle to the list of modifier keys\n
368  *        registered in the Evas. Users can get the Evas_Modifier from the
369  *        Evas\n using evas_key_modifier_get() and can set each modifier key
370  *        using\n evas_key_modifier_on() and evas_key_modifier_off()
371  *
372  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
373  */
374 EXPORT_API Eina_Bool ewk_view_feed_touch_event(Evas_Object* o, Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers);
375
376 /**
377  * Creates a type name for the callback function used to get the background color.
378  *
379  * @param o view object
380  * @param r red color component
381  * @param g green color component
382  * @param b blue color component
383  * @param a transparency
384  * @param user_data user data will be passed when ewk_view_bg_color_get is called
385  */
386 typedef void (*Ewk_View_Background_Color_Get_Callback)(Evas_Object *o, int r, int g, int b, int a, void* user_data);
387
388 /**
389  * Gets the background color and transparency of the view.
390  *
391  * @param o view object to get the background color from
392  * @param callback callback function
393  * @param user_data user data will be passed when the callback is called
394  *
395  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
396  *
397  *  On success the background color of the view object o is retrieved
398  *  in the callback function
399  */
400 EXPORT_API Eina_Bool ewk_view_bg_color_get(Evas_Object *o, Ewk_View_Background_Color_Get_Callback callback, void *user_data);
401
402 /**
403  * Callback for ewk_view_main_frame_scrollbar_visible_get
404  *
405  * @param o view object
406  * @param visibility visibility of main frame scrollbar
407  * @param user_data user data passed to ewk_view_main_frame_scrollbar_visible_get
408  */
409 typedef void (*Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback)(Evas_Object* o, Eina_Bool visible, void* user_data);
410
411 /**
412  * @brief Gets the visibility of main frame scrollbar.
413  *
414  * @since_tizen 3.0
415  *
416  * @param[in] o view object
417  * @param callback callback function
418  * @param user_data user data will be passed when the callback is caller
419  *
420  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
421  *
422  *  On success the visibility of the scrollbar of the view object o is retrieved
423  *  in the callback function
424  */
425 EXPORT_API Eina_Bool ewk_view_main_frame_scrollbar_visible_get(Evas_Object* view, Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback callback, void* user_data);
426
427 /**
428  * @brief Gets the session data to be saved in a persistent store on
429  *        browser exit
430  *
431  * @since_tizen 2.3
432  *
433  * @param[in] o view object whose session needs to be stored.
434  * @param[in] data out parameter session data
435  * @param[in] length out parameter length of session data
436  */
437 EXPORT_API void ewk_view_session_data_get(Evas_Object* o, const char** data, unsigned* length);
438
439 /**
440  * @brief Reloads the current page's document without cache.
441  *
442  * @since_tizen 2.3
443  *
444  * @param[in] o view object to reload current document
445  *
446  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
447  */
448 EXPORT_API Eina_Bool ewk_view_reload_bypass_cache(Evas_Object* o);
449
450 /**
451  * @brief Creates a new hit test for the given veiw object and point.
452  *
453  * @since_tizen 2.3
454  *
455  * @remarks The returned object should be freed by ewk_hit_test_free().
456  *
457  * @param[in] o view object to do hit test on
458  * @param[in] x the horizontal position to query
459  * @param[in] y the vertical position to query
460  * @param[in] hit_test_mode the #Ewk_Hit_Test_Mode enum value to query
461  *
462  * @return a newly allocated hit test on success, @c 0 otherwise
463  */
464 EXPORT_API Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* o, int x, int y, int hit_test_mode);
465
466 /**
467  * Create PDF file of page contents
468  *
469  * @param o view object to get page contents.
470  * @param width the suface width of PDF file.
471  * @param height the suface height of PDF file.
472  * @param fileName the file name for creating PDF file.
473  *
474  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
475  */
476 /* This return value is status of the request not the status of actual operation.
477  * There should be some callback to get the actual status or reason of failure.
478  */
479 EXPORT_API Eina_Bool ewk_view_contents_pdf_get(Evas_Object* o, int width, int height, const char* fileName);
480
481 /**
482  * Requests for setting callback function
483  *
484  * @param ewkView view object
485  * @param user_data user_data will be passed when callback is called
486  * @param callback callback function
487  */
488 EXPORT_API void ewk_view_run_mixed_content_confirm_callback_set(Evas_Object* ewkView, Ewk_View_Run_Mixed_Content_Confirm_Callback callback, void* user_data);
489
490 /**
491  * Returns the current favicon of view object.
492  *
493  * @param item view object to get current icon URL
494  *
495  * @return current favicon on success or @c NULL if unavailable or on failure.
496  * The returned Evas_Object needs to be freed after use.
497  */
498 EXPORT_API Evas_Object* ewk_view_favicon_get(const Evas_Object* ewkView);
499
500 /**
501  * To resume new url network loading
502  *
503  * @param item view object to resume new url loading
504  *
505  */
506 EXPORT_API void ewk_view_resume_network_loading(Evas_Object* item);
507
508 EXPORT_API void ewk_view_poweroff_suspend(Evas_Object *item);
509
510 /**
511  * To suspend all url loading
512  *
513  * @param item view object to suspend url loading
514  *
515  */
516 EXPORT_API void ewk_view_suspend_network_loading(Evas_Object* item);
517
518 /**
519  * This function should be use for browser edge scroll.
520  * It can also be used when the mouse pointer is out of webview.
521  * Scrolls webpage of view by dx and dy.
522  *
523  * @param item view object to scroll
524  * @param dx horizontal offset to scroll
525  * @param dy vertical offset to scroll
526  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
527  */
528 EXPORT_API Eina_Bool ewk_view_edge_scroll_by(Evas_Object *item, int dx, int dy);
529
530 /**
531  * Allow a browser to set its own cursor by setting a flag
532  * which prevents setting a default web page cursor.
533  *
534  * @param ewkView view object
535  * @param enable EINA_TRUE - prevent update of cursor by engine
536  *               EINA_FALSE - allow for update of cursor by engine
537  */
538 EXPORT_API void ewk_view_set_cursor_by_client(Evas_Object* ewkView, Eina_Bool enable);
539
540 /**
541  * Reply of running mixed content or not
542  *
543  * @param ewkView view object
544  * @param result reply
545  */
546 EXPORT_API void ewk_view_run_mixed_content_confirm_reply(Evas_Object* ewkView, Eina_Bool result);
547
548 /**
549  * Sets the cover-area (soon rect)  multiplier.
550  *
551  * @param ewkView view object
552  * @param coverAreaMultiplier the multiplier of cover-area.
553  */
554 EXPORT_API void ewk_view_tile_cover_area_multiplier_set(
555     Evas_Object* ewkView,
556     float cover_area_multiplier);
557
558 /**
559  * Set to enabled/disabled clear tiles on hide.
560  *
561  * @param ewkView view object
562  * @param enabled/disabled a state to set
563  *
564  */
565 EXPORT_API void ewk_view_clear_tiles_on_hide_enabled_set(Evas_Object* ewkView,
566                                                          Eina_Bool enable);
567
568 /**
569  * @brief Callback for ewk_view_is_video_playing
570  *
571  * @param[in] o the view object
572  * @param[in] is_playing video is playing or not
573  * @param[in] user_data user_data will be passsed when ewk_view_is_video_playing is
574  *                      called
575  */
576 typedef void (*Ewk_Is_Video_Playing_Callback)(Evas_Object* o, Eina_Bool is_playing, void* user_data);
577
578 /**
579  * @brief Asynchronous request for check if there is a video playing in the given view
580  *
581  * @param[in] o The view object
582  * @param[in] callback result callback to get web application capable
583  * @param[in] user_data user_data will be passed when result_callback is called
584  *
585  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
586  */
587 EXPORT_API Eina_Bool ewk_view_is_video_playing(Evas_Object* o, Ewk_Is_Video_Playing_Callback callback, void* user_data);
588
589 /**
590  * Callback for ewk_view_stop_video
591  *
592  * @param o view object
593  * @param is_stopped video is stopped or not
594  * @param user_data user_data will be passsed when ewk_view_stop_video is called
595  */
596 typedef void (*Ewk_Stop_Video_Callback)(Evas_Object* o, Eina_Bool is_stopped, void* user_data);
597
598 /**
599  * Asynchronous request for stopping any playing video in the given view
600  *
601  * @param[in] o The view object
602  * @param[in] callback result callback to get web application capable
603  * @param[in] user_data user_data will be passed when result_callback is called
604  *
605  * @return @c EINA_TRUE if any video was stopped or @c EINA_FALSE is there was no active video
606  */
607 EXPORT_API Eina_Bool ewk_view_stop_video(Evas_Object* o, Ewk_Stop_Video_Callback callback, void* user_data);
608
609 /**
610  * @brief Sets the support of video hole and video window, Use H/W overlay for performance of video output
611  *
612  * @since_tizen 3.0
613  *
614  * @param[in] o the view object
615  * @param[in] o the top-level window object
616  * @param[in] enable EINA_TRUE to set on support the video hole,
617  *            EINA_FALSE otherwise
618  * @param[in] enable EINA_TRUE to set on the video window of video hole,
619  *            EINA_FALSE to set on the video windowless of video hole
620  *
621  * @return return @c EINA_TRUE on success or @c EINA_FALSE on failure
622  */
623 EXPORT_API Eina_Bool ewk_view_set_support_video_hole(Evas_Object* ewkView, Evas_Object* window, Eina_Bool enable, Eina_Bool isVideoWindow);
624
625 /**
626  * @brief Sets the support of 4K video, Customize the device pixel ratio for
627  * video plane.
628  *
629  * @since_tizen 3.0
630  *
631  * @note Should be used after ewk_view_url_set().
632  *
633  * @param[in] o the view object
634  * @param[in] o enabled a state to set
635  *
636  * @return return @c EINA_TRUE on success or @c EINA_FALSE on failure
637  */
638 EXPORT_API Eina_Bool ewk_view_set_custom_device_pixel_ratio(Evas_Object* ewkView, Eina_Bool enabled);
639
640 /**
641  * @brief Gets whether vertical panning is holding.
642  *
643  * @since_tizen 2.3
644  *
645  * @param[in] o view object to get whether vertical panning is holding
646  *
647  * @return @c EINA_TRUE if vertical panning is holding
648  *         @c EINA_FALSE if not or on failure
649  */
650 EXPORT_API Eina_Bool ewk_view_vertical_panning_hold_get(Evas_Object* o);
651
652 /**
653   * Block/Release the vertical pan
654   *
655   * @param o view object on which pan is to be blocked/release
656   * @param hold status of pan
657   */
658 EXPORT_API void ewk_view_vertical_panning_hold_set(Evas_Object* o, Eina_Bool hold);
659
660 /**
661  * Callback for the generic sync call.
662  * It requests for performing operation/call giving its name. Arguments
663  * and return value is operation/call specific.
664  *
665  * @param[in] name requested call name
666  * @param[in] arguments call argumets, format is defined by opertion itself
667  * @param[in] user_data user_data will be passed when result_callback is called
668  *
669  * @return return value from the call, format is defind by operation itself
670  */
671 typedef Ewk_Value (*Generic_Sync_Call_Callback)(const char* name, Ewk_Value arguments, void* user_data);
672
673 /**
674  * Sets the function pointer for the generic sync call
675  *
676  * @param ewk_view view object to set the function pointer in
677  * @param cb pointer to the function
678  * @param user_data pointer to user data to be passed to the function when
679  *        it's being called
680  */
681 EXPORT_API void ewk_view_widget_pepper_extension_callback_set(Evas_Object* ewk_view, Generic_Sync_Call_Callback cb, void* user_data);
682
683 /**
684  * Sets the pepper widget extension info
685  *
686  * @param ewk_view view object to set the info in
687  * @param widget_pepper_ext_info the Ewk_Value containing the information
688  */
689 EXPORT_API void ewk_view_widget_pepper_extension_info_set(Evas_Object* ewk_view, Ewk_Value widget_pepper_ext_info);
690
691 #if defined(OS_TIZEN_TV)
692 /**
693  * Set the translated url to media player.
694  *
695  * @param ewkView view object
696  * @param url string
697  *
698  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
699  */
700 EXPORT_API Eina_Bool ewk_media_translated_url_set(Evas_Object* ewkView, const char* url);
701 #endif
702
703 /**
704  * Set app is preload type or not.
705  *
706  * @param ewkView view object
707  * @param is_preload if app is preload type
708  *
709  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
710  */
711 EXPORT_API Eina_Bool ewk_view_app_preload_set(Evas_Object* ewkView, Eina_Bool is_preload);
712
713 /**
714  * @brief Sends key event.
715  *
716  * @since_tizen 2.4
717  *
718  * @param[in] o The view object
719  * @param[in] key_event Evas_Event_Key_Down struct or Evas_Event_Key_Up struct
720  * @param[in] isPress EINA_TRUE: keydown, EINA_FALSE: keyup
721  * @return @c EINA_TRUE on success,\n
722  *         otherwise @c EINA_FALSE
723  */
724 EXPORT_API Eina_Bool ewk_view_send_key_event(Evas_Object* o, void* key_event, Eina_Bool is_press);
725
726 /**
727  * @brief Sets whether the ewk_view supports the key events or not.
728  *
729  * @since_tizen 2.4
730  *
731  * @note Should be used after ewk_view_url_set().
732  *
733  * @remarks The ewk_view will support the key events if EINA_TRUE or not support the
734  *          key events otherwise. The default value is EINA_TRUE.
735  *
736  * @param[in] o The view object
737  * @param[in] enabled a state to set
738  *
739  * @return @c EINA_TRUE on success,\n
740  *         otherwise @c EINA_FALSE
741  */
742 EXPORT_API Eina_Bool ewk_view_key_events_enabled_set(Evas_Object *o, Eina_Bool enabled);
743
744 enum Ewk_Scrollbar_Orientation {
745   EWK_HORIZONTAL_SCROLLBAR = 0,
746   EWK_VERTICAL_SCROLLBAR
747 };
748
749 typedef enum Ewk_Scrollbar_Orientation Ewk_Scrollbar_Orientation;
750
751 struct Ewk_Scrollbar_Data {
752   Ewk_Scrollbar_Orientation orientation; /**< scrollbar orientation */
753   Eina_Bool focused;                     /**< isFocused */
754 };
755
756 typedef struct Ewk_Scrollbar_Data Ewk_Scrollbar_Data;
757
758 /**
759  * @brief Adds an item to back forward list
760  *
761  * @since_tizen 2.4
762  *
763  * @param[in] o The view object
764  * @param[in] item The back-forward list item instance
765  * @return @c EINA_TRUE on success,\n
766  *         otherwise @c EINA_FALSE
767  */
768 EXPORT_API Eina_Bool
769 ewk_view_add_item_to_back_forward_list(Evas_Object* o,
770                                        const Ewk_Back_Forward_List_Item* item);
771
772 /**
773  * @brief Load the specified @a html string as the content of the view overriding
774  *        current history entry. Can be used to ignore the malicious page while
775  *        navigation backward/forward.
776  *
777  * @since_tizen 3.0
778  *
779  * @param[in] view object to load the HTML into
780  * @param[in] html HTML data to load
781  * @param[in] base_url Base URL used for relative paths to external objects
782  *            (optional)
783  * @param[in] unreachable_url URL that could not be reached (optional)
784  *
785  * @return @c EINA_TRUE if it the HTML was successfully loaded,
786  *         @c EINA_FALSE otherwise
787  */
788 EXPORT_API Eina_Bool ewk_view_html_string_override_current_entry_load(Evas_Object* view, const char* html, const char* base_uri, const char* unreachable_url);
789
790 /**
791  * Sets whether to draw transparent background or not.
792  *
793  * @param o view object to enable/disable transparent background
794  * @param enabled a state to set
795  *
796  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
797  */
798 EXPORT_API Eina_Bool ewk_view_draws_transparent_background_set(Evas_Object *o, Eina_Bool enabled);
799
800 /**
801  * Creates a type name for the callback function used to get the page contents.
802  *
803  * @param o view object
804  * @param data mhtml data of the page contents
805  * @param user_data user data will be passed when ewk_view_mhtml_data_get is called
806  */
807 typedef void (*Ewk_View_MHTML_Data_Get_Callback)(Evas_Object *o, const char *data, void *user_data);
808
809 /**
810  * Get page contents as MHTML data
811  *
812  * @param o view object to get the page contents
813  * @param callback callback function to be called when the operation is finished
814  * @param user_data user data to be passed to the callback function
815  *
816  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
817  */
818 EXPORT_API Eina_Bool ewk_view_mhtml_data_get(Evas_Object *o, Ewk_View_MHTML_Data_Get_Callback callback, void *user_data);
819
820 /**
821  * Gets the minimum and maximum value of the scale range or -1 on failure
822  *
823  * @param o view object to get the minimum and maximum value of the scale range
824  * @param min_scale Pointer to an double in which to store the minimum scale factor of the object.
825  * @param max_scale Pointer to an double in which to store the maximum scale factor of the object.
826  *
827  * @note Use @c NULL pointers on the scale components you're not
828  * interested in: they'll be ignored by the function.
829  */
830 EXPORT_API void ewk_view_scale_range_get(Evas_Object* o, double* min_scale, double* max_scale);
831
832 /**
833  * Returns the evas image object of the specified viewArea of page
834  *
835  * The returned evas image object @b should be freed after use.
836  *
837  * @param o view object to get specified rectangle of cairo surface.
838  * @param viewArea rectangle of cairo surface.
839  * @param scaleFactor scale factor of cairo surface.
840  * @param canvas canvas for creating evas image.
841  *
842  * @return newly allocated evas image object on sucess or @c 0 on failure.
843  */
844 EXPORT_API Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* o, Eina_Rectangle viewArea, float scaleFactor, Evas* canvas);
845
846 /**
847  * Gets the possible scroll size of the given view.
848  *
849  * Possible scroll size is contents size minus the viewport size.
850  *
851  * @param o view object to get scroll size
852  * @param w the pointer to store the horizontal size that is possible to scroll,
853  *        may be @c 0
854  * @param h the pointer to store the vertical size that is possible to scroll,
855  *        may be @c 0
856  *
857  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise and
858  *         values are zeroed
859  */
860 EXPORT_API Eina_Bool ewk_view_scroll_size_get(const Evas_Object* o, int* w, int* h);
861
862 /**
863  * Clears the highlight of searched text.
864  *
865  * @param o view object to find text
866  *
867  * @return @c EINA_TRUE on success, @c EINA_FALSE on errors
868  */
869 EXPORT_API Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object *o);
870
871 /**
872  * Counts the given string in the document.
873  *
874  * This does not highlight the matched string and just count the matched string.\n
875  *
876  * As the search is carried out through the whole document,\n
877  * only the following #Ewk_Find_Options are valid.\n
878  *  - EWK_FIND_OPTIONS_NONE\n
879  *  - EWK_FIND_OPTIONS_CASE_INSENSITIVE\n
880  *  - EWK_FIND_OPTIONS_AT_WORD_START\n
881  *  - EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START\n
882  *
883  * The "text,found" callback will be called with the number of matched string.
884  *
885  * @since_tizen 2.3
886  *
887  * @param o view object to find text
888  * @param text text to find
889  * @param options options to find
890  * @param max_match_count maximum match count to find, unlimited if 0
891  *
892  * @return @c EINA_TRUE on success, @c EINA_FALSE on errors
893  */
894 EXPORT_API Eina_Bool ewk_view_text_matches_count(Evas_Object* o, const char* text, Ewk_Find_Options options, unsigned max_match_count);
895
896 /**
897  * Gets the current text zoom level.
898  *
899  * @param o view object to get the zoom level
900  *
901  * @return current zoom level in use on success or @c -1.0 on failure
902  */
903 EXPORT_API double ewk_view_text_zoom_get(const Evas_Object* o);
904
905 /**
906  * Sets the current text zoom level.
907  *
908  * @param o view object to set the zoom level
909  * @param textZoomFactor a new level to set
910  *
911  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
912  */
913 EXPORT_API Eina_Bool ewk_view_text_zoom_set(Evas_Object* o, double text_zoom_factor);
914
915 /**
916  * @brief Draw the evas image object for the VoiceManager
917  *
918  * @since_tizen 3.0
919  *
920  * @param[in] view the view object
921  * @param[in] image evas image obejct for drawing
922  * @param[in] rect rectangle of image object for drawing
923  */
924 EXPORT_API void ewk_view_voicemanager_label_draw(Evas_Object* view, Evas_Object* image, Eina_Rectangle rect);
925
926 /**
927  * @brief Hide and remove all labels for the VoiceManager
928  *
929  * @details All labels are cleared on mouse down.
930  *
931  * @since_tizen 3.0
932  *
933  * @param[in] view the view object
934  */
935 EXPORT_API void ewk_view_voicemanager_labels_clear(Evas_Object* view);
936
937 /**
938  * This api is used for Canal+ App and HBB TV Application.
939  * They need to access various url required a client authentication while the apps is running.
940  * So when XWalk call this API with host and related cert path, We store these information to map.
941  * After that, When we get the "Certificate Request" packet from server,
942  * We find matched cert path to host in the map.
943  *
944  * @param ewkView view object to add host and cert path to the map
945  * @param host host that required client authentication
946  * @param cert_path the file path stored certificate
947  *
948  */
949 EXPORT_API void ewk_view_add_dynamic_certificate_path(const Evas_Object *ewkView, const char* host, const char* cert_path);
950
951 /**
952  * @brief Request to set the atk usage set by web app(config.xml).
953  *
954  * Some TV apps use WebSpeech instead of use ATK for regulation U.S.FCC
955  *
956  * @since_tizen 3.0 @if TV   @endif
957  *
958  * @param[in] o View object to set the atk use.
959  * @param[in] enable EINA_TRUE to set on the atk use.
960  *            EINA_FALSE makes atk not to use, but app use WebSpeech instead of ATK.
961  *            The default value is EINA_FALSE.
962  */
963 EXPORT_API void ewk_view_atk_deactivation_by_app(Evas_Object* view, Eina_Bool enable);
964
965 /*
966  * Get cookies associated with an URL.
967  *
968  * @param o view object in which URL is opened.
969  * @param url the url for which cookies needs to be obtained.
970  *
971  * @return @c character array containing cookies, @c NULL if no cookies are found.
972  *
973  * The return character array has to be owned by the application and freed when not required.
974  */
975 EXPORT_API char* ewk_view_cookies_get(Evas_Object* o, const char* url);
976
977 /**
978  * @brief To give a chance to intercept request data before sending it.
979  *
980  * @since_tizen 2.3
981  *
982  * @param[in] o view object to intercept request
983  * @param[in] intercept_request Defined structure to notify requesting infomation
984  * @param[in] user_data user data
985  *
986  * @see ewk_view_intercept_request_callback_set()
987  */
988 typedef void (*Ewk_View_Intercept_Request_Callback)(Evas_Object* o, Ewk_Intercept_Request* intercept_request, void* user_data);
989
990 /**
991  * @brief  To set Ewk_View_Intercept_Request_Callback to give a chance to intercept request data before sending it.
992  *
993  * @since_tizen 2.3
994  *
995  * @param[in] o view object to intercept request
996  * @param[in] callback Defined callback
997  * @param[in] user_data user data
998  *
999  * @see Ewk_View_Intercept_Request_Callback
1000  */
1001 EXPORT_API void ewk_view_intercept_request_callback_set (Evas_Object* o, Ewk_View_Intercept_Request_Callback callback, void* user_data);
1002
1003 /**
1004  * @internal
1005  * @brief Callback for ewk_view_notification_show_callback_set
1006  *
1007  * @since_tizen 2.3
1008  *
1009  * @param[in] o view object to request the notification show
1010  * @param[in] notification Ewk_Notification object to get the information about notification show request
1011  * @param[in] user_data user data
1012  */
1013 typedef Eina_Bool (*Ewk_View_Notification_Show_Callback)(Evas_Object *o, Ewk_Notification *notification, void *user_data);
1014
1015 /**
1016  * @internal
1017  * @brief Sets the notification show callback.
1018  *
1019  * @since_tizen 2.3
1020  *
1021  * @param[in] o view object to request the notification show
1022  * @param[in] show_callback Ewk_View_Notification_Show_Callback function to notification show
1023  * @param[in] user_data user data
1024  */
1025 EXPORT_API void ewk_view_notification_show_callback_set(Evas_Object *o, Ewk_View_Notification_Show_Callback show_callback, void *user_data);
1026
1027 /**
1028  * @internal
1029  * @brief Callback for ewk_view_notification_cancel_callback_set
1030  *
1031  * @since_tizen 2.3
1032  *
1033  * @param[in] o view object to request the notification cancel
1034  * @param[in] notification_id Ewk_Notification object to get the information about notification cancel request
1035  * @param[in] user_data user data
1036  */
1037 typedef Eina_Bool (*Ewk_View_Notification_Cancel_Callback)(Evas_Object *o, uint64_t notification_id, void *user_data);
1038
1039 /**
1040  * @internal
1041  * @brief Sets the notification cancel callback.
1042  *
1043  * @since_tizen 2.3
1044  *
1045  * @param[in] o view object to request the notification show
1046  * @param[in] cancel_callback Ewk_View_Notification_Cancel_Callback function to notification cancel
1047  * @param[in] user_data user data
1048  */
1049 EXPORT_API void ewk_view_notification_cancel_callback_set(Evas_Object *o, Ewk_View_Notification_Cancel_Callback cancel_callback, void *user_data);
1050
1051 /**
1052 * @brief Gets the current custom character encoding name.
1053 *
1054 * @since_tizen 2.3
1055 *
1056 * @param[in] o view object to get the current encoding
1057 *
1058 * @return @c eina_strinshare containing the current encoding, or\n
1059 *         @c NULL if it's not set
1060 */
1061 EXPORT_API const char* ewk_view_custom_encoding_get(const Evas_Object* o);
1062
1063 /**
1064 * @brief Sets the custom character encoding and reloads the page.
1065 *
1066 * @since_tizen 2.3
1067 *
1068 * @param[in] o view to set the encoding
1069 * @param[in] encoding the new encoding to set or @c NULL to restore the default one
1070 *
1071 * @return @c EINA_TRUE on success @c EINA_FALSE otherwise
1072 */
1073 EXPORT_API Eina_Bool ewk_view_custom_encoding_set(Evas_Object* o, const char* encoding);
1074
1075 /**
1076 * @brief Forces web page to relayout
1077 *
1078 * @since_tizen 2.3
1079 *
1080 * @param [in] o view
1081 */
1082 EXPORT_API void ewk_view_force_layout(const Evas_Object* o);
1083
1084 /**
1085 * Creates a type name for the callback function used to get video current time.
1086 *
1087 * @param o view object
1088 * @param current time of the video
1089 *@param user_data user data will be passed when ewk_media_current_time_get
1090 *called
1091 */
1092 typedef void (*Ewk_View_Video_Current_Time_Get_Callback)(Evas_Object *o, double current_time, void *user_data);
1093
1094 /**
1095 * Gets the video's timestamp.
1096 *
1097 * @param o view object to get the video's timestamp
1098 *
1099 * @return timestamp value
1100 */
1101 EXPORT_API void ewk_media_current_time_get(const Evas_Object* o, Ewk_View_Video_Current_Time_Get_Callback callback, void *user_data);
1102
1103 /**
1104 * @brief Enforces web page to close
1105 *
1106 * @since_tizen 3.0
1107 *
1108 * @param[in] o view
1109 *
1110 * @return @c EINA_TRUE on success @c EINA_FALSE otherwise
1111 */
1112 EXPORT_API Eina_Bool ewk_view_page_close(Evas_Object* o);
1113
1114 /**
1115  * @brief Request to set the atk usage set by web app(config.xml).
1116  *
1117  * Some TV apps use WebSpeech instead of use ATK for regulation U.S.FCC
1118  *
1119  * @since_tizen 3.0 @if TV   @endif
1120  *
1121  * @param[in] o View object to set the atk use.
1122  * @param[in] enable EINA_TRUE to set on the atk use.
1123  *            EINA_FALSE makes atk not to use, but app use WebSpeech instead of
1124  * ATK.
1125  */
1126 EXPORT_API void ewk_view_atk_deactivation_by_app(Evas_Object* view, Eina_Bool enable);
1127
1128 typedef enum {
1129   EWK_TTS_MODE_DEFAULT = 0,      /**< Default mode for normal application */
1130   EWK_TTS_MODE_NOTIFICATION = 1, /**< Notification mode(it has same behavior
1131                                     with EWK_TTS_MODE_DEFAULT. not supported in
1132                                     vd) */
1133   EWK_TTS_MODE_SCREEN_READER =
1134       2 /**< Accessibiliity mode(TTS works only for accessibility mode) */
1135 } ewk_tts_mode;
1136
1137 /**
1138  * @brief Sets tts mode
1139  * up to tizen 4.0(in VD), default tts mode is EWK_TTS_MODE_SCREEN_READER.
1140  * so TTS api disabled when accessibility mode turn off.
1141  * this api provided to use tts api in none accessibility mode
1142  * (tts mode decided in chromium's init time. so it should be called in init
1143  * time) tts mode affect to below web apis speech_syntesis
1144  *
1145  * @since_tizen 4.0 @if TV   @endif
1146  *
1147  * @param[in] o View object to set.
1148  * @param[in] ewk_tts_mode.
1149  *
1150  */
1151 EXPORT_API Eina_Bool ewk_view_tts_mode_set(Evas_Object* view, ewk_tts_mode tts_mode);
1152
1153 /**
1154  * @brief Request to set the spatial navigation usage set by hbbtv
1155  *
1156  * @since_tizen 3.0
1157  *
1158  * @param[in] settings setting object
1159  * @param[in] enable @c EINA_TRUE enable to use spatial navigation
1160  *                   @c EINA_FALSE to disable
1161  */
1162 EXPORT_API void ewk_settings_spatial_navigation_enabled_set(Ewk_Settings* settings, Eina_Bool Enabled);
1163
1164 /**
1165  * Clear all tile resources.
1166  *
1167  * @param ewkView view object
1168  */
1169 EXPORT_API void ewk_view_clear_all_tiles_resources(Evas_Object* ewkView);
1170
1171 /**
1172  * @}
1173  */
1174
1175 #ifdef __cplusplus
1176 }
1177 #endif
1178 #endif // ewk_view_product_h