2 Copyright (C) 2016 Samsung Electronics. All rights reserved.
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
21 * @file ewk_view_product.h
22 * @brief Chromium main smart object.
24 * This object provides view related APIs of Chromium to EFL object.
27 #ifndef ewk_view_product_h
28 #define ewk_view_product_h
30 #include "ewk_context_product.h"
31 #include "ewk_view_internal.h"
33 #if defined(TIZEN_PEPPER_EXTENSIONS)
34 #include "ewk_value_product.h"
42 * A callback to check whether allowed to run mixed content or not
44 * @param ewkView view object
45 * @param user_data user_data will be passed when callback is called
46 * @return true: allow to run mixed content. false: not allow to run mixed content
48 typedef Eina_Bool (*Ewk_View_Run_Mixed_Content_Confirm_Callback)(Evas_Object* ewkView, void* user_data);
51 * @brief Creates a new EFL Chromium view object.
55 * @param[in] e canvas object where to create the view object
56 * @param[in] data a pointer to data to restore session data
57 * @param[in] length length of session data to restore session data
59 * @return view object on success or @c NULL on failure
61 EXPORT_API Evas_Object* ewk_view_add_with_session_data(Evas* e, const char* data, unsigned length);
64 * @brief Gets the reference object for frame that represents the main frame.
68 * @param[in] o view object to get main frame
70 * @return frame reference of frame object on success, or NULL on failure
72 EXPORT_API Ewk_Frame_Ref ewk_view_main_frame_get(Evas_Object* o);
75 * @brief Reply of javascript alert popup
79 * @param[in] o view object
81 EXPORT_API void ewk_view_javascript_alert_reply(Evas_Object* o);
84 * @brief Reply of javascript confirm popup
88 * @param[in] o view object
89 * @param[in] result result of javascript confirm popup
91 EXPORT_API void ewk_view_javascript_confirm_reply(Evas_Object* o, Eina_Bool result);
94 * @brief Reply of javascript prompt popup
98 * @param[in] o view object
99 * @param[in] result entered characters of javascript prompt popup
101 EXPORT_API void ewk_view_javascript_prompt_reply(Evas_Object* o, const char* result);
104 * @brief Sets callback of before unload popup
108 * @param[in] o view object to set the callback
109 * @param[in] callback callback function for before unload popoup
110 * @param[in] user_data user data
112 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);
115 * @brief Reply of before unload popup
119 * @param[in] o view object
120 * @param[in] result result of before unload popup
122 EXPORT_API void ewk_view_before_unload_confirm_panel_reply(Evas_Object* o, Eina_Bool result);
125 * @brief Sets callback of getting application cache permission.
129 * @param[in] o view object to set the callback of application cache permission
130 * @param[in] callback function to be called when application cache need to
132 * @param[in] user_data user data
134 EXPORT_API void ewk_view_application_cache_permission_callback_set(Evas_Object* o, Ewk_View_Applicacion_Cache_Permission_Callback callback, void* user_data);
137 * @brief Application cache permission confirm popup reply
141 * @param[in] o view object to reply permission confirm popup
142 * @param[in] allow of response
144 EXPORT_API void ewk_view_application_cache_permission_reply(Evas_Object* o, Eina_Bool allow);
147 * @brief Set to callback to controll unfocus operation from the arrow of
152 * @param[in] o view object
153 * @param[in] callback callback to controll unfocus operation from the arrow of
155 * @param[in] user_data user data
157 EXPORT_API void ewk_view_unfocus_allow_callback_set(Evas_Object* o, Ewk_View_Unfocus_Allow_Callback callback, void* user_data);
160 * @brief Requests loading the given contents.
164 * @param[in] o view object to load document
165 * @param[in] html what to load
166 * @param[in] base_uri base uri to use for relative resources, may be @c 0,\n
167 * if provided @b must be an absolute uri
169 * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors
171 EXPORT_API Eina_Bool ewk_view_html_contents_set(Evas_Object* o, const char* html, const char* base_uri);
174 * @brief Returns the evas image object for the cache image specified in url.
176 * @details The returned evas image object @b should be freed after use.
180 * @param[in] o view object to get specified rectangle of cairo surface
181 * @param[in] image_url url of the image in the cache
182 * @param[in] canvas canvas for creating evas image
184 * @return newly allocated evas image object on sucess or @c 0 on failure
186 EXPORT_API Evas_Object* ewk_view_cache_image_get(const Evas_Object* o, const char* image_url, Evas* canvas);
189 * @brief Requests for getting web application capable.
193 * @param[in] o view object
194 * @param[in] callback result callback to get web database quota
195 * @param[in] user_data user_data will be passed when result_callback is
196 * called\n -I.e., user data will be kept until callback is called
198 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
200 EXPORT_API Eina_Bool ewk_view_web_application_capable_get(Evas_Object* o, Ewk_Web_App_Capable_Get_Callback callback, void* user_data);
203 * @brief Requests for getting web application icon string.
207 * @param[in] o view object
208 * @param[in] callback result callback to get web database quota
209 * @param[in] user_data user_data will be passed when result_callback is
210 * called\n -I.e., user data will be kept until callback is called
212 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
214 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);
217 * @brief Requests for getting web application icon list of
218 * Ewk_Web_App_Icon_Data.
222 * @param[in] o view object
223 * @param[in] callback result callback to get web application icon urls
224 * @param[in] user_data user_data will be passed when result_callback is
225 * called\n -I.e., user data will be kept until callback is called
227 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
229 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);
232 * @brief Get the whole history(whole back & forward list) associated with this
237 * @param[in] o view object to get the history(whole back & forward list)
239 * @return a newly allocated history of @b newly allocated item\n
240 * instance. This memory of each item must be released with\n
241 * ewk_history_free() after use
243 * @see ewk_history_free()
245 EXPORT_API Ewk_History* ewk_view_history_get(Evas_Object* o);
248 * @brief Gets the selection ranges
252 * @param[in] o view object to get theselection ranges
253 * @param[out] left_rect the start lect(left rect) of the selection ranges
254 * @param[out] right_rect the end lect(right rect) of the selection ranges
256 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
258 EXPORT_API Eina_Bool ewk_view_text_selection_range_get(Evas_Object* o, Eina_Rectangle* left_rect, Eina_Rectangle* right_rect);
261 * @brief Sets the focused input element value
265 * @param[in] o view object to send the value
266 * @param[in] value the string value to be set
268 EXPORT_API void ewk_view_focused_input_element_value_set(Evas_Object* o, const char* value);
271 * @brief Gets the focused input element's value
275 * @param[in] o view object to get the value
277 * @return focused input element's value on success or NULL on failure
279 EXPORT_API const char* ewk_view_focused_input_element_value_get(Evas_Object* o);
282 * @brief Selects index of current popup menu.
286 * @param[in] o view object contains popup menu
287 * @param[in] index index of item to select
289 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably\n
290 * popup menu is not selected or index is out of range)
292 EXPORT_API Eina_Bool ewk_view_popup_menu_select(Evas_Object* o, unsigned int index);
295 * @brief Selects Multiple indexes of current popup menu.
299 * @param[in] o view object contains popup menu.
300 * @param[in] changed_list list of item selected and deselected
302 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably\n
303 * popup menu is not selected or index is out of range)
305 EXPORT_API Eina_Bool ewk_view_popup_menu_multiple_select(Evas_Object* o, Eina_Inarray* changed_list);
308 * @brief Sets the user chosen color. To be used when implementing a color
311 * @details The function should only be called when a color has been requested
312 * by the document.\n If called when this is not the case or when the
313 * input picker has been dismissed, this\n function will fail and
318 * @param[in] o view object contains color picker
319 * @param[in] r red channel value to be set
320 * @param[in] g green channel value to be set
321 * @param[in] b blue channel value to be set
322 * @param[in] a alpha channel value to be set
324 * @return @c EINA_TRUE on success @c EINA_FALSE otherwise
326 EXPORT_API Eina_Bool ewk_view_color_picker_color_set(Evas_Object* o, int r, int g, int b, int a);
329 * @brief Feeds the touch event to the view.
333 * @param[in] o view object to feed touch event
334 * @param[in] type the type of touch event
335 * @param[in] points a list of points (Ewk_Touch_Point) to process
336 * @param[in] modifiers an Evas_Modifier handle to the list of modifier keys\n
337 * registered in the Evas. Users can get the Evas_Modifier from the
338 * Evas\n using evas_key_modifier_get() and can set each modifier key
339 * using\n evas_key_modifier_on() and evas_key_modifier_off()
341 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
343 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);
346 * Creates a type name for the callback function used to get the background color.
348 * @param o view object
349 * @param r red color component
350 * @param g green color component
351 * @param b blue color component
352 * @param a transparency
353 * @param user_data user data will be passed when ewk_view_bg_color_get is called
355 typedef void (*Ewk_View_Background_Color_Get_Callback)(Evas_Object *o, int r, int g, int b, int a, void* user_data);
358 * Gets the background color and transparency of the view.
360 * @param o view object to get the background color from
361 * @param callback callback function
362 * @param user_data user data will be passed when the callback is called
364 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
366 * On success the background color of the view object o is retrieved
367 * in the callback function
369 EXPORT_API Eina_Bool ewk_view_bg_color_get(Evas_Object *o, Ewk_View_Background_Color_Get_Callback callback, void *user_data);
372 * @brief Sets the visibility of main frame scrollbar.
376 * @param[in] o view object
377 * @param[in] visible visibility of main frame scrollbar
379 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
381 EXPORT_API Eina_Bool ewk_view_main_frame_scrollbar_visible_set(Evas_Object* o, Eina_Bool visible);
384 * Callback for ewk_view_main_frame_scrollbar_visible_get
386 * @param o view object
387 * @param visibility visibility of main frame scrollbar
388 * @param user_data user data passed to ewk_view_main_frame_scrollbar_visible_get
390 typedef void (*Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback)(Evas_Object* o, Eina_Bool visible, void* user_data);
393 * @brief Gets the visibility of main frame scrollbar.
397 * @param[in] o view object
398 * @param callback callback function
399 * @param user_data user data will be passed when the callback is caller
401 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
403 * On success the visibility of the scrollbar of the view object o is retrieved
404 * in the callback function
406 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);
409 * @brief Gets the session data to be saved in a persistent store on
414 * @param[in] o view object whose session needs to be stored.
415 * @param[in] data out parameter session data
416 * @param[in] length out parameter length of session data
418 EXPORT_API void ewk_view_session_data_get(Evas_Object* o, const char** data, unsigned* length);
421 * @brief Reloads the current page's document without cache.
425 * @param[in] o view object to reload current document
427 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
429 EXPORT_API Eina_Bool ewk_view_reload_bypass_cache(Evas_Object* o);
432 * @brief Creates a new hit test for the given veiw object and point.
436 * @remarks The returned object should be freed by ewk_hit_test_free().
438 * @param[in] o view object to do hit test on
439 * @param[in] x the horizontal position to query
440 * @param[in] y the vertical position to query
441 * @param[in] hit_test_mode the #Ewk_Hit_Test_Mode enum value to query
443 * @return a newly allocated hit test on success, @c 0 otherwise
445 EXPORT_API Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* o, int x, int y, int hit_test_mode);
448 * Create PDF file of page contents
450 * @param o view object to get page contents.
451 * @param width the suface width of PDF file.
452 * @param height the suface height of PDF file.
453 * @param fileName the file name for creating PDF file.
455 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
457 /* This return value is status of the request not the status of actual operation.
458 * There should be some callback to get the actual status or reason of failure.
460 EXPORT_API Eina_Bool ewk_view_contents_pdf_get(Evas_Object* o, int width, int height, const char* fileName);
463 * Requests for setting callback function
465 * @param ewkView view object
466 * @param user_data user_data will be passed when callback is called
467 * @param callback callback function
469 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);
472 * Returns the current favicon of view object.
474 * @param item view object to get current icon URL
476 * @return current favicon on success or @c NULL if unavailable or on failure.
477 * The returned Evas_Object needs to be freed after use.
479 EXPORT_API Evas_Object *ewk_view_favicon_get(const Evas_Object *item);
482 * To resume new url network loading
484 * @param item view object to resume new url loading
487 EXPORT_API void ewk_view_resume_network_loading(Evas_Object* item);
489 EXPORT_API void ewk_view_poweroff_suspend(Evas_Object *item);
492 * To suspend all url loading
494 * @param item view object to suspend url loading
497 EXPORT_API void ewk_view_suspend_network_loading(Evas_Object* item);
500 * This function should be use for browser edge scroll.
501 * It can also be used when the mouse pointer is out of webview.
502 * Scrolls webpage of view by dx and dy.
504 * @param item view object to scroll
505 * @param dx horizontal offset to scroll
506 * @param dy vertical offset to scroll
507 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
509 EXPORT_API Eina_Bool ewk_view_edge_scroll_by(Evas_Object *item, int dx, int dy);
512 * Allow a browser to set its own cursor by setting a flag
513 * which prevents setting a default web page cursor.
515 * @param ewkView view object
516 * @param enable EINA_TRUE - prevent update of cursor by engine
517 * EINA_FALSE - allow for update of cursor by engine
519 EXPORT_API void ewk_view_set_cursor_by_client(Evas_Object* ewkView, Eina_Bool enable);
522 * Reply of running mixed content or not
524 * @param ewkView view object
525 * @param result reply
527 EXPORT_API void ewk_view_run_mixed_content_confirm_reply(Evas_Object* ewkView, Eina_Bool result);
530 * Sets the cover-area (soon rect) multiplier.
532 * @param ewkView view object
533 * @param coverAreaMultiplier the multiplier of cover-area.
535 EXPORT_API void ewk_view_tile_cover_area_multiplier_set(
536 Evas_Object* ewkView,
537 float cover_area_multiplier);
540 * Set to enabled/disabled clear tiles on hide.
542 * @param ewkView view object
543 * @param enabled/disabled a state to set
546 EXPORT_API void ewk_view_clear_tiles_on_hide_enabled_set(Evas_Object* ewkView,
550 * @brief Callback for ewk_view_is_video_playing
552 * @param[in] o the view object
553 * @param[in] is_playing video is playing or not
554 * @param[in] user_data user_data will be passsed when ewk_view_is_video_playing is
557 typedef void (*Ewk_Is_Video_Playing_Callback)(Evas_Object* o, Eina_Bool is_playing, void* user_data);
560 * @brief Asynchronous request for check if there is a video playing in the given view
562 * @param[in] o The view object
563 * @param[in] callback result callback to get web application capable
564 * @param[in] user_data user_data will be passed when result_callback is called
566 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
568 EXPORT_API Eina_Bool ewk_view_is_video_playing(Evas_Object* o, Ewk_Is_Video_Playing_Callback callback, void* user_data);
571 * Callback for ewk_view_stop_video
573 * @param o view object
574 * @param is_stopped video is stopped or not
575 * @param user_data user_data will be passsed when ewk_view_stop_video is called
577 typedef void (*Ewk_Stop_Video_Callback)(Evas_Object* o, Eina_Bool is_stopped, void* user_data);
580 * Asynchronous request for stopping any playing video in the given view
582 * @param[in] o The view object
583 * @param[in] callback result callback to get web application capable
584 * @param[in] user_data user_data will be passed when result_callback is called
586 * @return @c EINA_TRUE if any video was stopped or @c EINA_FALSE is there was no active video
588 EXPORT_API Eina_Bool ewk_view_stop_video(Evas_Object* o, Ewk_Stop_Video_Callback callback, void* user_data);
591 * @brief Sets the support of video hole and video window, Use H/W overlay for performance of video output
595 * @param[in] o the view object
596 * @param[in] o the top-level window object
597 * @param[in] enable EINA_TRUE to set on support the video hole,
598 * EINA_FALSE otherwise
599 * @param[in] enable EINA_TRUE to set on the video window of video hole,
600 * EINA_FALSE to set on the video windowless of video hole
602 * @return return @c EINA_TRUE on success or @c EINA_FALSE on failure
604 EXPORT_API Eina_Bool ewk_view_set_support_video_hole(Evas_Object* ewkView, Evas_Object* window, Eina_Bool enable, Eina_Bool isVideoWindow);
606 #if defined(TIZEN_PEPPER_EXTENSIONS)
609 * Callback for the generic sync call.
610 * It requests for performing operation/call giving its name. Arguments
611 * and return value is operation/call specific.
613 * @param[in] name requested call name
614 * @param[in] arguments call argumets, format is defined by opertion itself
615 * @param[in] user_data user_data will be passed when result_callback is called
617 * @return return value from the call, format is defind by operation itself
619 typedef Ewk_Value (*Generic_Sync_Call_Callback)(const char* name, Ewk_Value arguments, void* user_data);
622 * Sets the function pointer for the generic sync call
624 * @param ewk_view view object to set the function pointer in
625 * @param cb pointer to the function
626 * @param user_data pointer to user data to be passed to the function when
629 EXPORT_API void ewk_view_widget_pepper_extension_callback_set(Evas_Object* ewk_view, Generic_Sync_Call_Callback cb, void* user_data);
632 * Sets the pepper widget extension info
634 * @param ewk_view view object to set the info in
635 * @param widget_pepper_ext_info the Ewk_Value containing the information
637 EXPORT_API void ewk_view_widget_pepper_extension_info_set(Evas_Object* ewk_view, Ewk_Value widget_pepper_ext_info);
639 #endif // defined(TIZEN_PEPPER_EXTENSIONS)
642 * @brief Sends key event.
646 * @param[in] o The view object
647 * @param[in] key_event Evas_Event_Key_Down struct or Evas_Event_Key_Up struct
648 * @param[in] isPress EINA_TRUE: keydown, EINA_FALSE: keyup
649 * @return @c EINA_TRUE on success,\n
650 * otherwise @c EINA_FALSE
652 EXPORT_API Eina_Bool ewk_view_send_key_event(Evas_Object* o, void* key_event, Eina_Bool is_press);
655 * @brief Sets whether the ewk_view supports the key events or not.
659 * @note Should be used after ewk_view_url_set().
661 * @remarks The ewk_view will support the key events if EINA_TRUE or not support the
662 * key events otherwise. The default value is EINA_TRUE.
664 * @param[in] o The view object
665 * @param[in] enabled a state to set
667 * @return @c EINA_TRUE on success,\n
668 * otherwise @c EINA_FALSE
670 EXPORT_API Eina_Bool ewk_view_key_events_enabled_set(Evas_Object *o, Eina_Bool enabled);
673 * @brief Adds an item to back forward list
677 * @param[in] o The view object
678 * @param[in] item The back-forward list item instance
679 * @return @c EINA_TRUE on success,\n
680 * otherwise @c EINA_FALSE
683 ewk_view_add_item_to_back_forward_list(Evas_Object* o,
684 const Ewk_Back_Forward_List_Item* item);
687 * @brief To give a chance to intercept request data before sending it.
691 * @param[in] o view object to intercept request
692 * @param[in] intercept_request Defined structure to notify requesting infomation
693 * @param[in] user_data user data
695 * @see ewk_view_intercept_request_callback_set()
697 typedef void (*Ewk_View_Intercept_Request_Callback)(Evas_Object* o, Ewk_Intercept_Request* intercept_request, void* user_data);
700 * @brief To set Ewk_View_Intercept_Request_Callback to give a chance to intercept request data before sending it.
704 * @param[in] o view object to intercept request
705 * @param[in] callback Defined callback
706 * @param[in] user_data user data
708 * @see Ewk_View_Intercept_Request_Callback
710 EXPORT_API void ewk_view_intercept_request_callback_set (Evas_Object* o, Ewk_View_Intercept_Request_Callback callback, void* user_data);
719 #endif // ewk_view_product_h