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);
103 LOG(INFO) << "evas: " << e << ", context: " << context << ", ewk_view:" << ewk_view;
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 LOG(INFO) << "evas: " << e << ", context: " << context;
129 return ewk_view_add_with_context(e, context);
132 Evas_Object* ewk_view_add_in_incognito_mode(Evas* e)
134 EINA_SAFETY_ON_NULL_RETURN_VAL(e, nullptr);
135 Ewk_Context* context = Ewk_Context::IncognitoContext();
136 LOG(INFO) << "evas: " << e << ", context: " << context;
137 EINA_SAFETY_ON_NULL_RETURN_VAL(context, nullptr);
138 return ewk_view_add_with_context(e, context);
141 Ewk_Context *ewk_view_context_get(const Evas_Object *view)
143 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
144 return static_cast<Ewk_Context*>(impl->context());
147 Eina_Bool ewk_view_url_set(Evas_Object* view, const char* url_string)
149 TTRACE_WEB("ewk_view_url_set url: %s", url_string);
150 LOG(INFO) << "view: " << view << ", url: " << url_string;
151 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
152 EINA_SAFETY_ON_NULL_RETURN_VAL(url_string, false);
153 GURL url(url_string);
154 impl->SetURL(url, true);
158 const char* ewk_view_url_get(const Evas_Object* view)
160 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
161 return impl->GetURL().possibly_invalid_spec().c_str();
164 const char* ewk_view_original_url_get(const Evas_Object* view)
166 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
167 return impl->GetOriginalURL().possibly_invalid_spec().c_str();
170 Eina_Bool ewk_view_reload(Evas_Object *view)
172 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
173 LOG(INFO) << "view: " << view;
179 Eina_Bool ewk_view_reload_bypass_cache(Evas_Object *view)
181 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
182 impl->ReloadBypassingCache();
186 Eina_Bool ewk_view_stop(Evas_Object* view)
188 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
194 Ewk_Settings *ewk_view_settings_get(const Evas_Object *ewkView)
196 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl,0);
197 return impl->GetSettings();
200 const char* ewk_view_title_get(const Evas_Object* view)
202 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
203 return impl->GetTitle();
206 double ewk_view_load_progress_get(const Evas_Object* view)
208 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, -1);
209 return impl->GetProgressValue();
212 Eina_Bool ewk_view_scale_set(Evas_Object* view, double scale_factor, int x, int y)
214 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
215 impl->SetScale(scale_factor);
216 impl->SetScroll(x, y);
217 LOG(INFO) << "view: " << view << ", scale_factor: " << scale_factor << ", x:" << x << ", y:" << y;
221 void ewk_view_scale_changed_callback_set(
223 Ewk_View_Scale_Changed_Callback callback,
225 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
226 impl->SetScaleChangedCallback(callback, user_data);
229 double ewk_view_scale_get(const Evas_Object *view)
231 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, -1);
232 return impl->GetScale();
235 Eina_Bool ewk_view_back(Evas_Object *view)
237 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
238 LOG(INFO) << "view: " << view;
239 return impl->GoBack();
242 Eina_Bool ewk_view_forward(Evas_Object *view)
244 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
245 LOG(INFO) << "view: " << view;
246 return impl->GoForward();
249 Eina_Bool ewk_view_back_possible(Evas_Object *view)
251 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
252 return impl->CanGoBack();
255 Eina_Bool ewk_view_forward_possible(Evas_Object *view)
257 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
258 return impl->CanGoForward();
261 Eina_Bool ewk_view_web_login_request(Evas_Object* ewkView)
263 LOG_EWK_API_MOCKUP();
267 Eina_Bool ewk_view_html_string_load(Evas_Object* view, const char* html, const char* base_uri, const char* unreachable_uri)
269 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
270 EINA_SAFETY_ON_NULL_RETURN_VAL(html, EINA_FALSE);
271 LOG(INFO) << "view: " << view;
272 impl->LoadHTMLString(html, base_uri, unreachable_uri);
276 Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object *view, Eina_Bool enabled)
278 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
280 impl->SetMouseEventsEnabled(!!enabled);
285 Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object *view)
287 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
289 return impl->MouseEventsEnabled();
292 Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, int b, int a)
294 LOG_EWK_API_MOCKUP();
298 double ewk_view_text_zoom_get(const Evas_Object* view)
300 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, -1.0);
301 return impl->GetTextZoomFactor();
304 Eina_Bool ewk_view_text_zoom_set(Evas_Object* view, double text_zoom_level)
306 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
307 if (ewk_settings_text_zoom_enabled_get(ewk_view_settings_get(view))) {
308 impl->SetTextZoomFactor(text_zoom_level);
314 void ewk_view_not_found_error_page_load(Evas_Object* ewkView, const char* errorUrl)
316 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
317 impl->LoadNotFoundErrorPage(std::string(errorUrl));
320 void ewk_view_scale_range_get(Evas_Object* view, double* min_scale, double* max_scale)
322 if (!min_scale && !max_scale)
325 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
326 impl->GetPageScaleRange(min_scale, max_scale);
329 void ewk_view_suspend(Evas_Object* ewkView)
331 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
332 LOG(INFO) << "view: " << ewkView;
336 void ewk_view_resume(Evas_Object* ewkView)
338 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
342 Eina_Bool ewk_view_url_request_set(Evas_Object* ewkView, const char* url, Ewk_Http_Method method, Eina_Hash* headers, const char* body)
344 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
345 EINA_SAFETY_ON_NULL_RETURN_VAL(url, EINA_FALSE);
346 content::NavigationController::LoadURLType loadtype;
348 case EWK_HTTP_METHOD_GET:
349 loadtype = content::NavigationController::LOAD_TYPE_DEFAULT;
351 case EWK_HTTP_METHOD_POST:
352 loadtype = content::NavigationController::LOAD_TYPE_HTTP_POST;
355 LOG(ERROR) << "Not supported HTTP Method.";
359 impl->UrlRequestSet(url, loadtype, headers, body);
363 Eina_Bool ewk_view_plain_text_set(Evas_Object* view, const char* plain_text)
365 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
366 EINA_SAFETY_ON_NULL_RETURN_VAL(plain_text, EINA_FALSE);
367 impl->LoadPlainTextString(plain_text);
371 Eina_Bool ewk_view_contents_set(Evas_Object* view, const char* contents, size_t contents_size, char* mime_type, char* encoding, char* base_uri)
373 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
374 EINA_SAFETY_ON_NULL_RETURN_VAL(contents, EINA_FALSE);
375 impl->LoadData(contents, contents_size, mime_type, encoding, base_uri);
379 Eina_Bool ewk_view_html_contents_set(Evas_Object* view, const char* html, const char* base_uri)
381 return ewk_view_html_string_load(view, html, base_uri, NULL);
384 Eina_Bool ewk_view_page_visibility_state_set(Evas_Object* ewkView, Ewk_Page_Visibility_State page_visibility_state, Eina_Bool initial_state)
386 // TODO: Should we send initial_state to |Page::setVisibilityState()|?.
387 // isInitialState parameter seems be true only in the constructor of WebViewImpl.
388 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
390 return impl->SetPageVisibility(page_visibility_state);
393 Eina_Bool ewk_view_user_agent_set(Evas_Object* ewkView, const char* user_agent)
395 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
396 LOG(INFO) << "view: " << ewkView << ", user_agent: " << user_agent;
397 return impl->SetUserAgent(user_agent);
400 const char* ewk_view_user_agent_get(const Evas_Object* ewkView)
402 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
403 return impl->GetUserAgent();
406 Eina_Bool ewk_view_application_name_for_user_agent_set(Evas_Object* ewkView, const char* application_name)
408 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
409 return impl->SetUserAgentAppName(application_name);
412 const char* ewk_view_application_name_for_user_agent_get(const Evas_Object* ewkView)
414 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
415 return eina_stringshare_add(impl->GetUserAgentAppName());
418 Eina_Bool ewk_view_custom_header_add(const Evas_Object* ewkView, const char* name, const char* value)
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(value, EINA_FALSE);
423 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(),EINA_FALSE);
424 return impl->context()->HTTPCustomHeaderAdd(name, value);
427 Eina_Bool ewk_view_custom_header_remove(const Evas_Object* ewkView, const char* name)
429 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
430 EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
431 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(),EINA_FALSE);
432 return impl->context()->HTTPCustomHeaderRemove(name);
436 Eina_Bool ewk_view_custom_header_clear(const Evas_Object* ewkView)
438 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
439 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(),EINA_FALSE);
440 impl->context()->HTTPCustomHeaderClear();
445 Eina_Bool ewk_view_visibility_set(Evas_Object* view, Eina_Bool enable)
447 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
448 LOG(INFO) << "view: " << view << ", enable:" << (bool)enable;
449 return impl->SetVisibility(enable);
452 Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* view, Eina_Rectangle view_area, float scale_factor, Evas* canvas)
454 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, NULL);
455 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, NULL);
456 LOG(INFO) << "view: " << view;
457 return impl->GetSnapshot(view_area, scale_factor);
460 Eina_Bool ewk_view_screenshot_contents_get_async(const Evas_Object* view, Eina_Rectangle view_area,
461 float scale_factor, Evas* canvas, Ewk_Web_App_Screenshot_Captured_Callback callback, void* user_data)
463 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
464 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
465 LOG(INFO) << "view: " << view;
466 return impl->GetSnapshotAsync(view_area, callback, user_data, scale_factor)
471 unsigned int ewk_view_inspector_server_start(Evas_Object* ewkView, unsigned int port)
473 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
474 LOG(INFO) << "view: " << ewkView << ", port:" << port;
475 return impl->StartInspectorServer(port);
478 Eina_Bool ewk_view_inspector_server_stop(Evas_Object* ewkView)
480 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
481 LOG(INFO) << "view: " << ewkView;
482 return impl->StopInspectorServer();
485 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)
487 LOG_EWK_API_MOCKUP();
491 void ewk_view_scroll_by(Evas_Object* ewkView, int deltaX, int deltaY)
494 LOG(INFO) << "view: " << ewkView << ", deltaX:" << deltaX << ", deltaY:" << deltaY;
495 if (EINA_TRUE == ewk_view_scroll_pos_get(ewkView, &x, &y)) {
496 ewk_view_scroll_set(ewkView, x + deltaX, y + deltaY);
500 Eina_Bool ewk_view_scroll_pos_get(Evas_Object* ewkView, int* x, int* y)
502 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
503 return impl->GetScrollPosition(x, y);
506 Eina_Bool ewk_view_scroll_set(Evas_Object* view, int x, int y)
508 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
509 LOG(INFO) << "view: " << view << ", x:" << x << ", y:" << y;
510 impl->SetScroll(x, y);
515 Eina_Bool ewk_view_scroll_size_get(const Evas_Object* view, int* width, int* height)
521 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
522 impl->GetScrollSize(width,height);
526 void ewk_view_clear_tiles_on_hide_enabled_set(Evas_Object* ewkView, Eina_Bool enable)
528 LOG_EWK_API_MOCKUP();
531 void ewk_view_password_confirm_popup_callback_set(Evas_Object* view, Ewk_View_Password_Confirm_Popup_Callback callback, void* user_data)
533 LOG_EWK_API_MOCKUP();
536 void ewk_view_password_confirm_popup_reply(Evas_Object* ewkView, Ewk_Password_Popup_Option result)
538 LOG_EWK_API_MOCKUP();
541 void ewk_view_javascript_alert_callback_set(Evas_Object* view, Ewk_View_JavaScript_Alert_Callback callback, void* user_data)
543 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
544 LOG(INFO) << "view: " << view;
546 impl->SetJavaScriptAlertCallback(callback, user_data);
549 void ewk_view_javascript_alert_reply(Evas_Object* view)
551 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
552 LOG(INFO) << "view: " << view;
553 impl->JavaScriptAlertReply();
556 void ewk_view_javascript_confirm_callback_set(Evas_Object* view, Ewk_View_JavaScript_Confirm_Callback callback, void* user_data)
558 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
559 LOG(INFO) << "view: " << view;
561 impl->SetJavaScriptConfirmCallback(callback, user_data);
564 void ewk_view_javascript_confirm_reply(Evas_Object* view, Eina_Bool result)
566 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
567 LOG(INFO) << "view: " << view;
568 impl->JavaScriptConfirmReply(result);
571 void ewk_view_javascript_prompt_callback_set(Evas_Object* view, Ewk_View_JavaScript_Prompt_Callback callback, void* user_data)
573 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
574 LOG(INFO) << "view: " << view;
576 impl->SetJavaScriptPromptCallback(callback, user_data);
579 void ewk_view_javascript_prompt_reply(Evas_Object* view, const char* result)
581 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
582 LOG(INFO) << "view: " << view;
583 impl->JavaScriptPromptReply(result);
586 void ewk_view_before_unload_confirm_panel_callback_set(Evas_Object* ewkView, Ewk_View_Before_Unload_Confirm_Panel_Callback callback, void* userData)
588 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
589 EINA_SAFETY_ON_NULL_RETURN(callback);
590 impl->SetBeforeUnloadConfirmPanelCallback(callback, userData);
593 void ewk_view_before_unload_confirm_panel_reply(Evas_Object* ewkView, Eina_Bool result)
595 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
596 impl->ReplyBeforeUnloadConfirmPanel(result);
599 Eina_Bool ewk_view_web_application_capable_get(Evas_Object* ewkView, Ewk_Web_App_Capable_Get_Callback callback, void* userData)
601 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
602 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
603 return impl->WebAppCapableGet(callback, userData) ? EINA_TRUE : EINA_FALSE;
606 Eina_Bool ewk_view_web_application_icon_url_get(Evas_Object* ewkView, Ewk_Web_App_Icon_URL_Get_Callback callback, void* userData)
608 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
609 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
610 return impl->WebAppIconUrlGet(callback, userData) ? EINA_TRUE : EINA_FALSE;
613 Eina_Bool ewk_view_web_application_icon_urls_get(Evas_Object* ewkView, Ewk_Web_App_Icon_URLs_Get_Callback callback, void* userData)
615 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
616 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
617 return impl->WebAppIconUrlsGet(callback, userData) ? EINA_TRUE : EINA_FALSE;
620 Eina_Bool ewk_view_command_execute(Evas_Object* view, const char* command, const char* value)
622 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
623 EINA_SAFETY_ON_NULL_RETURN_VAL(command, false);
624 impl->ExecuteEditCommand(command, value);
628 Eina_Bool ewk_view_contents_size_get(const Evas_Object* view, Evas_Coord* width, Evas_Coord* height)
635 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
636 Eina_Rectangle contents_size = impl->GetContentsSize();
639 *width = contents_size.w;
641 *height = contents_size.h;
646 Eina_Bool ewk_view_contents_pdf_get(Evas_Object* view, int width, int height, const char* fileName)
648 EINA_SAFETY_ON_NULL_RETURN_VAL(fileName, EINA_FALSE);
649 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
650 return impl->SaveAsPdf(width, height, fileName);
653 Eina_Bool ewk_view_script_execute(Evas_Object* ewkView, const char* script, Ewk_View_Script_Execute_Callback callback, void* user_data)
655 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
656 EINA_SAFETY_ON_NULL_RETURN_VAL(script, false);
657 LOG(INFO) << "view: " << ewkView;
658 // callback can be null, so do not test it for null
659 if (0 != strcmp(script, "")) //check for empty string
660 return impl->ExecuteJavaScript(script, callback, user_data);
664 Eina_Bool ewk_view_plain_text_get(Evas_Object* view, Ewk_View_Plain_Text_Get_Callback callback, void* user_data)
666 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
667 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
668 return (impl->PlainTextGet(callback, user_data));
671 Eina_Bool ewk_view_mhtml_data_get(Evas_Object *view, Ewk_View_MHTML_Data_Get_Callback callback, void *user_data)
673 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
674 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
675 return impl->GetMHTMLData(callback, user_data);
678 Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* ewkView, int x, int y, int hit_test_mode)
680 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
681 return impl->RequestHitTestDataAt(x, y,
682 static_cast<Ewk_Hit_Test_Mode>(hit_test_mode));
685 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)
687 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
688 return impl->AsyncRequestHitTestDataAt(x, y, static_cast<Ewk_Hit_Test_Mode>(hit_test_mode), callback, user_data);
691 Ewk_History* ewk_view_history_get(Evas_Object* ewkView)
693 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, NULL);
694 return impl->GetBackForwardHistory();
697 Eina_Bool ewk_view_notification_closed(Evas_Object* ewkView, Eina_List* notification_list)
702 Eina_Bool ewk_view_popup_menu_select(Evas_Object* ewkView, unsigned int selectedIndex)
704 LOG_EWK_API_MOCKUP();
708 Eina_Bool ewk_view_popup_menu_multiple_select(Evas_Object* ewkView, Eina_Inarray* changeList)
710 LOG_EWK_API_MOCKUP();
714 void ewk_view_orientation_send(Evas_Object* ewkView, int orientation)
716 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
717 LOG(INFO) << "view: " << ewkView << ", orientation:" << orientation;
718 impl->SetOrientation(orientation);
721 void ewk_view_encoding_custom_set(Evas_Object* ewkView, const char* encoding)
723 // Chromium does not support this feature hence the comment
724 LOG_EWK_API_MOCKUP("Not Supported by chromium");
727 Eina_Bool ewk_view_text_selection_range_get(const Evas_Object* view, Eina_Rectangle* left_rect, Eina_Rectangle* right_rect)
729 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
730 if (left_rect && right_rect && impl->GetSelectionRange(left_rect, right_rect)) {
732 evas_object_geometry_get(view, &x, &y, 0, 0);
742 Eina_Bool ewk_view_text_selection_clear(Evas_Object *view)
744 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
745 return impl->ClearSelection();
748 const char* ewk_view_text_selection_text_get(Evas_Object* view)
750 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, NULL);
751 return impl->CacheSelectedText();
754 void ewk_view_focused_input_element_value_set(Evas_Object* ewkView, const char* value)
756 LOG_EWK_API_MOCKUP();
759 const char* ewk_view_focused_input_element_value_get(Evas_Object* ewkView)
761 LOG_EWK_API_MOCKUP();
765 Eina_Bool ewk_view_horizontal_panning_hold_get(Evas_Object* ewkView) {
766 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
767 return impl->GetHorizontalPanningHold();
770 void ewk_view_horizontal_panning_hold_set(Evas_Object* ewkView,
772 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
773 impl->SetHorizontalPanningHold(hold);
776 Eina_Bool ewk_view_vertical_panning_hold_get(Evas_Object* ewkView)
778 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
779 return impl->GetVerticalPanningHold();
782 void ewk_view_vertical_panning_hold_set(Evas_Object* view, Eina_Bool hold) {
783 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
784 impl->SetVerticalPanningHold(hold);
787 void ewk_view_orientation_lock_callback_set(Evas_Object* ewkView, Ewk_Orientation_Lock_Cb func, void* data)
789 LOG_EWK_API_MOCKUP("This API is deprecated, to use orientation lock/unlock "
790 "API please use functions lock_orientation/unlock_orientation provided "
791 "by Ewk_View_Smart_Class.");
795 void ewk_view_back_forward_list_clear(const Evas_Object *view)
797 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
798 impl->BackForwardListClear();
801 Eina_Bool ewk_view_feed_touch_event(Evas_Object *view, Ewk_Touch_Event_Type type, const Eina_List *points, const Evas_Modifier *modifiers)
803 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
805 impl->HandleTouchEvents(type, points, modifiers);
810 Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object *view, Eina_Bool enabled)
812 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
814 impl->SetTouchEventsEnabled(!!enabled);
819 Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object *view)
821 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
823 return impl->TouchEventsEnabled();
826 Ewk_Frame_Ref ewk_view_main_frame_get(Evas_Object* o)
828 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, NULL);
829 return static_cast<Ewk_Frame_Ref>(impl->GetMainFrame());
832 void ewk_view_content_security_policy_set(Evas_Object* ewkView, const char* policy, Ewk_CSP_Header_Type type)
834 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
835 EINA_SAFETY_ON_NULL_RETURN(policy);
836 impl->SetContentSecurityPolicy(policy, type);
839 void ewk_view_application_cache_permission_callback_set(Evas_Object* ewkView, Ewk_View_Applicacion_Cache_Permission_Callback callback, void* userData)
841 // Chromium does not support this feature hence the comment
842 LOG_EWK_API_MOCKUP("Not Supported by chromium");
845 void ewk_view_application_cache_permission_reply(Evas_Object* ewkView, Eina_Bool allow)
847 // Chromium does not support this feature hence the comment
848 LOG_EWK_API_MOCKUP("Not Supported by chromium");
851 void ewk_view_exceeded_indexed_database_quota_callback_set(Evas_Object* view, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, void* user_data)
853 // Chromium does not support quota for Indexed DB only.
854 // IndexedDB uses temporary storage that is shared
855 // between other features.
856 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
857 impl->SetExceededIndexedDatabaseQuotaCallback(callback, user_data);
860 void ewk_view_exceeded_indexed_database_quota_reply(Evas_Object* view, Eina_Bool allow)
862 // Chromium does not support quota for Indexed DB only.
863 // IndexedDB uses temporary storage that is shared
864 // between other features.
865 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
866 impl->ExceededIndexedDatabaseQuotaReply(allow);
869 Eina_Bool ewk_view_text_find(Evas_Object *view, const char *text, Ewk_Find_Options options, unsigned int max_match_count)
871 // FIXME: We need to implement next options in Ewk_Find_Options struct. (refer to ewk_view.h)
872 // - EWK_FIND_OPTIONS_AT_WORD_STARTS
873 // - EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START
874 // - EWK_FIND_OPTIONS_WRAP_AROUND
875 // - EWK_FIND_OPTIONS_SHOW_OVERLAY
876 // - EWK_FIND_OPTIONS_SHOW_FIND_INDICATOR
877 // - EWK_FIND_OPTIONS_SHOW_HIGHLIGHT (Currently there is no way to control this option. so it is always set)
879 // FIXME: Updating of max_match_count is not implemented.
881 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
882 EINA_SAFETY_ON_NULL_RETURN_VAL(text, EINA_FALSE);
883 impl->Find(text, options);
887 Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object *view)
889 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
894 void ewk_view_exceeded_database_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Database_Quota_Callback callback, void* userData)
896 // According to chromium source code:
897 // src/third_party/WebKit/Source/modules/webdatabase/SQLTransactionClient.cpp line 67
898 // Chromium does not allow users to manually change the quota for an origin (for now, at least).
899 // This API is impossible to implement right now
900 LOG_EWK_API_MOCKUP("Not Supported by chromium");
903 void ewk_view_exceeded_database_quota_reply(Evas_Object* ewkView, Eina_Bool allow)
905 // According to chromium source code:
906 // src/third_party/WebKit/Source/modules/webdatabase/SQLTransactionClient.cpp line 67
907 // Chromium does not allow users to manually change the quota for an origin (for now, at least).
908 // This API is impossible to implement right now
909 LOG_EWK_API_MOCKUP("Not Supported by chromium");
912 void ewk_view_exceeded_local_file_system_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, void* userData)
914 LOG_EWK_API_MOCKUP();
917 void ewk_view_exceeded_local_file_system_quota_reply(Evas_Object* ewkView, Eina_Bool allow)
919 LOG_EWK_API_MOCKUP();
922 void ewk_view_unfocus_allow_callback_set(Evas_Object* ewkView, Ewk_View_Unfocus_Allow_Callback callback, void* user_data)
924 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
925 impl->SetViewUnfocusAllowCallback(callback, user_data);
928 void ewk_view_geolocation_permission_callback_set(Evas_Object* ewk_view, Ewk_View_Geolocation_Permission_Callback callback, void* user_data)
930 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
931 impl->SetViewGeolocationPermissionCallback(callback, user_data);
934 static Eina_Bool _ewk_view_default_geolocation_permission(
935 Evas_Object* ewk_view,
936 Ewk_Geolocation_Permission_Request* request,
939 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
941 std::string value = std::string(ewk_security_origin_host_get(
942 ewk_geolocation_permission_request_origin_get(request)));
943 std::string message = std::string(
944 "Web Page (%s) is requesting permission to access your location.");
945 std::string replace_str = std::string("(%s)");
947 size_t pos = message.find(replace_str.c_str());
948 if (pos != std::string::npos)
949 message.replace(pos, replace_str.length(), value.c_str());
951 // add for suspending
952 ewk_geolocation_permission_request_suspend(request);
954 GeolocationPermissionPopup* popup = new GeolocationPermissionPopup(request,
955 ewk_geolocation_permission_request_origin_get(request), message);
957 impl->GetPermissionPopupManager()->AddPermissionRequest(popup);
962 void ewk_view_user_media_permission_callback_set(Evas_Object* ewk_view,
963 Ewk_View_User_Media_Permission_Callback callback,
966 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
967 impl->SetViewUserMediaPermissionCallback(callback, user_data);
970 void ewk_view_user_media_permission_query_callback_set(
971 Evas_Object* ewk_view,
972 Ewk_View_User_Media_Permission_Query_Callback callback,
974 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
975 impl->SetViewUserMediaPermissionQueryCallback(callback, user_data);
978 static Eina_Bool _ewk_view_default_user_media_permission(
979 Evas_Object* ewk_view,
980 Ewk_User_Media_Permission_Request* user_media_permission_request,
983 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
985 std::string message =
986 CreatePermissionMessageRequest(user_media_permission_request);
988 // add for suspending
989 ewk_user_media_permission_request_suspend(user_media_permission_request);
991 UserMediaPermissionPopup* popup = new UserMediaPermissionPopup(
992 user_media_permission_request,
993 ewk_user_media_permission_request_origin_get(
994 user_media_permission_request), message);
996 impl->GetPermissionPopupManager()->AddPermissionRequest(popup);
1001 void ewk_view_use_settings_font(Evas_Object* ewkView)
1003 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1004 impl->UseSettingsFont();
1007 char* ewk_view_get_cookies_for_url(Evas_Object* view, const char* url)
1009 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
1010 EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0);
1011 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(), 0);
1012 std::string cookiesForURL =
1013 impl->context()->cookieManager()->GetCookiesForURL(std::string(url));
1014 if (cookiesForURL.empty())
1016 return strndup(cookiesForURL.c_str(), cookiesForURL.length());
1019 Eina_Bool ewk_view_fullscreen_exit(Evas_Object* view)
1021 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1022 LOG(INFO) << "view: " << view;
1023 impl->ExitFullscreen();
1027 Eina_Bool ewk_view_draws_transparent_background_set(Evas_Object *view, Eina_Bool enabled)
1029 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1030 return impl->SetDrawsTransparentBackground(!!enabled);
1033 void ewk_view_browser_font_set(Evas_Object* ewkView)
1035 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1036 impl->SetBrowserFont();
1039 void ewk_view_session_data_get(Evas_Object* ewkView, const char** data, unsigned* length)
1041 EINA_SAFETY_ON_NULL_RETURN(data);
1042 EINA_SAFETY_ON_NULL_RETURN(length);
1044 EWebView* impl = GetWebViewFromEvasObject(ewkView);
1051 impl->GetSessionData(data, length);
1054 Eina_Bool ewk_view_mode_set(Evas_Object* ewkView, Ewk_View_Mode view_mode)
1056 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
1058 if (view_mode == EWK_VIEW_MODE_WINDOWED) {
1059 #if !defined(EWK_BRINGUP) // FIXME: m67 bringup
1060 impl->SetViewMode(blink::WebViewModeWindowed);
1063 } else if (view_mode == EWK_VIEW_MODE_FULLSCREEN) {
1064 #if !defined(EWK_BRINGUP) // FIXME: m67 bringup
1065 impl->SetViewMode(blink::WebViewModeFullscreen);
1073 Eina_Bool ewk_view_split_scroll_overflow_enabled_set(Evas_Object* ewkView, const Eina_Bool enabled)
1075 LOG_EWK_API_MOCKUP("for browser");
1079 Ewk_Back_Forward_List* ewk_view_back_forward_list_get(const Evas_Object* ewkView)
1081 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, NULL);
1082 return impl->GetBackForwardList();
1085 void ewk_view_notification_permission_callback_set(Evas_Object *o, Ewk_View_Notification_Permission_Callback callback, void *user_data)
1087 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl);
1088 impl->SetNotificationPermissionCallback(callback, user_data);
1091 static Eina_Bool _ewk_view_default_notification_permission(
1092 Evas_Object* ewk_view,
1093 Ewk_Notification_Permission_Request* request,
1096 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
1098 std::string value = std::string(ewk_security_origin_host_get(
1099 ewk_notification_permission_request_origin_get(request)));
1100 std::string message = std::string(
1101 "Web Page (%s) is requesting permission to show notifications.");
1102 std::string replace_str = std::string("(%s)");
1104 size_t pos = message.find(replace_str.c_str());
1105 if (pos != std::string::npos)
1106 message.replace(pos, replace_str.length(), value.c_str());
1108 // add for suspending
1109 ewk_notification_permission_request_suspend(request);
1111 NotificationPermissionPopup* popup = new NotificationPermissionPopup(request,
1112 ewk_notification_permission_request_origin_get(request), message);
1114 impl->GetPermissionPopupManager()->AddPermissionRequest(popup);
1119 void ewk_view_draw_focus_ring_enable_set(Evas_Object* ewkView, Eina_Bool enable)
1121 LOG_EWK_API_MOCKUP("This API is deprecated");
1124 double ewk_view_page_zoom_get(const Evas_Object* ewkView)
1126 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, -1.0);
1127 return impl->GetPageZoomFactor();
1130 Eina_Bool ewk_view_page_zoom_set(Evas_Object* ewkView, double zoomFactor)
1132 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
1133 impl->SetPageZoomFactor(zoomFactor);
1137 Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* context, Ewk_Page_Group* pageGroup)
1139 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
1140 LOG(INFO) << "evas: " << canvas << ", context:" << context;
1141 return CreateWebViewAsEvasObject(context, canvas, smart);
1144 void ewk_view_quota_permission_request_callback_set(Evas_Object* ewkView, Ewk_Quota_Permission_Request_Callback callback, void* user_data)
1146 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1147 impl->SetQuotaPermissionRequestCallback(callback, user_data);
1150 void ewk_view_quota_permission_request_reply(const Ewk_Quota_Permission_Request* request, const Eina_Bool allow)
1152 EINA_SAFETY_ON_NULL_RETURN(request);
1153 Evas_Object* ewkView = request->getView();
1154 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1155 impl->QuotaRequestReply(request, allow == EINA_TRUE);
1158 void ewk_view_quota_permission_request_cancel(const Ewk_Quota_Permission_Request* request)
1160 EINA_SAFETY_ON_NULL_RETURN(request);
1161 Evas_Object* ewkView = request->getView();
1162 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1163 impl->QuotaRequestCancel(request);
1166 Eina_Bool ewk_view_focus_set(const Evas_Object* view, Eina_Bool focused)
1168 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1169 LOG(INFO) << "view: " << view << ", focused:" << (bool)focused;
1170 impl->SetFocus(focused);
1174 Eina_Bool ewk_view_focus_get(const Evas_Object* view)
1176 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1177 return impl->HasFocus();
1180 Eina_Bool ewk_view_page_close(Evas_Object* o)
1182 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
1188 void ewk_view_session_timeout_set(Evas_Object* o, unsigned long timeout)
1190 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl);
1191 impl->SetSessionTimeout(timeout);
1194 Evas_Object* ewk_view_widget_get(Evas_Object* view)
1196 LOG_EWK_API_MOCKUP();
1200 Eina_Bool ewk_view_draws_transparent_background_get(Evas_Object* o)
1202 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
1203 return impl->GetDrawsTransparentBackground();
1206 Eina_Bool ewk_view_did_change_theme_color_callback_set(
1208 Ewk_View_Did_Change_Theme_Color_Callback callback,
1210 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
1211 impl->SetDidChangeThemeColorCallback(callback, user_data);
1215 Eina_Bool ewk_view_split_scroll_overflow_enabled_get(const Evas_Object* o) {
1216 LOG_EWK_API_MOCKUP();
1220 Eina_Bool ewk_view_save_page_as_mhtml(Evas_Object* o, const char* path, Ewk_View_Save_Page_Callback callback, void* user_data)
1222 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
1223 EINA_SAFETY_ON_NULL_RETURN_VAL(path, EINA_FALSE);
1224 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
1225 return impl->SavePageAsMHTML(path, callback, user_data);
1228 void ewk_view_reader_mode_set(Evas_Object* ewk_view, Eina_Bool enable)
1230 LOG_EWK_API_MOCKUP();
1233 Eina_Bool ewk_view_top_controls_height_set(Evas_Object* ewk_view, size_t top_height, size_t bottom_height)
1235 LOG_EWK_API_MOCKUP();
1239 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)
1241 LOG_EWK_API_MOCKUP();
1245 Eina_Bool ewk_view_main_frame_scrollbar_visible_set(Evas_Object* ewk_view,
1246 Eina_Bool visible) {
1247 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
1248 return impl->SetMainFrameScrollbarVisible(!!visible);
1251 Eina_Bool ewk_view_main_frame_scrollbar_visible_get(
1252 Evas_Object* ewk_view,
1253 Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback callback,
1255 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
1256 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
1258 return impl->GetMainFrameScrollbarVisible(callback, user_data);
1261 Eina_Bool ewk_view_set_custom_device_pixel_ratio(Evas_Object* ewkView, Eina_Bool enabled)
1263 LOG_EWK_API_MOCKUP();
1267 Ewk_Board_Decoding_Capabilities ewk_view_board_decoding_capabilities_get(
1268 const Evas_Object* view)
1270 LOG_EWK_API_MOCKUP();
1271 return EWK_BOARD_DECODING_CAPABILITIES_UNKNOWN;
1274 void ewk_view_next_player_for_media_switch_set(
1278 LOG_EWK_API_MOCKUP();
1281 void ewk_view_sw_audio_decoding_set(
1283 Eina_Bool use_sw_audio_decoder)
1285 LOG_EWK_API_MOCKUP();
1288 void ewk_view_set_video_geometry(
1290 Eina_Rectangle v_area)
1292 LOG_EWK_API_MOCKUP();
1295 void ewk_view_release_players(
1298 LOG_EWK_API_MOCKUP();
1301 void ewk_view_player_set_visibility(
1306 LOG_EWK_API_MOCKUP();
1309 void ewk_view_broadcast_set_visibility(
1313 LOG_EWK_API_MOCKUP();
1316 void ewk_view_player_play(
1320 LOG_EWK_API_MOCKUP();
1323 void ewk_view_player_pause(
1327 LOG_EWK_API_MOCKUP();
1330 #if BUILDFLAG(IS_TIZEN_TV)
1331 Eina_Bool ewk_media_translated_url_set(Evas_Object* ewkView, const char* url)
1333 LOG_EWK_API_MOCKUP();
1337 Eina_Bool ewk_view_app_preload_set(Evas_Object* ewkView, Eina_Bool is_preload)
1339 LOG_EWK_API_MOCKUP();
1344 Evas_Object* ewk_view_favicon_get(const Evas_Object* ewkView)
1346 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, nullptr);
1347 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(), nullptr);
1348 const char* url = ewk_view_url_get(ewkView);
1349 return impl->context()->AddFaviconObject(url, impl->GetEvas());
1352 Eina_Bool ewk_view_html_string_override_current_entry_load(Evas_Object* view, const char* html, const char* base_uri, const char* unreachable_url)
1354 #if BUILDFLAG(IS_TIZEN_TV)
1355 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1356 EINA_SAFETY_ON_NULL_RETURN_VAL(html, EINA_FALSE);
1357 impl->LoadHTMLStringOverridingCurrentEntry(html, base_uri, unreachable_url);
1360 LOG_EWK_API_MOCKUP("Only for Tizen TV.");
1365 Eina_Bool ewk_view_text_matches_count(Evas_Object* o, const char* text, Ewk_Find_Options options, unsigned max_match_count)
1367 LOG_EWK_API_MOCKUP();
1371 void ewk_view_mirrored_blur_set(Evas_Object* o, Eina_Bool state)
1373 LOG_EWK_API_MOCKUP();
1376 void ewk_view_add_dynamic_certificate_path(const Evas_Object *ewkView, const char* host, const char* cert_path)
1378 #if BUILDFLAG(IS_TIZEN_TV)
1379 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1380 impl->AddDynamicCertificatePath(std::string(host), std::string(cert_path));
1382 LOG_EWK_API_MOCKUP();
1386 void ewk_view_atk_deactivation_by_app(Evas_Object* view, Eina_Bool enable)
1388 #if BUILDFLAG(IS_TIZEN_TV)
1389 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
1390 LOG(INFO)<< "ewk_view_atk_deactivation_by_app, enable: " << (bool)enable;
1391 impl->DeactivateAtk(enable == EINA_FALSE);
1393 LOG_EWK_API_MOCKUP();
1397 char* ewk_view_cookies_get(Evas_Object* o, const char* url)
1399 LOG_EWK_API_MOCKUP();
1403 void ewk_view_notification_show_callback_set(Evas_Object *o, Ewk_View_Notification_Show_Callback show_callback, void *user_data)
1405 LOG_EWK_API_MOCKUP();
1408 void ewk_view_notification_cancel_callback_set(Evas_Object *o, Ewk_View_Notification_Cancel_Callback cancel_callback, void *user_data)
1410 LOG_EWK_API_MOCKUP();
1413 const char* ewk_view_custom_encoding_get(const Evas_Object* o)
1415 LOG_EWK_API_MOCKUP();
1419 Eina_Bool ewk_view_custom_encoding_set(Evas_Object* o, const char* encoding)
1421 LOG_EWK_API_MOCKUP();
1425 void ewk_view_force_layout(const Evas_Object* o)
1427 LOG_EWK_API_MOCKUP();
1430 Eina_Bool ewk_view_send_key_event(Evas_Object* ewk_view, void* key_event, Eina_Bool is_press) {
1431 LOG_EWK_API_MOCKUP();
1435 Eina_Bool ewk_view_tts_mode_set(Evas_Object* view, ewk_tts_mode tts_mode) {
1436 #if defined(TIZEN_WEB_SPEECH_RECOGNITION)
1438 case EWK_TTS_MODE_DEFAULT:
1439 content::TtsPlatformImplTizen::SetTtsMode(TTS_MODE_DEFAULT);
1441 case EWK_TTS_MODE_NOTIFICATION:
1442 content::TtsPlatformImplTizen::SetTtsMode(TTS_MODE_NOTIFICATION);
1444 case EWK_TTS_MODE_SCREEN_READER:
1445 content::TtsPlatformImplTizen::SetTtsMode(TTS_MODE_SCREEN_READER);
1448 LOG(ERROR) << "Not supported TTS mode: " << static_cast<int>(tts_mode);
1453 LOG_EWK_API_MOCKUP("API unavailable.");
1458 Eina_Bool ewk_view_javascript_message_handler_add(
1460 Ewk_View_Script_Message_Cb callback,
1462 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1463 EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
1464 return impl->AddJavaScriptMessageHandler(view, callback, std::string(name));
1467 Eina_Bool ewk_view_evaluate_javascript(Evas_Object* view,
1469 const char* result) {
1470 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1471 EINA_SAFETY_ON_NULL_RETURN_VAL(result, EINA_FALSE);
1472 EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
1474 std::string function(name);
1475 std::string data(result);
1476 std::string pattern("\n");
1477 std::string replace("</br>");
1478 std::string::size_type pos = 0;
1479 std::string::size_type offset = 0;
1480 while ((pos = data.find(pattern, offset)) != std::string::npos) {
1481 data.replace(data.begin() + pos, data.begin() + pos + pattern.size(),
1483 offset = pos + replace.size();
1486 // For JSON Object or Array.
1487 if (result[0] == '{' || result[0] == '[') {
1488 data = "javascript:" + function + "(JSON.parse('" + data + "'))";
1490 data = "javascript:" + function + "('" + data + "')";
1493 return impl->ExecuteJavaScript(data.c_str(), NULL, 0);
1496 void ewk_view_authentication_callback_set(
1497 Evas_Object* ewk_view,
1498 Ewk_View_Authentication_Callback callback,
1501 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
1502 impl->SetViewAuthCallback(callback, user_data);
1506 static void _ewk_view_default_authentication(Evas_Object* ewk_view,
1507 Ewk_Auth_Challenge* auth_challenge,
1510 AuthenticationChallengePopup::CreateAndShow(auth_challenge, ewk_view);
1513 void ewk_view_app_installation_request_callback_set(Evas_Object* o, Ewk_App_Installation_Request_Callback callback, void* user_data)
1515 LOG_EWK_API_MOCKUP();
1518 Eina_Bool ewk_view_bg_color_set(Evas_Object* o, int r, int g, int b, int a) {
1519 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
1520 if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255 || a < 0 ||
1522 LOG(ERROR) << "Invalid background color";
1525 return impl->SetBackgroundColor(r, g, b, a);
1528 Eina_Bool ewk_view_key_events_enabled_set(Evas_Object* o, Eina_Bool enabled) {
1529 LOG_EWK_API_MOCKUP();
1533 Eina_Bool ewk_view_bg_color_get(Evas_Object* view,
1534 Ewk_View_Background_Color_Get_Callback callback,
1536 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
1537 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1539 return impl->GetBackgroundColor(callback, user_data);
1542 void ewk_view_clear_all_tiles_resources(Evas_Object* ewkView) {
1543 #if BUILDFLAG(IS_TIZEN_TV)
1544 LOG(INFO) << "view: " << ewkView;
1546 LOG_EWK_API_MOCKUP();
1550 Eina_Bool ewk_view_edge_scroll_by(Evas_Object *ewkView, int dx, int dy)
1552 LOG_EWK_API_MOCKUP();
1553 #if BUILDFLAG(IS_TIZEN_TV)
1554 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
1555 LOG(INFO) << "view: " << ewkView << ", dx:" << dx << ", dy:" << dy;
1556 return impl->EdgeScrollBy(dx, dy);
1558 LOG_EWK_API_MOCKUP("edge_scroll_by feature is not enabled");
1563 Eina_Bool ewk_view_set_support_video_hole(Evas_Object* ewkView,
1566 Eina_Bool isVideoWindow) {
1567 LOG_EWK_API_MOCKUP();
1568 #if defined(TIZEN_VIDEO_HOLE)
1569 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
1570 LOG(INFO) << "view: " << ewkView << ", enable:" << (bool)enable;
1571 // Video hole is set false by default. So further calls are not needed
1572 // if |enable| is false.
1573 if (enable == EINA_FALSE)
1576 impl->EnableVideoHoleSupport();
1577 media::VideoPlaneController::SetSharedVideoWindowHandle(
1579 static_cast<media::VideoPlaneController::RenderingMode>(isVideoWindow));
1582 LOG_EWK_API_MOCKUP("Video Hole feature is not enabled");
1587 void ewk_view_set_cursor_by_client(Evas_Object* ewkView, Eina_Bool enable) {}
1589 void ewk_view_widget_pepper_extension_callback_set(Evas_Object* ewk_view, Generic_Sync_Call_Callback cb, void* user_data) {
1590 #if defined(TIZEN_PEPPER_EXTENSIONS) && BUILDFLAG(IS_TIZEN_TV)
1591 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
1592 impl->SetPepperExtensionCallback(cb, user_data);
1594 NOTIMPLEMENTED() << "This API is only available with TIZEN_PEPPER_EXTENSIONS"
1595 << " macro on TIZEN_TV products.";
1599 void ewk_view_widget_pepper_extension_info_set(Evas_Object* ewk_view, Ewk_Value widget_pepper_ext_info) {
1600 #if defined(TIZEN_PEPPER_EXTENSIONS) && BUILDFLAG(IS_TIZEN_TV)
1601 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
1602 impl->SetPepperExtensionWidgetInfo(widget_pepper_ext_info);
1604 NOTIMPLEMENTED() << "This API is only available with TIZEN_PEPPER_EXTENSIONS"
1605 << " macro on TIZEN_TV products.";
1609 void ewk_view_resume_network_loading(Evas_Object* ewkView)
1611 LOG_EWK_API_MOCKUP();
1614 void ewk_view_suspend_network_loading(Evas_Object* ewkView)
1616 LOG_EWK_API_MOCKUP();
1619 void ewk_view_offscreen_rendering_enabled_set(Evas_Object* o, Eina_Bool enabled)
1621 #if defined(TIZEN_TBM_SUPPORT)
1622 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl);
1623 impl->SetOffscreenRendering(enabled);
1625 LOG_EWK_API_MOCKUP();
1629 void ewk_view_ime_window_set(Evas_Object* o, void* window)
1631 LOG_EWK_API_MOCKUP();
1634 void ewk_view_smartrc_show_mic_notification_callback_set(Evas_Object* o, Ewk_View_SmartRC_Mic_Notification_Callback callback, void* user_data)
1636 LOG_EWK_API_MOCKUP();
1639 Eina_Bool ewk_view_set_support_canvas_hole(Evas_Object* ewkView, const char* url)
1641 LOG_EWK_API_MOCKUP();
1645 void ewk_view_tile_cover_area_multiplier_set(Evas_Object* ewkView,
1646 float cover_area_multiplier) {
1647 LOG_EWK_API_MOCKUP();
1650 Eina_Bool ewk_view_marlin_enable_set(Evas_Object* ewkView, Eina_Bool is_enable)
1652 LOG_EWK_API_MOCKUP();
1656 Eina_Bool ewk_view_key_system_whitelist_set(Evas_Object* ewkView, const char** list, unsigned list_size)
1658 LOG_EWK_API_MOCKUP();
1662 Eina_Bool ewk_view_is_video_playing(Evas_Object* o, Ewk_Is_Video_Playing_Callback callback, void* user_data)
1664 LOG_EWK_API_MOCKUP();
1668 Eina_Bool ewk_view_stop_video(Evas_Object* o, Ewk_Stop_Video_Callback callback, void* user_data)
1670 LOG_EWK_API_MOCKUP();
1674 Eina_Bool ewk_view_active_drm_set(Evas_Object* view, const char* drm_system_id)
1676 LOG_EWK_API_MOCKUP();
1680 void ewk_view_broadcast_decoder_set(
1682 Ewk_Hardware_Decoders decoder)
1684 #if BUILDFLAG(IS_TIZEN_TV)
1685 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
1686 /* waiting for implement*/
1687 //impl->SetBroadcastDecoder(decoder);
1689 LOG_EWK_API_MOCKUP("Only for Tizen TV.");
1693 void ewk_media_set_subtitle_lang(Evas_Object* ewkView, const char* lang_list)
1695 LOG_EWK_API_MOCKUP();
1698 void ewk_media_set_parental_rating_result(Evas_Object* ewkView, const char* url, Eina_Bool is_pass)
1700 LOG_EWK_API_MOCKUP();
1703 void ewk_media_start_with_high_bit_rate(Evas_Object* ewkView, Eina_Bool is_high_bitrate)
1705 LOG_EWK_API_MOCKUP();
1708 double ewk_view_media_current_time_get(const Evas_Object *o)
1710 LOG_EWK_API_MOCKUP();
1714 void ewk_view_request_canvas_fullscreen(Evas_Object* ewkView)
1716 LOG_EWK_API_MOCKUP();
1719 void ewk_view_360video_play(Evas_Object* ewkView)
1721 LOG_EWK_API_MOCKUP();
1724 void ewk_view_360video_pause(Evas_Object* ewkView)
1726 LOG_EWK_API_MOCKUP();
1729 void ewk_view_360video_duration(Evas_Object* ewkView, Ewk_360_Video_Duration_Callback callback, void* user_data)
1731 LOG_EWK_API_MOCKUP();
1734 void ewk_view_360video_current_time(Evas_Object* ewkView, Ewk_360_Video_CurrentTime_Callback callback, void* user_data)
1736 LOG_EWK_API_MOCKUP();
1739 void ewk_view_360video_set_current_time(Evas_Object* ewkView, double current_time)
1741 LOG_EWK_API_MOCKUP();
1744 Eina_Bool ewk_view_script_execute_all_frames(Evas_Object *o, const char *script, Ewk_View_Script_Execute_Cb callback, void *user_data)
1746 #if BUILDFLAG(IS_TIZEN_TV)
1747 LOG(INFO) << ", view: " << o;
1749 LOG_EWK_API_MOCKUP();
1754 void ewk_view_voicemanager_label_draw(Evas_Object* view,
1756 Eina_Rectangle rect) {
1757 #if BUILDFLAG(IS_TIZEN_TV)
1758 EINA_SAFETY_ON_NULL_RETURN(image);
1759 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
1760 impl->DrawLabel(image, rect);
1762 LOG_EWK_API_MOCKUP("Only for Tizen TV.");
1766 void ewk_view_voicemanager_labels_clear(Evas_Object* view) {
1767 #if BUILDFLAG(IS_TIZEN_TV)
1768 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
1769 impl->ClearLabels();
1771 LOG_EWK_API_MOCKUP("Only for Tizen TV.");
1775 void ewk_view_floating_window_state_changed(const Evas_Object *view, Eina_Bool status)
1777 #if BUILDFLAG(IS_TIZEN_TV)
1778 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
1779 LOG(INFO) << __FUNCTION__ << ", view: "<< view << ", status: " << status;
1780 impl->SetFloatVideoWindowState(status);
1782 LOG_EWK_API_MOCKUP();
1786 void ewk_view_feed_mouse_down(Evas_Object* view,
1787 Ewk_Mouse_Button_Type button,
1790 LOG_EWK_API_MOCKUP("NUI feature is not enabled");
1793 void ewk_view_feed_mouse_up(Evas_Object* view,
1794 Ewk_Mouse_Button_Type button,
1797 LOG_EWK_API_MOCKUP("NUI feature is not enabled");
1800 void ewk_view_feed_mouse_move(Evas_Object* view, int x, int y) {
1801 LOG_EWK_API_MOCKUP("NUI feature is not enabled");
1804 void ewk_view_feed_mouse_wheel(Evas_Object* view,
1805 Eina_Bool y_direction,
1809 LOG_EWK_API_MOCKUP("NUI feature is not enabled");
1812 void ewk_view_auto_login(Evas_Object *view, const char* user_name, const char* password)
1814 LOG_EWK_API_MOCKUP("This API is not supported.");
1817 void ewk_view_request_manifest(Evas_Object* o,
1818 Ewk_View_Request_Manifest_Callback callback,
1820 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl);
1821 impl->RequestManifest(callback, user_data);
1824 void ewk_view_media_device_list_get(Evas_Object* o, Ewk_Media_Device_List_Get_Callback callback, void* user_data) {
1828 void ewk_view_run_mixed_content_confirm_callback_set(
1829 Evas_Object* /* ewkView */,
1830 Ewk_View_Run_Mixed_Content_Confirm_Callback /* callback */,
1831 void* /* user_data */) {}
1833 void ewk_view_error_page_load_callback_set(Evas_Object* ewk_view, Ewk_View_Error_Page_Load_Callback callback, void* user_data)
1835 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
1836 EINA_SAFETY_ON_NULL_RETURN(callback);
1837 impl->SetViewLoadErrorPageCallback(callback, user_data);
1840 Eina_Bool ewk_view_add_item_to_back_forward_list(Evas_Object* o, const Ewk_Back_Forward_List_Item* item)
1845 void ewk_view_poweroff_suspend(Evas_Object *item) {}