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 impl->SetDrawsTransparentBackground(enabled);
1034 void ewk_view_browser_font_set(Evas_Object* ewkView)
1036 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1037 impl->SetBrowserFont();
1040 void ewk_view_session_data_get(Evas_Object* ewkView, const char** data, unsigned* length)
1042 EINA_SAFETY_ON_NULL_RETURN(data);
1043 EINA_SAFETY_ON_NULL_RETURN(length);
1045 EWebView* impl = GetWebViewFromEvasObject(ewkView);
1052 impl->GetSessionData(data, length);
1055 Eina_Bool ewk_view_mode_set(Evas_Object* ewkView, Ewk_View_Mode view_mode)
1057 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
1059 if (view_mode == EWK_VIEW_MODE_WINDOWED) {
1060 #if !defined(EWK_BRINGUP) // FIXME: m67 bringup
1061 impl->SetViewMode(blink::WebViewModeWindowed);
1064 } else if (view_mode == EWK_VIEW_MODE_FULLSCREEN) {
1065 #if !defined(EWK_BRINGUP) // FIXME: m67 bringup
1066 impl->SetViewMode(blink::WebViewModeFullscreen);
1074 Eina_Bool ewk_view_split_scroll_overflow_enabled_set(Evas_Object* ewkView, const Eina_Bool enabled)
1076 LOG_EWK_API_MOCKUP("for browser");
1080 Ewk_Back_Forward_List* ewk_view_back_forward_list_get(const Evas_Object* ewkView)
1082 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, NULL);
1083 return impl->GetBackForwardList();
1086 void ewk_view_notification_permission_callback_set(Evas_Object *o, Ewk_View_Notification_Permission_Callback callback, void *user_data)
1088 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl);
1089 impl->SetNotificationPermissionCallback(callback, user_data);
1092 static Eina_Bool _ewk_view_default_notification_permission(
1093 Evas_Object* ewk_view,
1094 Ewk_Notification_Permission_Request* request,
1097 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
1099 std::string value = std::string(ewk_security_origin_host_get(
1100 ewk_notification_permission_request_origin_get(request)));
1101 std::string message = std::string(
1102 "Web Page (%s) is requesting permission to show notifications.");
1103 std::string replace_str = std::string("(%s)");
1105 size_t pos = message.find(replace_str.c_str());
1106 if (pos != std::string::npos)
1107 message.replace(pos, replace_str.length(), value.c_str());
1109 // add for suspending
1110 ewk_notification_permission_request_suspend(request);
1112 NotificationPermissionPopup* popup = new NotificationPermissionPopup(request,
1113 ewk_notification_permission_request_origin_get(request), message);
1115 impl->GetPermissionPopupManager()->AddPermissionRequest(popup);
1120 void ewk_view_draw_focus_ring_enable_set(Evas_Object* ewkView, Eina_Bool enable)
1122 LOG_EWK_API_MOCKUP("This API is deprecated");
1125 double ewk_view_page_zoom_get(const Evas_Object* ewkView)
1127 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, -1.0);
1128 return impl->GetPageZoomFactor();
1131 Eina_Bool ewk_view_page_zoom_set(Evas_Object* ewkView, double zoomFactor)
1133 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
1134 impl->SetPageZoomFactor(zoomFactor);
1138 Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* context, Ewk_Page_Group* pageGroup)
1140 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
1141 LOG(INFO) << "evas: " << canvas << ", context:" << context;
1142 return CreateWebViewAsEvasObject(context, canvas, smart);
1145 void ewk_view_quota_permission_request_callback_set(Evas_Object* ewkView, Ewk_Quota_Permission_Request_Callback callback, void* user_data)
1147 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1148 impl->SetQuotaPermissionRequestCallback(callback, user_data);
1151 void ewk_view_quota_permission_request_reply(const Ewk_Quota_Permission_Request* request, const Eina_Bool allow)
1153 EINA_SAFETY_ON_NULL_RETURN(request);
1154 Evas_Object* ewkView = request->getView();
1155 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1156 impl->QuotaRequestReply(request, allow == EINA_TRUE);
1159 void ewk_view_quota_permission_request_cancel(const Ewk_Quota_Permission_Request* request)
1161 EINA_SAFETY_ON_NULL_RETURN(request);
1162 Evas_Object* ewkView = request->getView();
1163 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1164 impl->QuotaRequestCancel(request);
1167 Eina_Bool ewk_view_focus_set(const Evas_Object* view, Eina_Bool focused)
1169 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1170 LOG(INFO) << "view: " << view << ", focused:" << (bool)focused;
1171 impl->SetFocus(focused);
1175 Eina_Bool ewk_view_focus_get(const Evas_Object* view)
1177 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1178 return impl->HasFocus();
1181 Eina_Bool ewk_view_page_close(Evas_Object* o)
1183 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
1189 void ewk_view_session_timeout_set(Evas_Object* o, unsigned long timeout)
1191 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl);
1192 impl->SetSessionTimeout(timeout);
1195 Evas_Object* ewk_view_widget_get(Evas_Object* view)
1197 LOG_EWK_API_MOCKUP();
1201 Eina_Bool ewk_view_draws_transparent_background_get(Evas_Object* o)
1203 LOG_EWK_API_MOCKUP();
1207 Eina_Bool ewk_view_did_change_theme_color_callback_set(
1209 Ewk_View_Did_Change_Theme_Color_Callback callback,
1211 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
1212 impl->SetDidChangeThemeColorCallback(callback, user_data);
1216 Eina_Bool ewk_view_split_scroll_overflow_enabled_get(const Evas_Object* o) {
1217 LOG_EWK_API_MOCKUP();
1221 Eina_Bool ewk_view_save_page_as_mhtml(Evas_Object* o, const char* path, Ewk_View_Save_Page_Callback callback, void* user_data)
1223 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
1224 EINA_SAFETY_ON_NULL_RETURN_VAL(path, EINA_FALSE);
1225 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
1226 return impl->SavePageAsMHTML(path, callback, user_data);
1229 void ewk_view_reader_mode_set(Evas_Object* ewk_view, Eina_Bool enable)
1231 LOG_EWK_API_MOCKUP();
1234 Eina_Bool ewk_view_top_controls_height_set(Evas_Object* ewk_view, size_t top_height, size_t bottom_height)
1236 LOG_EWK_API_MOCKUP();
1240 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)
1242 LOG_EWK_API_MOCKUP();
1246 Eina_Bool ewk_view_main_frame_scrollbar_visible_set(Evas_Object* ewk_view,
1247 Eina_Bool visible) {
1248 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
1249 return impl->SetMainFrameScrollbarVisible(!!visible);
1252 Eina_Bool ewk_view_main_frame_scrollbar_visible_get(
1253 Evas_Object* ewk_view,
1254 Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback callback,
1256 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
1257 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
1259 return impl->GetMainFrameScrollbarVisible(callback, user_data);
1262 Eina_Bool ewk_view_set_custom_device_pixel_ratio(Evas_Object* ewkView, Eina_Bool enabled)
1264 LOG_EWK_API_MOCKUP();
1268 Ewk_Board_Decoding_Capabilities ewk_view_board_decoding_capabilities_get(
1269 const Evas_Object* view)
1271 LOG_EWK_API_MOCKUP();
1272 return EWK_BOARD_DECODING_CAPABILITIES_UNKNOWN;
1275 void ewk_view_next_player_for_media_switch_set(
1279 LOG_EWK_API_MOCKUP();
1282 void ewk_view_sw_audio_decoding_set(
1284 Eina_Bool use_sw_audio_decoder)
1286 LOG_EWK_API_MOCKUP();
1289 void ewk_view_set_video_geometry(
1291 Eina_Rectangle v_area)
1293 LOG_EWK_API_MOCKUP();
1296 void ewk_view_release_players(
1299 LOG_EWK_API_MOCKUP();
1302 void ewk_view_player_set_visibility(
1307 LOG_EWK_API_MOCKUP();
1310 void ewk_view_broadcast_set_visibility(
1314 LOG_EWK_API_MOCKUP();
1317 void ewk_view_player_play(
1321 LOG_EWK_API_MOCKUP();
1324 void ewk_view_player_pause(
1328 LOG_EWK_API_MOCKUP();
1331 #if BUILDFLAG(IS_TIZEN_TV)
1332 Eina_Bool ewk_media_translated_url_set(Evas_Object* ewkView, const char* url)
1334 LOG_EWK_API_MOCKUP();
1338 Eina_Bool ewk_view_app_preload_set(Evas_Object* ewkView, Eina_Bool is_preload)
1340 LOG_EWK_API_MOCKUP();
1345 Evas_Object* ewk_view_favicon_get(const Evas_Object* ewkView)
1347 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, nullptr);
1348 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(), nullptr);
1349 const char* url = ewk_view_url_get(ewkView);
1350 return impl->context()->AddFaviconObject(url, impl->GetEvas());
1353 Eina_Bool ewk_view_html_string_override_current_entry_load(Evas_Object* view, const char* html, const char* base_uri, const char* unreachable_url)
1355 #if BUILDFLAG(IS_TIZEN_TV)
1356 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1357 EINA_SAFETY_ON_NULL_RETURN_VAL(html, EINA_FALSE);
1358 impl->LoadHTMLStringOverridingCurrentEntry(html, base_uri, unreachable_url);
1361 LOG_EWK_API_MOCKUP("Only for Tizen TV.");
1366 Eina_Bool ewk_view_text_matches_count(Evas_Object* o, const char* text, Ewk_Find_Options options, unsigned max_match_count)
1368 LOG_EWK_API_MOCKUP();
1372 void ewk_view_mirrored_blur_set(Evas_Object* o, Eina_Bool state)
1374 LOG_EWK_API_MOCKUP();
1377 void ewk_view_add_dynamic_certificate_path(const Evas_Object *ewkView, const char* host, const char* cert_path)
1379 #if BUILDFLAG(IS_TIZEN_TV)
1380 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1381 impl->AddDynamicCertificatePath(std::string(host), std::string(cert_path));
1383 LOG_EWK_API_MOCKUP();
1387 void ewk_view_atk_deactivation_by_app(Evas_Object* view, Eina_Bool enable)
1389 #if BUILDFLAG(IS_TIZEN_TV)
1390 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
1391 LOG(INFO)<< "ewk_view_atk_deactivation_by_app, enable: " << (bool)enable;
1392 impl->DeactivateAtk(enable == EINA_FALSE);
1394 LOG_EWK_API_MOCKUP();
1398 char* ewk_view_cookies_get(Evas_Object* o, const char* url)
1400 LOG_EWK_API_MOCKUP();
1404 void ewk_view_notification_show_callback_set(Evas_Object *o, Ewk_View_Notification_Show_Callback show_callback, void *user_data)
1406 LOG_EWK_API_MOCKUP();
1409 void ewk_view_notification_cancel_callback_set(Evas_Object *o, Ewk_View_Notification_Cancel_Callback cancel_callback, void *user_data)
1411 LOG_EWK_API_MOCKUP();
1414 const char* ewk_view_custom_encoding_get(const Evas_Object* o)
1416 LOG_EWK_API_MOCKUP();
1420 Eina_Bool ewk_view_custom_encoding_set(Evas_Object* o, const char* encoding)
1422 LOG_EWK_API_MOCKUP();
1426 void ewk_view_force_layout(const Evas_Object* o)
1428 LOG_EWK_API_MOCKUP();
1431 Eina_Bool ewk_view_send_key_event(Evas_Object* ewk_view, void* key_event, Eina_Bool is_press) {
1432 LOG_EWK_API_MOCKUP();
1436 Eina_Bool ewk_view_tts_mode_set(Evas_Object* view, ewk_tts_mode tts_mode) {
1437 #if defined(TIZEN_WEB_SPEECH_RECOGNITION)
1439 case EWK_TTS_MODE_DEFAULT:
1440 content::TtsPlatformImplTizen::SetTtsMode(TTS_MODE_DEFAULT);
1442 case EWK_TTS_MODE_NOTIFICATION:
1443 content::TtsPlatformImplTizen::SetTtsMode(TTS_MODE_NOTIFICATION);
1445 case EWK_TTS_MODE_SCREEN_READER:
1446 content::TtsPlatformImplTizen::SetTtsMode(TTS_MODE_SCREEN_READER);
1449 LOG(ERROR) << "Not supported TTS mode: " << static_cast<int>(tts_mode);
1454 LOG_EWK_API_MOCKUP("API unavailable.");
1459 Eina_Bool ewk_view_javascript_message_handler_add(
1461 Ewk_View_Script_Message_Cb callback,
1463 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1464 EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
1465 return impl->AddJavaScriptMessageHandler(view, callback, std::string(name));
1468 Eina_Bool ewk_view_evaluate_javascript(Evas_Object* view,
1470 const char* result) {
1471 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1472 EINA_SAFETY_ON_NULL_RETURN_VAL(result, EINA_FALSE);
1473 EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
1475 std::string function(name);
1476 std::string data(result);
1477 std::string pattern("\n");
1478 std::string replace("</br>");
1479 std::string::size_type pos = 0;
1480 std::string::size_type offset = 0;
1481 while ((pos = data.find(pattern, offset)) != std::string::npos) {
1482 data.replace(data.begin() + pos, data.begin() + pos + pattern.size(),
1484 offset = pos + replace.size();
1487 // For JSON Object or Array.
1488 if (result[0] == '{' || result[0] == '[') {
1489 data = "javascript:" + function + "(JSON.parse('" + data + "'))";
1491 data = "javascript:" + function + "('" + data + "')";
1494 return impl->ExecuteJavaScript(data.c_str(), NULL, 0);
1497 void ewk_view_authentication_callback_set(
1498 Evas_Object* ewk_view,
1499 Ewk_View_Authentication_Callback callback,
1502 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
1503 impl->SetViewAuthCallback(callback, user_data);
1507 static void _ewk_view_default_authentication(Evas_Object* ewk_view,
1508 Ewk_Auth_Challenge* auth_challenge,
1511 AuthenticationChallengePopup::CreateAndShow(auth_challenge, ewk_view);
1514 void ewk_view_app_installation_request_callback_set(Evas_Object* o, Ewk_App_Installation_Request_Callback callback, void* user_data)
1516 LOG_EWK_API_MOCKUP();
1519 Eina_Bool ewk_view_bg_color_set(Evas_Object* o, int r, int g, int b, int a) {
1520 LOG_EWK_API_MOCKUP("This will be implemented soon");
1524 Eina_Bool ewk_view_key_events_enabled_set(Evas_Object* o, Eina_Bool enabled) {
1525 LOG_EWK_API_MOCKUP();
1529 Eina_Bool ewk_view_bg_color_get(Evas_Object* view,
1530 Ewk_View_Background_Color_Get_Callback callback,
1532 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
1533 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
1535 return impl->GetBackgroundColor(callback, user_data);
1538 void ewk_view_clear_all_tiles_resources(Evas_Object* ewkView) {
1539 #if BUILDFLAG(IS_TIZEN_TV)
1540 LOG(INFO) << "view: " << ewkView;
1542 LOG_EWK_API_MOCKUP();
1546 Eina_Bool ewk_view_edge_scroll_by(Evas_Object *ewkView, int dx, int dy)
1548 LOG_EWK_API_MOCKUP();
1552 Eina_Bool ewk_view_set_support_video_hole(Evas_Object* ewkView,
1555 Eina_Bool isVideoWindow) {
1556 LOG_EWK_API_MOCKUP();
1557 #if defined(TIZEN_VIDEO_HOLE)
1558 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
1559 LOG(INFO) << "view: " << ewkView << ", enable:" << (bool)enable;
1560 // Video hole is set false by default. So further calls are not needed
1561 // if |enable| is false.
1562 if (enable == EINA_FALSE)
1565 impl->EnableVideoHoleSupport();
1566 media::VideoPlaneController::SetSharedVideoWindowHandle(
1568 static_cast<media::VideoPlaneController::RenderingMode>(isVideoWindow));
1571 LOG_EWK_API_MOCKUP("Video Hole feature is not enabled");
1576 void ewk_view_set_cursor_by_client(Evas_Object* ewkView, Eina_Bool enable) {}
1578 void ewk_view_widget_pepper_extension_callback_set(Evas_Object* ewk_view, Generic_Sync_Call_Callback cb, void* user_data) {
1579 #if defined(TIZEN_PEPPER_EXTENSIONS) && defined(OS_TIZEN_TV_PRODUCT)
1580 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
1581 impl->SetPepperExtensionCallback(cb, user_data);
1583 NOTIMPLEMENTED() << "This API is only available with TIZEN_PEPPER_EXTENSIONS"
1584 << " macro on TIZEN_TV products.";
1588 void ewk_view_widget_pepper_extension_info_set(Evas_Object* ewk_view, Ewk_Value widget_pepper_ext_info) {
1589 #if defined(TIZEN_PEPPER_EXTENSIONS) && defined(OS_TIZEN_TV_PRODUCT)
1590 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
1591 impl->SetPepperExtensionWidgetInfo(widget_pepper_ext_info);
1593 NOTIMPLEMENTED() << "This API is only available with TIZEN_PEPPER_EXTENSIONS"
1594 << " macro on TIZEN_TV products.";
1598 void ewk_view_resume_network_loading(Evas_Object* ewkView)
1600 LOG_EWK_API_MOCKUP();
1603 void ewk_view_suspend_network_loading(Evas_Object* ewkView)
1605 LOG_EWK_API_MOCKUP();
1608 void ewk_view_offscreen_rendering_enabled_set(Evas_Object* o, Eina_Bool enabled)
1610 #if defined(TIZEN_TBM_SUPPORT)
1611 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl);
1612 impl->SetOffscreenRendering(enabled);
1614 LOG_EWK_API_MOCKUP();
1618 void ewk_view_ime_window_set(Evas_Object* o, void* window)
1620 LOG_EWK_API_MOCKUP();
1623 void ewk_view_smartrc_show_mic_notification_callback_set(Evas_Object* o, Ewk_View_SmartRC_Mic_Notification_Callback callback, void* user_data)
1625 LOG_EWK_API_MOCKUP();
1628 Eina_Bool ewk_view_set_support_canvas_hole(Evas_Object* ewkView, const char* url)
1630 LOG_EWK_API_MOCKUP();
1634 void ewk_view_tile_cover_area_multiplier_set(Evas_Object* ewkView,
1635 float cover_area_multiplier) {
1636 LOG_EWK_API_MOCKUP();
1639 Eina_Bool ewk_view_marlin_enable_set(Evas_Object* ewkView, Eina_Bool is_enable)
1641 LOG_EWK_API_MOCKUP();
1645 Eina_Bool ewk_view_key_system_whitelist_set(Evas_Object* ewkView, const char** list, unsigned list_size)
1647 LOG_EWK_API_MOCKUP();
1651 Eina_Bool ewk_view_is_video_playing(Evas_Object* o, Ewk_Is_Video_Playing_Callback callback, void* user_data)
1653 LOG_EWK_API_MOCKUP();
1657 Eina_Bool ewk_view_stop_video(Evas_Object* o, Ewk_Stop_Video_Callback callback, void* user_data)
1659 LOG_EWK_API_MOCKUP();
1663 Eina_Bool ewk_view_active_drm_set(Evas_Object* view, const char* drm_system_id)
1665 LOG_EWK_API_MOCKUP();
1669 void ewk_view_broadcast_decoder_set(
1671 Ewk_Hardware_Decoders decoder)
1673 #if BUILDFLAG(IS_TIZEN_TV)
1674 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
1675 /* waiting for implement*/
1676 //impl->SetBroadcastDecoder(decoder);
1678 LOG_EWK_API_MOCKUP("Only for Tizen TV.");
1682 void ewk_media_set_subtitle_lang(Evas_Object* ewkView, const char* lang_list)
1684 LOG_EWK_API_MOCKUP();
1687 void ewk_media_set_parental_rating_result(Evas_Object* ewkView, const char* url, Eina_Bool is_pass)
1689 LOG_EWK_API_MOCKUP();
1692 void ewk_media_start_with_high_bit_rate(Evas_Object* ewkView, Eina_Bool is_high_bitrate)
1694 LOG_EWK_API_MOCKUP();
1697 double ewk_view_media_current_time_get(const Evas_Object *o)
1699 LOG_EWK_API_MOCKUP();
1703 void ewk_view_request_canvas_fullscreen(Evas_Object* ewkView)
1705 LOG_EWK_API_MOCKUP();
1708 void ewk_view_360video_play(Evas_Object* ewkView)
1710 LOG_EWK_API_MOCKUP();
1713 void ewk_view_360video_pause(Evas_Object* ewkView)
1715 LOG_EWK_API_MOCKUP();
1718 void ewk_view_360video_duration(Evas_Object* ewkView, Ewk_360_Video_Duration_Callback callback, void* user_data)
1720 LOG_EWK_API_MOCKUP();
1723 void ewk_view_360video_current_time(Evas_Object* ewkView, Ewk_360_Video_CurrentTime_Callback callback, void* user_data)
1725 LOG_EWK_API_MOCKUP();
1728 void ewk_view_360video_set_current_time(Evas_Object* ewkView, double current_time)
1730 LOG_EWK_API_MOCKUP();
1733 Eina_Bool ewk_view_script_execute_all_frames(Evas_Object *o, const char *script, Ewk_View_Script_Execute_Cb callback, void *user_data)
1735 #if BUILDFLAG(IS_TIZEN_TV)
1736 LOG(INFO) << ", view: " << o;
1738 LOG_EWK_API_MOCKUP();
1743 void ewk_view_voicemanager_label_draw(Evas_Object* view,
1745 Eina_Rectangle rect) {
1746 #if BUILDFLAG(IS_TIZEN_TV)
1747 EINA_SAFETY_ON_NULL_RETURN(image);
1748 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
1749 impl->DrawLabel(image, rect);
1751 LOG_EWK_API_MOCKUP("Only for Tizen TV.");
1755 void ewk_view_voicemanager_labels_clear(Evas_Object* view) {
1756 #if BUILDFLAG(IS_TIZEN_TV)
1757 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
1758 impl->ClearLabels();
1760 LOG_EWK_API_MOCKUP("Only for Tizen TV.");
1764 void ewk_view_floating_window_state_changed(const Evas_Object *o, Eina_Bool status)
1766 #if BUILDFLAG(IS_TIZEN_TV)
1767 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl);
1769 LOG_EWK_API_MOCKUP();
1773 void ewk_view_feed_mouse_down(Evas_Object* view,
1774 Ewk_Mouse_Button_Type button,
1777 LOG_EWK_API_MOCKUP("NUI feature is not enabled");
1780 void ewk_view_feed_mouse_up(Evas_Object* view,
1781 Ewk_Mouse_Button_Type button,
1784 LOG_EWK_API_MOCKUP("NUI feature is not enabled");
1787 void ewk_view_feed_mouse_move(Evas_Object* view, int x, int y) {
1788 LOG_EWK_API_MOCKUP("NUI feature is not enabled");
1791 void ewk_view_feed_mouse_wheel(Evas_Object* view,
1792 Eina_Bool y_direction,
1796 LOG_EWK_API_MOCKUP("NUI feature is not enabled");
1799 void ewk_view_auto_login(Evas_Object *view, const char* user_name, const char* password)
1801 LOG_EWK_API_MOCKUP("This API is not supported.");
1804 void ewk_view_request_manifest(Evas_Object* o,
1805 Ewk_View_Request_Manifest_Callback callback,
1807 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl);
1808 impl->RequestManifest(callback, user_data);
1811 void ewk_view_media_device_list_get(Evas_Object* o, Ewk_Media_Device_List_Get_Callback callback, void* user_data) {
1815 void ewk_view_run_mixed_content_confirm_callback_set(
1816 Evas_Object* /* ewkView */,
1817 Ewk_View_Run_Mixed_Content_Confirm_Callback /* callback */,
1818 void* /* user_data */) {}
1820 void ewk_view_error_page_load_callback_set(Evas_Object* ewk_view, Ewk_View_Error_Page_Load_Callback callback, void* user_data)
1822 EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
1823 EINA_SAFETY_ON_NULL_RETURN(callback);
1824 impl->SetViewLoadErrorPageCallback(callback, user_data);
1827 Eina_Bool ewk_view_add_item_to_back_forward_list(Evas_Object* o, const Ewk_Back_Forward_List_Item* item)
1832 void ewk_view_poweroff_suspend(Evas_Object *item) {}