2 * Copyright (C) 2009-2010 ProFUSION embedded systems
3 * Copyright (C) 2009-2016 Samsung Electronics. All rights reserved.
4 * Copyright (C) 2012 Intel Corporation
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this library; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "ewk_view_product.h"
26 #include "authentication_challenge_popup.h"
27 #include "base/trace_event/ttrace.h"
28 #include "content/public/browser/navigation_controller.h"
29 #include "cookie_manager.h"
30 #include "eweb_view.h"
31 #include "geolocation_permission_popup.h"
32 #include "notification_permission_popup.h"
33 #include "private/ewk_back_forward_list_private.h"
34 #include "private/ewk_context_private.h"
35 #include "private/ewk_frame_private.h"
36 #include "private/ewk_history_private.h"
37 #include "private/ewk_hit_test_private.h"
38 #include "private/ewk_notification_private.h"
39 #include "private/ewk_private.h"
40 #include "private/ewk_quota_permission_request_private.h"
41 #include "private/ewk_view_private.h"
42 #include "public/ewk_back_forward_list.h"
43 #include "public/ewk_context.h"
44 #include "public/ewk_enums_internal.h"
45 #include "public/ewk_settings.h"
46 #include "third_party/blink/public/common/page/page_zoom.h"
47 #include "third_party/blink/public/common/web_preferences/web_preferences.h"
48 #include "ui/events/gesture_detection/gesture_configuration.h"
50 #include "usermedia_permission_popup.h"
51 #include "web_contents_delegate_efl.h"
53 #if defined(TIZEN_WEB_SPEECH_RECOGNITION)
54 #include "content/browser/speech/tts_platform_impl_tizen.h"
56 #if defined(TIZEN_VIDEO_HOLE)
57 #include "tizen_src/chromium_impl/media/base/tizen/video_plane_controller.h"
60 static Eina_Bool _ewk_view_default_user_media_permission(
61 Evas_Object*, Ewk_User_Media_Permission_Request*, void*);
63 static Eina_Bool _ewk_view_default_geolocation_permission(
64 Evas_Object*, Ewk_Geolocation_Permission_Request*, void*);
66 static Eina_Bool _ewk_view_default_notification_permission(
67 Evas_Object*, Ewk_Notification_Permission_Request*, void*);
69 static void _ewk_view_default_authentication(
70 Evas_Object*, Ewk_Auth_Challenge*, void*);
72 Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api)
74 EINA_SAFETY_ON_NULL_RETURN_VAL(api, false);
75 return InitSmartClassInterface(*api);
78 // TODO: Evas_Object *ewk_view_smart_add(Evas *e, Evas_Smart *smart, Ewk_Context *context, Ewk_Page_Group *pageGroup)
80 Evas_Object* ewk_view_add_with_session_data(Evas* canvas, const char* data, unsigned length)
82 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, NULL);
84 Evas_Object* ret = ewk_view_add(canvas);
86 EWebView *webView = GetWebViewFromEvasObject(ret);
88 if (!webView || !data || !length)
91 if (webView->RestoreFromSessionData(data, length))
99 Evas_Object* ewk_view_add_with_context(Evas* e, Ewk_Context* context)
101 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
102 Evas_Object* ewk_view = CreateWebViewAsEvasObject(context, e);
105 #if !BUILDFLAG(IS_TIZEN_TV)
106 ewk_view_user_media_permission_callback_set(ewk_view,
107 _ewk_view_default_user_media_permission, 0);
109 ewk_view_geolocation_permission_callback_set(ewk_view,
110 _ewk_view_default_geolocation_permission, 0);
111 ewk_view_notification_permission_callback_set(ewk_view,
112 _ewk_view_default_notification_permission, 0);
113 ewk_view_authentication_callback_set(ewk_view,
114 _ewk_view_default_authentication, nullptr);
120 Evas_Object* ewk_view_add(Evas* e)
122 EINA_SAFETY_ON_NULL_RETURN_VAL(e, NULL);
123 // TODO: shouldn't this function create new EWebContext for each new EWebView?
124 // when using default context like that it makes unclear who should release
125 // default web context. It won't be released by destroyed eweb_view because
126 // ewk_context_default_get does AddRef
127 Ewk_Context* context = ewk_context_default_get();
128 return ewk_view_add_with_context(e, context);
131 Evas_Object* ewk_view_add_in_incognito_mode(Evas* e)
133 EINA_SAFETY_ON_NULL_RETURN_VAL(e, nullptr);
134 Ewk_Context* context = Ewk_Context::IncognitoContext();
135 EINA_SAFETY_ON_NULL_RETURN_VAL(context, nullptr);
136 return ewk_view_add_with_context(e, context);
139 Ewk_Context *ewk_view_context_get(const Evas_Object *view)
141 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
142 return static_cast<Ewk_Context*>(impl->context());
145 Eina_Bool ewk_view_url_set(Evas_Object* view, const char* url_string)
147 TTRACE_WEB("ewk_view_url_set url: %s", url_string);
148 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
149 EINA_SAFETY_ON_NULL_RETURN_VAL(url_string, false);
150 GURL url(url_string);
151 impl->SetURL(url, true);
155 const char* ewk_view_url_get(const Evas_Object* view)
157 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
158 return impl->GetURL().possibly_invalid_spec().c_str();
161 const char* ewk_view_original_url_get(const Evas_Object* view)
163 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
164 return impl->GetOriginalURL().possibly_invalid_spec().c_str();
167 Eina_Bool ewk_view_reload(Evas_Object *view)
169 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
175 Eina_Bool ewk_view_reload_bypass_cache(Evas_Object *view)
177 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
178 impl->ReloadBypassingCache();
182 Eina_Bool ewk_view_stop(Evas_Object* view)
184 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
190 Ewk_Settings *ewk_view_settings_get(const Evas_Object *ewkView)
192 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl,0);
193 return impl->GetSettings();
196 const char* ewk_view_title_get(const Evas_Object* view)
198 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
199 return impl->GetTitle();
202 double ewk_view_load_progress_get(const Evas_Object* view)
204 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, -1);
205 return impl->GetProgressValue();
208 Eina_Bool ewk_view_scale_set(Evas_Object* view, double scale_factor, int x, int y)
210 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
211 impl->SetScale(scale_factor);
212 impl->SetScroll(x, y);
216 void ewk_view_scale_changed_callback_set(
218 Ewk_View_Scale_Changed_Callback callback,
220 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
221 impl->SetScaleChangedCallback(callback, user_data);
224 double ewk_view_scale_get(const Evas_Object *view)
226 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, -1);
227 return impl->GetScale();
230 Eina_Bool ewk_view_back(Evas_Object *view)
232 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
233 return impl->GoBack();
236 Eina_Bool ewk_view_forward(Evas_Object *view)
238 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
239 return impl->GoForward();
242 Eina_Bool ewk_view_back_possible(Evas_Object *view)
244 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
245 return impl->CanGoBack();
248 Eina_Bool ewk_view_forward_possible(Evas_Object *view)
250 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
251 return impl->CanGoForward();
254 Eina_Bool ewk_view_web_login_request(Evas_Object* ewkView)
256 LOG_EWK_API_MOCKUP();
260 Eina_Bool ewk_view_html_string_load(Evas_Object* view, const char* html, const char* base_uri, const char* unreachable_uri)
262 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
263 EINA_SAFETY_ON_NULL_RETURN_VAL(html, EINA_FALSE);
264 impl->LoadHTMLString(html, base_uri, unreachable_uri);
268 Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object *view, Eina_Bool enabled)
270 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
272 impl->SetMouseEventsEnabled(!!enabled);
277 Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object *view)
279 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
281 return impl->MouseEventsEnabled();
284 Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, int b, int a)
286 LOG_EWK_API_MOCKUP();
290 double ewk_view_text_zoom_get(const Evas_Object* view)
292 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, -1.0);
293 return impl->GetTextZoomFactor();
296 Eina_Bool ewk_view_text_zoom_set(Evas_Object* view, double text_zoom_level)
298 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
299 if (ewk_settings_text_zoom_enabled_get(ewk_view_settings_get(view))) {
300 impl->SetTextZoomFactor(text_zoom_level);
306 void ewk_view_not_found_error_page_load(Evas_Object* ewkView, const char* errorUrl)
308 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
309 impl->LoadNotFoundErrorPage(std::string(errorUrl));
312 void ewk_view_scale_range_get(Evas_Object* view, double* min_scale, double* max_scale)
314 if (!min_scale && !max_scale)
317 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
318 impl->GetPageScaleRange(min_scale, max_scale);
321 void ewk_view_suspend(Evas_Object* ewkView)
323 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
327 void ewk_view_resume(Evas_Object* ewkView)
329 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
333 Eina_Bool ewk_view_url_request_set(Evas_Object* ewkView, const char* url, Ewk_Http_Method method, Eina_Hash* headers, const char* body)
335 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
336 EINA_SAFETY_ON_NULL_RETURN_VAL(url, EINA_FALSE);
337 content::NavigationController::LoadURLType loadtype;
339 case EWK_HTTP_METHOD_GET:
340 loadtype = content::NavigationController::LOAD_TYPE_DEFAULT;
342 case EWK_HTTP_METHOD_POST:
343 loadtype = content::NavigationController::LOAD_TYPE_HTTP_POST;
346 LOG(ERROR) << "Not supported HTTP Method.";
350 impl->UrlRequestSet(url, loadtype, headers, body);
354 Eina_Bool ewk_view_plain_text_set(Evas_Object* view, const char* plain_text)
356 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
357 EINA_SAFETY_ON_NULL_RETURN_VAL(plain_text, EINA_FALSE);
358 impl->LoadPlainTextString(plain_text);
362 Eina_Bool ewk_view_contents_set(Evas_Object* view, const char* contents, size_t contents_size, char* mime_type, char* encoding, char* base_uri)
364 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
365 EINA_SAFETY_ON_NULL_RETURN_VAL(contents, EINA_FALSE);
366 impl->LoadData(contents, contents_size, mime_type, encoding, base_uri);
370 Eina_Bool ewk_view_html_contents_set(Evas_Object* view, const char* html, const char* base_uri)
372 return ewk_view_html_string_load(view, html, base_uri, NULL);
375 Eina_Bool ewk_view_page_visibility_state_set(Evas_Object* ewkView, Ewk_Page_Visibility_State page_visibility_state, Eina_Bool initial_state)
377 // TODO: Should we send initial_state to |Page::setVisibilityState()|?.
378 // isInitialState parameter seems be true only in the constructor of WebViewImpl.
379 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
381 return impl->SetPageVisibility(page_visibility_state);
384 Eina_Bool ewk_view_user_agent_set(Evas_Object* ewkView, const char* user_agent)
386 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
388 return impl->SetUserAgent(user_agent);
391 const char* ewk_view_user_agent_get(const Evas_Object* ewkView)
393 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
394 return impl->GetUserAgent();
397 Eina_Bool ewk_view_application_name_for_user_agent_set(Evas_Object* ewkView, const char* application_name)
399 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
400 return impl->SetUserAgentAppName(application_name);
403 const char* ewk_view_application_name_for_user_agent_get(const Evas_Object* ewkView)
405 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
406 return eina_stringshare_add(impl->GetUserAgentAppName());
409 Eina_Bool ewk_view_custom_header_add(const Evas_Object* ewkView, const char* name, const char* value)
411 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
412 EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
413 EINA_SAFETY_ON_NULL_RETURN_VAL(value, EINA_FALSE);
414 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(),EINA_FALSE);
415 return impl->context()->HTTPCustomHeaderAdd(name, value);
418 Eina_Bool ewk_view_custom_header_remove(const Evas_Object* ewkView, const char* name)
420 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
421 EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
422 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(),EINA_FALSE);
423 return impl->context()->HTTPCustomHeaderRemove(name);
427 Eina_Bool ewk_view_custom_header_clear(const Evas_Object* ewkView)
429 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
430 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(),EINA_FALSE);
431 impl->context()->HTTPCustomHeaderClear();
436 Eina_Bool ewk_view_visibility_set(Evas_Object* view, Eina_Bool enable)
438 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
439 return impl->SetVisibility(enable);
442 Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* view, Eina_Rectangle view_area, float scale_factor, Evas* canvas)
444 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, NULL);
445 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, NULL);
446 return impl->GetSnapshot(view_area, scale_factor);
449 Eina_Bool ewk_view_screenshot_contents_get_async(const Evas_Object* view, Eina_Rectangle view_area,
450 float scale_factor, Evas* canvas, Ewk_Web_App_Screenshot_Captured_Callback callback, void* user_data)
452 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
453 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
454 return impl->GetSnapshotAsync(view_area, callback, user_data, scale_factor)
459 unsigned int ewk_view_inspector_server_start(Evas_Object* ewkView, unsigned int port)
461 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
462 return impl->StartInspectorServer(port);
465 Eina_Bool ewk_view_inspector_server_stop(Evas_Object* ewkView)
467 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
468 return impl->StopInspectorServer();
471 Eina_Bool ewk_view_cache_image_get(const Evas_Object* o, const char* image_url, Evas* canvas, Ewk_View_Cache_Image_Get_Callback callback, void* user_data)
473 LOG_EWK_API_MOCKUP();
477 void ewk_view_scroll_by(Evas_Object* ewkView, int deltaX, int deltaY)
481 if (EINA_TRUE == ewk_view_scroll_pos_get(ewkView, &x, &y)) {
482 ewk_view_scroll_set(ewkView, x + deltaX, y + deltaY);
486 Eina_Bool ewk_view_scroll_pos_get(Evas_Object* ewkView, int* x, int* y)
488 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
489 return impl->GetScrollPosition(x, y);
492 Eina_Bool ewk_view_scroll_set(Evas_Object* view, int x, int y)
494 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
495 impl->SetScroll(x, y);
500 Eina_Bool ewk_view_scroll_size_get(const Evas_Object* view, int* width, int* height)
506 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
507 impl->GetScrollSize(width,height);
511 void ewk_view_clear_tiles_on_hide_enabled_set(Evas_Object* ewkView, Eina_Bool enable)
513 LOG_EWK_API_MOCKUP();
516 void ewk_view_password_confirm_popup_callback_set(Evas_Object* view, Ewk_View_Password_Confirm_Popup_Callback callback, void* user_data)
518 LOG_EWK_API_MOCKUP();
521 void ewk_view_password_confirm_popup_reply(Evas_Object* ewkView, Ewk_Password_Popup_Option result)
523 LOG_EWK_API_MOCKUP();
526 void ewk_view_javascript_alert_callback_set(Evas_Object* view, Ewk_View_JavaScript_Alert_Callback callback, void* user_data)
528 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
530 impl->SetJavaScriptAlertCallback(callback, user_data);
533 void ewk_view_javascript_alert_reply(Evas_Object* view)
535 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
536 impl->JavaScriptAlertReply();
539 void ewk_view_javascript_confirm_callback_set(Evas_Object* view, Ewk_View_JavaScript_Confirm_Callback callback, void* user_data)
541 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
543 impl->SetJavaScriptConfirmCallback(callback, user_data);
546 void ewk_view_javascript_confirm_reply(Evas_Object* view, Eina_Bool result)
548 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
549 impl->JavaScriptConfirmReply(result);
552 void ewk_view_javascript_prompt_callback_set(Evas_Object* view, Ewk_View_JavaScript_Prompt_Callback callback, void* user_data)
554 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
556 impl->SetJavaScriptPromptCallback(callback, user_data);
559 void ewk_view_javascript_prompt_reply(Evas_Object* view, const char* result)
561 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
562 impl->JavaScriptPromptReply(result);
565 void ewk_view_before_unload_confirm_panel_callback_set(Evas_Object* ewkView, Ewk_View_Before_Unload_Confirm_Panel_Callback callback, void* userData)
567 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
568 EINA_SAFETY_ON_NULL_RETURN(callback);
569 impl->SetBeforeUnloadConfirmPanelCallback(callback, userData);
572 void ewk_view_before_unload_confirm_panel_reply(Evas_Object* ewkView, Eina_Bool result)
574 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
575 impl->ReplyBeforeUnloadConfirmPanel(result);
578 Eina_Bool ewk_view_web_application_capable_get(Evas_Object* ewkView, Ewk_Web_App_Capable_Get_Callback callback, void* userData)
580 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
581 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
582 return impl->WebAppCapableGet(callback, userData) ? EINA_TRUE : EINA_FALSE;
585 Eina_Bool ewk_view_web_application_icon_url_get(Evas_Object* ewkView, Ewk_Web_App_Icon_URL_Get_Callback callback, void* userData)
587 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
588 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
589 return impl->WebAppIconUrlGet(callback, userData) ? EINA_TRUE : EINA_FALSE;
592 Eina_Bool ewk_view_web_application_icon_urls_get(Evas_Object* ewkView, Ewk_Web_App_Icon_URLs_Get_Callback callback, void* userData)
594 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
595 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
596 return impl->WebAppIconUrlsGet(callback, userData) ? EINA_TRUE : EINA_FALSE;
599 Eina_Bool ewk_view_command_execute(Evas_Object* view, const char* command, const char* value)
601 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
602 EINA_SAFETY_ON_NULL_RETURN_VAL(command, false);
603 impl->ExecuteEditCommand(command, value);
607 Eina_Bool ewk_view_contents_size_get(const Evas_Object* view, Evas_Coord* width, Evas_Coord* height)
614 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
615 Eina_Rectangle contents_size = impl->GetContentsSize();
618 *width = contents_size.w;
620 *height = contents_size.h;
625 Eina_Bool ewk_view_contents_pdf_get(Evas_Object* view, int width, int height, const char* fileName)
627 EINA_SAFETY_ON_NULL_RETURN_VAL(fileName, EINA_FALSE);
628 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
629 return impl->SaveAsPdf(width, height, fileName);
632 Eina_Bool ewk_view_script_execute(Evas_Object* ewkView, const char* script, Ewk_View_Script_Execute_Callback callback, void* user_data)
634 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
635 EINA_SAFETY_ON_NULL_RETURN_VAL(script, false);
636 // callback can be null, so do not test it for null
637 if (0 != strcmp(script, "")) //check for empty string
638 return impl->ExecuteJavaScript(script, callback, user_data);
643 Eina_Bool ewk_view_plain_text_get(Evas_Object* view, Ewk_View_Plain_Text_Get_Callback callback, void* user_data)
645 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
646 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
647 return (impl->PlainTextGet(callback, user_data));
650 Eina_Bool ewk_view_mhtml_data_get(Evas_Object *view, Ewk_View_MHTML_Data_Get_Callback callback, void *user_data)
652 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
653 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
654 return impl->GetMHTMLData(callback, user_data);
657 Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* ewkView, int x, int y, int hit_test_mode)
659 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
660 return impl->RequestHitTestDataAt(x, y,
661 static_cast<Ewk_Hit_Test_Mode>(hit_test_mode));
664 Eina_Bool ewk_view_hit_test_request(Evas_Object* o, int x, int y, int hit_test_mode, Ewk_View_Hit_Test_Request_Callback callback, void* user_data)
666 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
667 return impl->AsyncRequestHitTestDataAt(x, y, static_cast<Ewk_Hit_Test_Mode>(hit_test_mode), callback, user_data);
670 Ewk_History* ewk_view_history_get(Evas_Object* ewkView)
672 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, NULL);
673 return impl->GetBackForwardHistory();
676 Eina_Bool ewk_view_notification_closed(Evas_Object* ewkView, Eina_List* notification_list)
681 Eina_Bool ewk_view_popup_menu_select(Evas_Object* ewkView, unsigned int selectedIndex)
683 LOG_EWK_API_MOCKUP();
687 Eina_Bool ewk_view_popup_menu_multiple_select(Evas_Object* ewkView, Eina_Inarray* changeList)
689 LOG_EWK_API_MOCKUP();
693 void ewk_view_orientation_send(Evas_Object* ewkView, int orientation)
695 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
696 impl->SetOrientation(orientation);
699 void ewk_view_encoding_custom_set(Evas_Object* ewkView, const char* encoding)
701 // Chromium does not support this feature hence the comment
702 LOG_EWK_API_MOCKUP("Not Supported by chromium");
705 Eina_Bool ewk_view_text_selection_range_get(const Evas_Object* view, Eina_Rectangle* left_rect, Eina_Rectangle* right_rect)
707 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
708 if (left_rect && right_rect && impl->GetSelectionRange(left_rect, right_rect)) {
710 evas_object_geometry_get(view, &x, &y, 0, 0);
720 Eina_Bool ewk_view_text_selection_clear(Evas_Object *view)
722 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
723 return impl->ClearSelection();
726 const char* ewk_view_text_selection_text_get(Evas_Object* view)
728 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, NULL);
729 return impl->CacheSelectedText();
732 void ewk_view_focused_input_element_value_set(Evas_Object* ewkView, const char* value)
734 LOG_EWK_API_MOCKUP();
737 const char* ewk_view_focused_input_element_value_get(Evas_Object* ewkView)
739 LOG_EWK_API_MOCKUP();
743 Eina_Bool ewk_view_horizontal_panning_hold_get(Evas_Object* ewkView) {
744 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
745 return impl->GetHorizontalPanningHold();
748 void ewk_view_horizontal_panning_hold_set(Evas_Object* ewkView,
750 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
751 impl->SetHorizontalPanningHold(hold);
754 Eina_Bool ewk_view_vertical_panning_hold_get(Evas_Object* ewkView)
756 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
757 return impl->GetVerticalPanningHold();
760 void ewk_view_vertical_panning_hold_set(Evas_Object* view, Eina_Bool hold) {
761 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
762 impl->SetVerticalPanningHold(hold);
765 void ewk_view_orientation_lock_callback_set(Evas_Object* ewkView, Ewk_Orientation_Lock_Cb func, void* data)
767 LOG_EWK_API_MOCKUP("This API is deprecated, to use orientation lock/unlock "
768 "API please use functions lock_orientation/unlock_orientation provided "
769 "by Ewk_View_Smart_Class.");
773 void ewk_view_back_forward_list_clear(const Evas_Object *view)
775 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
776 impl->BackForwardListClear();
779 Eina_Bool ewk_view_feed_touch_event(Evas_Object *view, Ewk_Touch_Event_Type type, const Eina_List *points, const Evas_Modifier *modifiers)
781 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
783 impl->HandleTouchEvents(type, points, modifiers);
788 Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object *view, Eina_Bool enabled)
790 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
792 impl->SetTouchEventsEnabled(!!enabled);
797 Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object *view)
799 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
801 return impl->TouchEventsEnabled();
804 Ewk_Frame_Ref ewk_view_main_frame_get(Evas_Object* o)
806 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, NULL);
807 return static_cast<Ewk_Frame_Ref>(impl->GetMainFrame());
810 void ewk_view_content_security_policy_set(Evas_Object* ewkView, const char* policy, Ewk_CSP_Header_Type type)
812 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
813 EINA_SAFETY_ON_NULL_RETURN(policy);
814 impl->SetContentSecurityPolicy(policy, type);
817 void ewk_view_application_cache_permission_callback_set(Evas_Object* ewkView, Ewk_View_Applicacion_Cache_Permission_Callback callback, void* userData)
819 // Chromium does not support this feature hence the comment
820 LOG_EWK_API_MOCKUP("Not Supported by chromium");
823 void ewk_view_application_cache_permission_reply(Evas_Object* ewkView, Eina_Bool allow)
825 // Chromium does not support this feature hence the comment
826 LOG_EWK_API_MOCKUP("Not Supported by chromium");
829 void ewk_view_exceeded_indexed_database_quota_callback_set(Evas_Object* view, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, void* user_data)
831 // Chromium does not support quota for Indexed DB only.
832 // IndexedDB uses temporary storage that is shared
833 // between other features.
834 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
835 impl->SetExceededIndexedDatabaseQuotaCallback(callback, user_data);
838 void ewk_view_exceeded_indexed_database_quota_reply(Evas_Object* view, Eina_Bool allow)
840 // Chromium does not support quota for Indexed DB only.
841 // IndexedDB uses temporary storage that is shared
842 // between other features.
843 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
844 impl->ExceededIndexedDatabaseQuotaReply(allow);
847 Eina_Bool ewk_view_text_find(Evas_Object *view, const char *text, Ewk_Find_Options options, unsigned int max_match_count)
849 // FIXME: We need to implement next options in Ewk_Find_Options struct. (refer to ewk_view.h)
850 // - EWK_FIND_OPTIONS_AT_WORD_STARTS
851 // - EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START
852 // - EWK_FIND_OPTIONS_WRAP_AROUND
853 // - EWK_FIND_OPTIONS_SHOW_OVERLAY
854 // - EWK_FIND_OPTIONS_SHOW_FIND_INDICATOR
855 // - EWK_FIND_OPTIONS_SHOW_HIGHLIGHT (Currently there is no way to control this option. so it is always set)
857 // FIXME: Updating of max_match_count is not implemented.
859 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
860 EINA_SAFETY_ON_NULL_RETURN_VAL(text, EINA_FALSE);
861 impl->Find(text, options);
865 Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object *view)
867 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
872 void ewk_view_exceeded_database_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Database_Quota_Callback callback, void* userData)
874 // According to chromium source code:
875 // src/third_party/WebKit/Source/modules/webdatabase/SQLTransactionClient.cpp line 67
876 // Chromium does not allow users to manually change the quota for an origin (for now, at least).
877 // This API is impossible to implement right now
878 LOG_EWK_API_MOCKUP("Not Supported by chromium");
881 void ewk_view_exceeded_database_quota_reply(Evas_Object* ewkView, Eina_Bool allow)
883 // According to chromium source code:
884 // src/third_party/WebKit/Source/modules/webdatabase/SQLTransactionClient.cpp line 67
885 // Chromium does not allow users to manually change the quota for an origin (for now, at least).
886 // This API is impossible to implement right now
887 LOG_EWK_API_MOCKUP("Not Supported by chromium");
890 void ewk_view_exceeded_local_file_system_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, void* userData)
892 LOG_EWK_API_MOCKUP();
895 void ewk_view_exceeded_local_file_system_quota_reply(Evas_Object* ewkView, Eina_Bool allow)
897 LOG_EWK_API_MOCKUP();
900 void ewk_view_unfocus_allow_callback_set(Evas_Object* ewkView, Ewk_View_Unfocus_Allow_Callback callback, void* user_data)
902 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
903 impl->SetViewUnfocusAllowCallback(callback, user_data);
906 void ewk_view_geolocation_permission_callback_set(Evas_Object* ewk_view, Ewk_View_Geolocation_Permission_Callback callback, void* user_data)
908 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
909 impl->SetViewGeolocationPermissionCallback(callback, user_data);
912 static Eina_Bool _ewk_view_default_geolocation_permission(
913 Evas_Object* ewk_view,
914 Ewk_Geolocation_Permission_Request* request,
917 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
919 std::string value = std::string(ewk_security_origin_host_get(
920 ewk_geolocation_permission_request_origin_get(request)));
921 std::string message = std::string(
922 "Web Page (%s) is requesting permission to access your location.");
923 std::string replace_str = std::string("(%s)");
925 size_t pos = message.find(replace_str.c_str());
926 if (pos != std::string::npos)
927 message.replace(pos, replace_str.length(), value.c_str());
929 // add for suspending
930 ewk_geolocation_permission_request_suspend(request);
932 GeolocationPermissionPopup* popup = new GeolocationPermissionPopup(request,
933 ewk_geolocation_permission_request_origin_get(request), message);
935 impl->GetPermissionPopupManager()->AddPermissionRequest(popup);
940 void ewk_view_user_media_permission_callback_set(Evas_Object* ewk_view,
941 Ewk_View_User_Media_Permission_Callback callback,
944 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
945 impl->SetViewUserMediaPermissionCallback(callback, user_data);
948 void ewk_view_user_media_permission_query_callback_set(
949 Evas_Object* ewk_view,
950 Ewk_View_User_Media_Permission_Query_Callback callback,
952 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
953 impl->SetViewUserMediaPermissionQueryCallback(callback, user_data);
956 static Eina_Bool _ewk_view_default_user_media_permission(
957 Evas_Object* ewk_view,
958 Ewk_User_Media_Permission_Request* user_media_permission_request,
961 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
963 std::string message =
964 CreatePermissionMessageRequest(user_media_permission_request);
966 // add for suspending
967 ewk_user_media_permission_request_suspend(user_media_permission_request);
969 UserMediaPermissionPopup* popup = new UserMediaPermissionPopup(
970 user_media_permission_request,
971 ewk_user_media_permission_request_origin_get(
972 user_media_permission_request), message);
974 impl->GetPermissionPopupManager()->AddPermissionRequest(popup);
979 void ewk_view_use_settings_font(Evas_Object* ewkView)
981 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
982 impl->UseSettingsFont();
985 char* ewk_view_get_cookies_for_url(Evas_Object* view, const char* url)
987 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
988 EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0);
989 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(), 0);
990 std::string cookiesForURL =
991 impl->context()->cookieManager()->GetCookiesForURL(std::string(url));
992 if (cookiesForURL.empty())
994 return strndup(cookiesForURL.c_str(), cookiesForURL.length());
997 Eina_Bool ewk_view_fullscreen_exit(Evas_Object* view)
999 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1000 impl->ExitFullscreen();
1004 Eina_Bool ewk_view_draws_transparent_background_set(Evas_Object *view, Eina_Bool enabled)
1006 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1007 impl->SetDrawsTransparentBackground(enabled);
1011 void ewk_view_browser_font_set(Evas_Object* ewkView)
1013 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1014 impl->SetBrowserFont();
1017 void ewk_view_session_data_get(Evas_Object* ewkView, const char** data, unsigned* length)
1019 EINA_SAFETY_ON_NULL_RETURN(data);
1020 EINA_SAFETY_ON_NULL_RETURN(length);
1022 EWebView* impl = GetWebViewFromEvasObject(ewkView);
1029 impl->GetSessionData(data, length);
1032 Eina_Bool ewk_view_mode_set(Evas_Object* ewkView, Ewk_View_Mode view_mode)
1034 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
1036 if (view_mode == EWK_VIEW_MODE_WINDOWED) {
1037 #if !defined(EWK_BRINGUP) // FIXME: m67 bringup
1038 impl->SetViewMode(blink::WebViewModeWindowed);
1041 } else if (view_mode == EWK_VIEW_MODE_FULLSCREEN) {
1042 #if !defined(EWK_BRINGUP) // FIXME: m67 bringup
1043 impl->SetViewMode(blink::WebViewModeFullscreen);
1051 Eina_Bool ewk_view_split_scroll_overflow_enabled_set(Evas_Object* ewkView, const Eina_Bool enabled)
1053 LOG_EWK_API_MOCKUP("for browser");
1057 Ewk_Back_Forward_List* ewk_view_back_forward_list_get(const Evas_Object* ewkView)
1059 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, NULL);
1060 return impl->GetBackForwardList();
1063 void ewk_view_notification_permission_callback_set(Evas_Object *o, Ewk_View_Notification_Permission_Callback callback, void *user_data)
1065 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl);
1066 impl->SetNotificationPermissionCallback(callback, user_data);
1069 static Eina_Bool _ewk_view_default_notification_permission(
1070 Evas_Object* ewk_view,
1071 Ewk_Notification_Permission_Request* request,
1074 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
1076 std::string value = std::string(ewk_security_origin_host_get(
1077 ewk_notification_permission_request_origin_get(request)));
1078 std::string message = std::string(
1079 "Web Page (%s) is requesting permission to show notifications.");
1080 std::string replace_str = std::string("(%s)");
1082 size_t pos = message.find(replace_str.c_str());
1083 if (pos != std::string::npos)
1084 message.replace(pos, replace_str.length(), value.c_str());
1086 // add for suspending
1087 ewk_notification_permission_request_suspend(request);
1089 NotificationPermissionPopup* popup = new NotificationPermissionPopup(request,
1090 ewk_notification_permission_request_origin_get(request), message);
1092 impl->GetPermissionPopupManager()->AddPermissionRequest(popup);
1097 void ewk_view_draw_focus_ring_enable_set(Evas_Object* ewkView, Eina_Bool enable)
1099 LOG_EWK_API_MOCKUP("This API is deprecated");
1102 double ewk_view_page_zoom_get(const Evas_Object* ewkView)
1104 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, -1.0);
1105 return impl->GetPageZoomFactor();
1108 Eina_Bool ewk_view_page_zoom_set(Evas_Object* ewkView, double zoomFactor)
1110 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
1111 impl->SetPageZoomFactor(zoomFactor);
1115 Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* context, Ewk_Page_Group* pageGroup)
1117 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
1118 return CreateWebViewAsEvasObject(context, canvas, smart);
1121 void ewk_view_quota_permission_request_callback_set(Evas_Object* ewkView, Ewk_Quota_Permission_Request_Callback callback, void* user_data)
1123 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1124 impl->SetQuotaPermissionRequestCallback(callback, user_data);
1127 void ewk_view_quota_permission_request_reply(const Ewk_Quota_Permission_Request* request, const Eina_Bool allow)
1129 EINA_SAFETY_ON_NULL_RETURN(request);
1130 Evas_Object* ewkView = request->getView();
1131 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1132 impl->QuotaRequestReply(request, allow == EINA_TRUE);
1135 void ewk_view_quota_permission_request_cancel(const Ewk_Quota_Permission_Request* request)
1137 EINA_SAFETY_ON_NULL_RETURN(request);
1138 Evas_Object* ewkView = request->getView();
1139 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1140 impl->QuotaRequestCancel(request);
1143 Eina_Bool ewk_view_focus_set(const Evas_Object* view, Eina_Bool focused)
1145 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1146 impl->SetFocus(focused);
1150 Eina_Bool ewk_view_focus_get(const Evas_Object* view)
1152 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1153 return impl->HasFocus();
1156 Eina_Bool ewk_view_page_close(Evas_Object* o)
1158 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
1164 void ewk_view_session_timeout_set(Evas_Object* o, unsigned long timeout)
1166 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl);
1167 impl->SetSessionTimeout(timeout);
1170 Evas_Object* ewk_view_widget_get(Evas_Object* view)
1172 LOG_EWK_API_MOCKUP();
1176 Eina_Bool ewk_view_draws_transparent_background_get(Evas_Object* o)
1178 LOG_EWK_API_MOCKUP();
1182 Eina_Bool ewk_view_did_change_theme_color_callback_set(
1184 Ewk_View_Did_Change_Theme_Color_Callback callback,
1186 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
1187 impl->SetDidChangeThemeColorCallback(callback, user_data);
1191 Eina_Bool ewk_view_split_scroll_overflow_enabled_get(const Evas_Object* o) {
1192 LOG_EWK_API_MOCKUP();
1196 Eina_Bool ewk_view_save_page_as_mhtml(Evas_Object* o, const char* path, Ewk_View_Save_Page_Callback callback, void* user_data)
1198 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
1199 EINA_SAFETY_ON_NULL_RETURN_VAL(path, EINA_FALSE);
1200 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
1201 return impl->SavePageAsMHTML(path, callback, user_data);
1204 void ewk_view_reader_mode_set(Evas_Object* ewk_view, Eina_Bool enable)
1206 LOG_EWK_API_MOCKUP();
1209 Eina_Bool ewk_view_top_controls_height_set(Evas_Object* ewk_view, size_t top_height, size_t bottom_height)
1211 LOG_EWK_API_MOCKUP();
1215 Eina_Bool ewk_view_top_controls_state_set(Evas_Object* ewk_view, Ewk_Top_Control_State constraint, Ewk_Top_Control_State current, Eina_Bool animation)
1217 LOG_EWK_API_MOCKUP();
1221 Eina_Bool ewk_view_main_frame_scrollbar_visible_set(Evas_Object* ewk_view,
1222 Eina_Bool visible) {
1223 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
1224 return impl->SetMainFrameScrollbarVisible(!!visible);
1227 Eina_Bool ewk_view_main_frame_scrollbar_visible_get(
1228 Evas_Object* ewk_view,
1229 Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback callback,
1231 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
1232 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
1234 return impl->GetMainFrameScrollbarVisible(callback, user_data);
1237 Eina_Bool ewk_view_set_custom_device_pixel_ratio(Evas_Object* ewkView, Eina_Bool enabled)
1239 LOG_EWK_API_MOCKUP();
1243 #if BUILDFLAG(IS_TIZEN_TV)
1244 Eina_Bool ewk_media_translated_url_set(Evas_Object* ewkView, const char* url)
1246 LOG_EWK_API_MOCKUP();
1250 Eina_Bool ewk_view_app_preload_set(Evas_Object* ewkView, Eina_Bool is_preload)
1252 LOG_EWK_API_MOCKUP();
1257 Evas_Object* ewk_view_favicon_get(const Evas_Object* ewkView)
1259 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, nullptr);
1260 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(), nullptr);
1261 const char* url = ewk_view_url_get(ewkView);
1262 return impl->context()->AddFaviconObject(url, impl->GetEvas());
1265 Eina_Bool ewk_view_html_string_override_current_entry_load(Evas_Object* view, const char* html, const char* base_uri, const char* unreachable_url)
1267 LOG_EWK_API_MOCKUP();
1271 Eina_Bool ewk_view_text_matches_count(Evas_Object* o, const char* text, Ewk_Find_Options options, unsigned max_match_count)
1273 LOG_EWK_API_MOCKUP();
1277 void ewk_view_mirrored_blur_set(Evas_Object* o, Eina_Bool state)
1279 LOG_EWK_API_MOCKUP();
1282 void ewk_view_add_dynamic_certificate_path(const Evas_Object *ewkView, const char* host, const char* cert_path)
1284 LOG_EWK_API_MOCKUP();
1287 void ewk_view_atk_deactivation_by_app(Evas_Object* view, Eina_Bool enable)
1289 LOG_EWK_API_MOCKUP();
1292 char* ewk_view_cookies_get(Evas_Object* o, const char* url)
1294 LOG_EWK_API_MOCKUP();
1298 void ewk_view_notification_show_callback_set(Evas_Object *o, Ewk_View_Notification_Show_Callback show_callback, void *user_data)
1300 LOG_EWK_API_MOCKUP();
1303 void ewk_view_notification_cancel_callback_set(Evas_Object *o, Ewk_View_Notification_Cancel_Callback cancel_callback, void *user_data)
1305 LOG_EWK_API_MOCKUP();
1308 const char* ewk_view_custom_encoding_get(const Evas_Object* o)
1310 LOG_EWK_API_MOCKUP();
1314 Eina_Bool ewk_view_custom_encoding_set(Evas_Object* o, const char* encoding)
1316 LOG_EWK_API_MOCKUP();
1320 void ewk_view_force_layout(const Evas_Object* o)
1322 LOG_EWK_API_MOCKUP();
1325 Eina_Bool ewk_view_send_key_event(Evas_Object* ewk_view, void* key_event, Eina_Bool is_press) {
1326 LOG_EWK_API_MOCKUP();
1330 Eina_Bool ewk_view_tts_mode_set(Evas_Object* view, ewk_tts_mode tts_mode) {
1331 #if defined(TIZEN_WEB_SPEECH_RECOGNITION)
1333 case EWK_TTS_MODE_DEFAULT:
1334 content::TtsPlatformImplTizen::SetTtsMode(TTS_MODE_DEFAULT);
1336 case EWK_TTS_MODE_NOTIFICATION:
1337 content::TtsPlatformImplTizen::SetTtsMode(TTS_MODE_NOTIFICATION);
1339 case EWK_TTS_MODE_SCREEN_READER:
1340 content::TtsPlatformImplTizen::SetTtsMode(TTS_MODE_SCREEN_READER);
1343 LOG(ERROR) << "Not supported TTS mode: " << static_cast<int>(tts_mode);
1348 LOG_EWK_API_MOCKUP("API unavailable.");
1353 Eina_Bool ewk_view_javascript_message_handler_add(
1355 Ewk_View_Script_Message_Cb callback,
1357 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1358 EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
1359 return impl->AddJavaScriptMessageHandler(view, callback, std::string(name));
1362 Eina_Bool ewk_view_evaluate_javascript(Evas_Object* view,
1364 const char* result) {
1365 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1366 EINA_SAFETY_ON_NULL_RETURN_VAL(result, EINA_FALSE);
1367 EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
1369 std::string function(name);
1370 std::string data(result);
1371 std::string pattern("\n");
1372 std::string replace("</br>");
1373 std::string::size_type pos = 0;
1374 std::string::size_type offset = 0;
1375 while ((pos = data.find(pattern, offset)) != std::string::npos) {
1376 data.replace(data.begin() + pos, data.begin() + pos + pattern.size(),
1378 offset = pos + replace.size();
1381 // For JSON Object or Array.
1382 if (result[0] == '{' || result[0] == '[') {
1383 data = "javascript:" + function + "(JSON.parse('" + data + "'))";
1385 data = "javascript:" + function + "('" + data + "')";
1388 return impl->ExecuteJavaScript(data.c_str(), NULL, 0);
1391 void ewk_view_authentication_callback_set(
1392 Evas_Object* ewk_view,
1393 Ewk_View_Authentication_Callback callback,
1396 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
1397 impl->SetViewAuthCallback(callback, user_data);
1401 static void _ewk_view_default_authentication(Evas_Object* ewk_view,
1402 Ewk_Auth_Challenge* auth_challenge,
1405 AuthenticationChallengePopup::CreateAndShow(auth_challenge, ewk_view);
1408 void ewk_view_app_installation_request_callback_set(Evas_Object* o, Ewk_App_Installation_Request_Callback callback, void* user_data)
1410 LOG_EWK_API_MOCKUP();
1413 Eina_Bool ewk_view_bg_color_set(Evas_Object* o, int r, int g, int b, int a) {
1414 LOG_EWK_API_MOCKUP("This will be implemented soon");
1418 Eina_Bool ewk_view_key_events_enabled_set(Evas_Object* o, Eina_Bool enabled) {
1419 LOG_EWK_API_MOCKUP();
1423 Eina_Bool ewk_view_bg_color_get(Evas_Object* view,
1424 Ewk_View_Background_Color_Get_Callback callback,
1426 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
1427 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1429 return impl->GetBackgroundColor(callback, user_data);
1432 void ewk_view_clear_all_tiles_resources(Evas_Object* ewkView) {
1433 LOG_EWK_API_MOCKUP();
1436 Eina_Bool ewk_view_edge_scroll_by(Evas_Object *ewkView, int dx, int dy)
1438 LOG_EWK_API_MOCKUP();
1442 Eina_Bool ewk_view_set_support_video_hole(Evas_Object* ewkView,
1445 Eina_Bool isVideoWindow) {
1446 LOG_EWK_API_MOCKUP();
1447 #if defined(TIZEN_VIDEO_HOLE)
1448 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
1449 impl->SetVideoHoleSupport(enable);
1450 media::VideoPlaneController::SetSharedVideoWindowHandle(
1452 static_cast<media::VideoPlaneController::RenderingMode>(isVideoWindow));
1455 LOG_EWK_API_MOCKUP("Video Hole feature is not enabled");
1460 void ewk_view_widget_pepper_extension_callback_set(Evas_Object* ewk_view, Generic_Sync_Call_Callback cb, void* user_data) {
1461 LOG_EWK_API_MOCKUP();
1464 void ewk_view_widget_pepper_extension_info_set(Evas_Object* ewk_view, Ewk_Value widget_pepper_ext_info) {
1465 LOG_EWK_API_MOCKUP();
1468 void ewk_view_offscreen_rendering_enabled_set(Evas_Object* o, Eina_Bool enabled)
1470 LOG_EWK_API_MOCKUP();
1473 void ewk_view_ime_window_set(Evas_Object* o, void* window)
1475 LOG_EWK_API_MOCKUP();
1478 void ewk_view_smartrc_show_mic_notification_callback_set(Evas_Object* o, Ewk_View_SmartRC_Mic_Notification_Callback callback, void* user_data)
1480 LOG_EWK_API_MOCKUP();
1483 Eina_Bool ewk_view_set_support_canvas_hole(Evas_Object* ewkView, const char* url)
1485 LOG_EWK_API_MOCKUP();
1489 void ewk_view_tile_cover_area_multiplier_set(Evas_Object* ewkView,
1490 float cover_area_multiplier) {
1491 LOG_EWK_API_MOCKUP();
1494 Eina_Bool ewk_view_marlin_enable_set(Evas_Object* ewkView, Eina_Bool is_enable)
1496 LOG_EWK_API_MOCKUP();
1500 Eina_Bool ewk_view_key_system_whitelist_set(Evas_Object* ewkView, const char** list, unsigned list_size)
1502 LOG_EWK_API_MOCKUP();
1506 Eina_Bool ewk_view_active_drm_set(Evas_Object* view, const char* drm_system_id)
1508 LOG_EWK_API_MOCKUP();
1512 void ewk_media_set_subtitle_lang(Evas_Object* ewkView, const char* lang_list)
1514 LOG_EWK_API_MOCKUP();
1517 void ewk_media_set_parental_rating_result(Evas_Object* ewkView, const char* url, Eina_Bool is_pass)
1519 LOG_EWK_API_MOCKUP();
1522 void ewk_media_start_with_high_bit_rate(Evas_Object* ewkView, Eina_Bool is_high_bitrate)
1524 LOG_EWK_API_MOCKUP();
1527 double ewk_view_media_current_time_get(const Evas_Object *o)
1529 LOG_EWK_API_MOCKUP();
1533 void ewk_view_request_canvas_fullscreen(Evas_Object* ewkView)
1535 LOG_EWK_API_MOCKUP();
1538 void ewk_view_360video_play(Evas_Object* ewkView)
1540 LOG_EWK_API_MOCKUP();
1543 void ewk_view_360video_pause(Evas_Object* ewkView)
1545 LOG_EWK_API_MOCKUP();
1548 void ewk_view_360video_duration(Evas_Object* ewkView, Ewk_360_Video_Duration_Callback callback, void* user_data)
1550 LOG_EWK_API_MOCKUP();
1553 void ewk_view_360video_current_time(Evas_Object* ewkView, Ewk_360_Video_CurrentTime_Callback callback, void* user_data)
1555 LOG_EWK_API_MOCKUP();
1558 void ewk_view_360video_set_current_time(Evas_Object* ewkView, double current_time)
1560 LOG_EWK_API_MOCKUP();
1563 Eina_Bool ewk_view_script_execute_all_frames(Evas_Object *o, const char *script, Ewk_View_Script_Execute_Cb callback, void *user_data)
1565 LOG_EWK_API_MOCKUP();
1569 void ewk_view_voicemanager_label_draw(Evas_Object* view,
1571 Eina_Rectangle rect) {
1572 #if BUILDFLAG(IS_TIZEN_TV)
1573 EINA_SAFETY_ON_NULL_RETURN(image);
1574 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
1575 impl->DrawLabel(image, rect);
1577 LOG_EWK_API_MOCKUP("Only for Tizen TV.");
1581 void ewk_view_voicemanager_labels_clear(Evas_Object* view) {
1582 #if BUILDFLAG(IS_TIZEN_TV)
1583 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
1584 impl->ClearLabels();
1586 LOG_EWK_API_MOCKUP("Only for Tizen TV.");
1590 void ewk_view_floating_window_state_changed(const Evas_Object *o, Eina_Bool status)
1592 LOG_EWK_API_MOCKUP();
1595 void ewk_view_feed_mouse_down(Evas_Object* view,
1596 Ewk_Mouse_Button_Type button,
1599 LOG_EWK_API_MOCKUP("NUI feature is not enabled");
1602 void ewk_view_feed_mouse_up(Evas_Object* view,
1603 Ewk_Mouse_Button_Type button,
1606 LOG_EWK_API_MOCKUP("NUI feature is not enabled");
1609 void ewk_view_feed_mouse_move(Evas_Object* view, int x, int y) {
1610 LOG_EWK_API_MOCKUP("NUI feature is not enabled");
1613 void ewk_view_feed_mouse_wheel(Evas_Object* view,
1614 Eina_Bool y_direction,
1618 LOG_EWK_API_MOCKUP("NUI feature is not enabled");
1621 void ewk_view_auto_login(Evas_Object *view, const char* user_name, const char* password)
1623 LOG_EWK_API_MOCKUP();
1626 void ewk_view_request_manifest(Evas_Object* o,
1627 Ewk_View_Request_Manifest_Callback callback,
1629 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl);
1630 impl->RequestManifest(callback, user_data);