2 * Copyright (C) 2009-2010 ProFUSION embedded systems
3 * Copyright (C) 2009-2013 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 Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 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 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
26 #include <tizen_webview/public/tw_webview.h>
28 // TODO: remove dependency
29 #include <ui/events/gestures/gesture_configuration.h>
30 #if !defined(EWK_BRINGUP)
31 #include <webkit/common/webpreferences.h>
33 #include <content/public/common/web_preferences.h>
35 #include <../impl/eweb_view.h>
36 #include <../impl/web_contents_delegate_efl.h>
37 #include <../impl/cookie_manager.h>
39 #include "public/ewk_back_forward_list.h"
40 #include "public/ewk_context.h"
41 #include "public/ewk_enums.h"
42 #include "public/ewk_settings.h"
43 #include "private/ewk_context_private.h"
44 #include "private/ewk_hit_test_private.h"
45 #include "private/ewk_notification_private.h"
46 #include "private/ewk_private.h"
47 #if !defined(EWK_BRINGUP)
48 #include "private/ewk_quota_permission_request_private.h"
49 #include "private/ewk_history_private.h"
51 #include "private/ewk_view_private.h"
52 #include "private/chromium_glue.h"
53 #include "private/ewk_view_private.h"
55 using tizen_webview::WebView;
56 using tizen_webview::WebContext;
58 Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api)
60 EINA_SAFETY_ON_NULL_RETURN_VAL(api, false);
61 return InitSmartClassInterface(*api);
64 // TODO: Evas_Object *ewk_view_smart_add(Evas *e, Evas_Smart *smart, Ewk_Context *context, Ewk_Page_Group *pageGroup)
66 Evas_Object* ewk_view_add_with_session_data(Evas* canvas, const char* data, unsigned length)
68 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, NULL);
73 EINA_SAFETY_ON_NULL_RETURN_VAL(data, NULL);
75 Evas_Object* ret = ewk_view_add(canvas);
77 WebView *webView = GetWebViewFromEvasObject(ret);
82 if (webView->RestoreFromSessionData(data, length))
90 Evas_Object* ewk_view_add_with_context(Evas* e, Ewk_Context* context)
92 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
93 return CreateWebViewAsEvasObject(context, e);
96 Evas_Object* ewk_view_add(Evas* e)
98 // TODO: shouldn't this function create new EWebContext for each new EWebView?
99 // when using default context like that it makes unclear who should release
100 // default web context. It won't be released by destroyed eweb_view because
101 // ewk_context_default_get does AddRef
102 Ewk_Context* context = ewk_context_default_get();
103 return ewk_view_add_with_context(e, context);
106 Ewk_Context *ewk_view_context_get(const Evas_Object *view)
108 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
109 return static_cast<Ewk_Context*>(impl->GetWebContext());
112 Eina_Bool ewk_view_url_set(Evas_Object* view, const char* url)
114 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
115 EINA_SAFETY_ON_NULL_RETURN_VAL(url, false);
120 const char* ewk_view_url_get(const Evas_Object* view)
122 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
123 return impl->GetURL();
127 Eina_Bool ewk_view_reload(Evas_Object *view)
129 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
135 Eina_Bool ewk_view_reload_bypass_cache(Evas_Object *view)
137 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
138 impl->ReloadIgnoringCache();
142 Eina_Bool ewk_view_stop(Evas_Object* view)
144 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
150 Ewk_Settings *ewk_view_settings_get(const Evas_Object *ewkView)
152 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl,0);
153 return impl->GetSettings();
156 const char* ewk_view_title_get(const Evas_Object* view)
158 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
159 return impl->GetTitle();
162 double ewk_view_load_progress_get(const Evas_Object* view)
164 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, -1);
165 return impl->GetProgressValue();
168 Eina_Bool ewk_view_scale_set(const Evas_Object* view, double scale_factor, int x, int y)
170 // TODO: We should implement AC in order to work this API normally.
171 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
172 impl->SetScale(scale_factor, x, y);
176 double ewk_view_scale_get(const Evas_Object *view)
178 // TODO: We should implement AC in order to work this API normally.
179 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, -1);
180 return impl->GetScale();
183 Eina_Bool ewk_view_back(Evas_Object *view)
185 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
186 return impl->GoBack();
189 Eina_Bool ewk_view_forward(Evas_Object *view)
191 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
192 return impl->GoForward();
195 Eina_Bool ewk_view_back_possible(Evas_Object *view)
197 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
198 return impl->CanGoBack();
201 Eina_Bool ewk_view_forward_possible(Evas_Object *view)
203 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
204 return impl->CanGoForward();
207 Eina_Bool ewk_view_web_login_request(Evas_Object* ewkView)
209 LOG_EWK_API_MOCKUP();
213 Eina_Bool ewk_view_html_string_load(Evas_Object* view, const char* html, const char* base_uri, const char* unreachable_uri)
215 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
216 EINA_SAFETY_ON_NULL_RETURN_VAL(html, EINA_FALSE);
217 impl->LoadHTMLString(html, base_uri, unreachable_uri);
221 Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object *view, Eina_Bool enabled)
223 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
225 impl->SetMouseEventsEnabled(!!enabled);
230 Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object *view)
232 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
234 return impl->MouseEventsEnabled();
237 Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, int b, int a)
239 LOG_EWK_API_MOCKUP();
243 double ewk_view_text_zoom_get(const Evas_Object* view)
245 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, -1.0);
246 return impl->GetTextZoomFactor();
249 Eina_Bool ewk_view_text_zoom_set(Evas_Object* view, double text_zoom_level)
251 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
252 if (ewk_settings_text_zoom_enabled_get(ewk_view_settings_get(view))) {
253 impl->SetTextZoomFactor(text_zoom_level);
259 void ewk_view_not_found_error_page_load(Evas_Object* ewkView, const char* errorUrl)
261 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
262 std::string errorhtml = impl->GetErrorPage(std::string(errorUrl));
264 ewk_view_html_string_load(ewkView, errorhtml.c_str(), errorUrl, errorUrl);
267 void ewk_view_scale_range_get(Evas_Object* view, double* min_scale, double* max_scale)
269 if (!min_scale && !max_scale)
272 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
273 impl->GetPageScaleRange(min_scale, max_scale);
276 void ewk_view_suspend(Evas_Object* ewkView)
278 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
282 void ewk_view_resume(Evas_Object* ewkView)
284 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
288 Eina_Bool ewk_view_url_request_set(Evas_Object* ewkView, const char* url, Ewk_Http_Method method, Eina_Hash* headers, const char* body)
290 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
291 EINA_SAFETY_ON_NULL_RETURN_VAL(url, EINA_FALSE);
292 std::string str_method;
294 case EWK_HTTP_METHOD_GET:
297 case EWK_HTTP_METHOD_HEAD:
300 case EWK_HTTP_METHOD_POST:
303 case EWK_HTTP_METHOD_PUT:
306 case EWK_HTTP_METHOD_DELETE:
307 str_method = "DELETE";
312 impl->UrlRequestSet(url, str_method, headers, body);
316 Eina_Bool ewk_view_plain_text_set(Evas_Object* view, const char* plain_text)
318 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
319 EINA_SAFETY_ON_NULL_RETURN_VAL(plain_text, EINA_FALSE);
320 impl->LoadPlainTextString(plain_text);
324 Eina_Bool ewk_view_contents_set(Evas_Object* view, const char* contents, size_t contents_size, char* mime_type, char* encoding, char* base_uri)
326 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
327 EINA_SAFETY_ON_NULL_RETURN_VAL(contents, EINA_FALSE);
328 impl->LoadData(contents, contents_size, mime_type, encoding, base_uri);
332 Eina_Bool ewk_view_html_contents_set(Evas_Object* view, const char* html, const char* base_uri)
334 return ewk_view_html_string_load(view, html, base_uri, NULL);
337 Eina_Bool ewk_view_page_visibility_state_set(Evas_Object* ewkView, Ewk_Page_Visibility_State page_visibility_state, Eina_Bool initial_state)
339 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl,false);
340 switch (page_visibility_state) {
341 case EWK_PAGE_VISIBILITY_STATE_VISIBLE :
344 case EWK_PAGE_VISIBILITY_STATE_HIDDEN :
353 Eina_Bool ewk_view_user_agent_set(Evas_Object* ewkView, const char* user_agent)
355 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
356 EINA_SAFETY_ON_NULL_RETURN_VAL(user_agent, false);
357 if (0 != strcmp(user_agent, "")) //check for empty string
358 return impl->SetUserAgent(user_agent);
362 const char* ewk_view_user_agent_get(const Evas_Object* ewkView)
364 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
365 return impl->GetUserAgent();
368 Eina_Bool ewk_view_application_name_for_user_agent_set(Evas_Object* ewkView, const char* application_name)
370 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
371 EINA_SAFETY_ON_NULL_RETURN_VAL(application_name, false);
372 if (0 != strcmp(application_name, "")) //check for empty string
373 return impl->SetUserAgentAppName(application_name);
377 const char* ewk_view_application_name_for_user_agent_get(const Evas_Object* ewkView)
379 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
380 return impl->GetUserAgentAppName();
383 Eina_Bool ewk_view_custom_header_add(const Evas_Object* ewkView, const char* name, const char* value)
385 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
386 EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
387 EINA_SAFETY_ON_NULL_RETURN_VAL(value, EINA_FALSE);
388 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->GetWebContext(),EINA_FALSE);
389 return impl->GetWebContext()->HTTPCustomHeaderAdd(name, value);
392 Eina_Bool ewk_view_custom_header_remove(const Evas_Object* ewkView, const char* name)
394 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
395 EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
396 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->GetWebContext(),EINA_FALSE);
397 return impl->GetWebContext()->HTTPCustomHeaderRemove(name);
401 Eina_Bool ewk_view_custom_header_clear(const Evas_Object* ewkView)
403 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
404 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->GetWebContext(),EINA_FALSE);
405 impl->GetWebContext()->HTTPCustomHeaderClear();
410 Eina_Bool ewk_view_visibility_set(const Evas_Object* view, Eina_Bool enable)
412 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
422 Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* view, Eina_Rectangle view_area, float scale_factor, Evas* canvas)
424 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, NULL);
425 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, NULL);
426 // Zoom level equality (<=0.001) is sufficient compared to high precision std::numeric_value::epsilon.
427 if (!content::ZoomValuesEqual(scale_factor, 1.0)) {
428 LOG(ERROR) << "We only support scale factor of 1.0."
429 << "Scaling option will be supported after hardware acceleration is enabled.";
432 return impl->GetSnapshot(view_area);
435 unsigned int ewk_view_inspector_server_start(Evas_Object* ewkView, unsigned int port)
437 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
438 return impl->StartInspectorServer(port);
441 Eina_Bool ewk_view_inspector_server_stop(Evas_Object* ewkView)
443 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
444 return impl->StopInspectorServer();
447 Evas_Object* ewk_view_cache_image_get(const Evas_Object* ewkView, const char* imageUrl, Evas* canvas)
449 LOG_EWK_API_MOCKUP();
453 void ewk_view_scroll_by(Evas_Object* ewkView, int deltaX, int deltaY)
457 if (EINA_TRUE == ewk_view_scroll_pos_get(ewkView, &x, &y)) {
458 ewk_view_scroll_set(ewkView, x + deltaX, y + deltaY);
462 Eina_Bool ewk_view_scroll_pos_get(Evas_Object* ewkView, int* x, int* y)
464 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
465 EINA_SAFETY_ON_NULL_RETURN_VAL(x, EINA_FALSE);
466 EINA_SAFETY_ON_NULL_RETURN_VAL(y, EINA_FALSE);
467 impl->GetScrollPosition(x, y);
471 Eina_Bool ewk_view_scroll_set(Evas_Object* view, int x, int y)
473 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
474 impl->SetScroll(x, y);
479 Eina_Bool ewk_view_scroll_size_get(const Evas_Object* view, int* width, int* height)
481 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
482 impl->GetScrollSize(width,height);
486 void ewk_view_password_confirm_popup_callback_set(Evas_Object* view, Ewk_View_Password_Confirm_Popup_Callback callback, void* user_data)
488 LOG_EWK_API_MOCKUP();
491 void ewk_view_password_confirm_popup_reply(Evas_Object* ewkView, Ewk_Password_Popup_Option result)
493 LOG_EWK_API_MOCKUP();
496 void ewk_view_javascript_alert_callback_set(Evas_Object* view, Ewk_View_JavaScript_Alert_Callback callback, void* user_data)
498 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
500 impl->SetJavaScriptAlertCallback(callback, user_data);
503 void ewk_view_javascript_alert_reply(Evas_Object* view)
505 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
506 impl->JavaScriptAlertReply();
509 void ewk_view_javascript_confirm_callback_set(Evas_Object* view, Ewk_View_JavaScript_Confirm_Callback callback, void* user_data)
511 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
513 impl->SetJavaScriptConfirmCallback(callback, user_data);
516 void ewk_view_javascript_confirm_reply(Evas_Object* view, Eina_Bool result)
518 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
519 impl->JavaScriptConfirmReply(result);
522 void ewk_view_javascript_prompt_callback_set(Evas_Object* view, Ewk_View_JavaScript_Prompt_Callback callback, void* user_data)
524 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
526 impl->SetJavaScriptPromptCallback(callback, user_data);
529 void ewk_view_javascript_prompt_reply(Evas_Object* view, const char* result)
531 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
532 impl->JavaScriptPromptReply(result);
535 void ewk_view_before_unload_confirm_panel_callback_set(Evas_Object* ewkView, Ewk_View_Before_Unload_Confirm_Panel_Callback callback, void* userData)
537 LOG_EWK_API_MOCKUP();
540 void ewk_view_before_unload_confirm_panel_reply(Evas_Object* ewkView, Eina_Bool result)
542 LOG_EWK_API_MOCKUP();
545 Eina_Bool ewk_view_web_application_capable_get(Evas_Object* ewkView, Ewk_Web_App_Capable_Get_Callback callback, void* userData)
547 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
548 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
549 return impl->WebAppCapableGet(callback, userData) ? EINA_TRUE : EINA_FALSE;
552 Eina_Bool ewk_view_web_application_icon_url_get(Evas_Object* ewkView, Ewk_Web_App_Icon_URL_Get_Callback callback, void* userData)
554 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
555 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
556 return impl->WebAppIconUrlGet(callback, userData) ? EINA_TRUE : EINA_FALSE;
559 Eina_Bool ewk_view_web_application_icon_urls_get(Evas_Object* ewkView, Ewk_Web_App_Icon_URLs_Get_Callback callback, void* userData)
561 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
562 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
563 return impl->WebAppIconUrlsGet(callback, userData) ? EINA_TRUE : EINA_FALSE;
566 Eina_Bool ewk_view_command_execute(Evas_Object* view, const char* command, const char* value)
568 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
569 EINA_SAFETY_ON_NULL_RETURN_VAL(command, false);
570 impl->ExecuteEditCommand(command, value);
574 Eina_Bool ewk_view_contents_size_get(Evas_Object* view, Evas_Coord* width, Evas_Coord* height)
581 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
582 Eina_Rectangle contents_size = impl->GetContentsSize();
585 *width = contents_size.w;
587 *height = contents_size.h;
592 Eina_Bool ewk_view_contents_pdf_get(Evas_Object* view, int width, int height, const char* fileName)
594 EINA_SAFETY_ON_NULL_RETURN_VAL(fileName, EINA_FALSE);
595 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
596 return impl->SaveAsPdf(width, height, fileName);
599 Eina_Bool ewk_view_script_execute(Evas_Object* ewkView, const char* script, Ewk_View_Script_Execute_Callback callback, void* user_data)
601 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
602 EINA_SAFETY_ON_NULL_RETURN_VAL(script, false);
603 // callback can be null, so do not test it for null
604 if (0 != strcmp(script, "")) //check for empty string
605 return impl->ExecuteJavaScript(script, callback, user_data);
610 Eina_Bool ewk_view_plain_text_get(Evas_Object* view, Ewk_View_Plain_Text_Get_Callback callback, void* user_data)
612 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
613 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
614 return (impl->PlainTextGet(callback, user_data));
617 Eina_Bool ewk_view_mhtml_data_get(Evas_Object *view, Ewk_View_MHTML_Data_Get_Callback callback, void *user_data)
619 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
620 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
621 return impl->GetMHTMLData(callback, user_data);
624 Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* ewkView, int x, int y, int hit_test_mode)
626 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
627 return chromium_glue::from(impl->RequestHitTestDataAt(x, y,
628 chromium_glue::to(static_cast<Ewk_Hit_Test_Mode>(hit_test_mode))));
631 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)
633 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
634 return impl->AsyncRequestHitTestDataAt(x, y, chromium_glue::to(static_cast<Ewk_Hit_Test_Mode>(hit_test_mode)), chromium_glue::to(callback), user_data);
637 #if !defined(EWK_BRINGUP)
638 Ewk_History* ewk_view_history_get(Evas_Object* ewkView)
640 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, NULL);
641 return chromium_glue::from(impl->GetBackForwardList());
645 Eina_Bool ewk_view_notification_closed(Evas_Object* ewkView, Eina_List* notification_list)
647 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
649 #if !defined(EWK_BRINGUP)
650 #warning "[M38] Fix and re-enable notifications (edit efl_integration/public/ewk_view.cc)"
651 // copied from deleted NotificationControllerEfl::RemoveClosedNotifications()
652 if (!eina_list_count(notification_list))
655 assert(impl->GetWebContext());
656 assert(impl->GetWebContext()->browser_context());
657 assert(impl->GetWebContext()->browser_context()->GetNotificationController());
658 content::NotificationControllerEfl* controller =
659 impl->GetWebContext()->browser_context()->GetNotificationController();
661 Eina_List* notification_iterator = NULL;
662 void* notification_data = NULL;
663 EINA_LIST_FOREACH(notification_list, notification_iterator, notification_data) {
664 Ewk_Notification* notification =
665 static_cast<Ewk_Notification*>(notification_data);
668 controller->DeleteNotification(notification->GetID(), true);
677 Eina_Bool ewk_view_popup_menu_select(Evas_Object* ewkView, unsigned int selectedIndex)
679 LOG_EWK_API_MOCKUP();
683 Eina_Bool ewk_view_popup_menu_multiple_select(Evas_Object* ewkView, Eina_Inarray* changeList)
685 LOG_EWK_API_MOCKUP();
690 * Sends the new orientation of the device.
692 * If orientation value is changed, orientationchanged event will occur.
694 * @param view object to receive orientation event.
695 * @param orientation the new orientation of the device. (degree)
697 * orientation will be 0 degrees when the device is oriented to natural position,
698 * 90 degrees when it's left side is at the top,
699 * -90 degrees when it's right side is at the top,
700 * 180 degrees when it is upside down.
702 void ewk_view_orientation_send(Evas_Object* ewkView, int orientation)
704 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
706 impl->SendOrientationChangeEventIfNeeded(orientation);
709 void ewk_view_encoding_custom_set(Evas_Object* ewkView, const char* encoding)
711 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
712 impl->SetOverrideEncoding(std::string(encoding));
715 Eina_Bool ewk_view_text_selection_range_get(const Evas_Object* view, Eina_Rectangle* left_rect, Eina_Rectangle* right_rect)
717 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
718 if (left_rect && right_rect && impl->GetSelectionRange(left_rect, right_rect)) {
720 evas_object_geometry_get(view, &x, &y, 0, 0);
730 Eina_Bool ewk_view_text_selection_clear(Evas_Object *view)
732 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
733 return impl->ClearSelection() ? EINA_TRUE : EINA_FALSE;
736 const char* ewk_view_text_selection_text_get(Evas_Object* view)
738 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, NULL);
739 return impl->GetSelectedText();
742 void ewk_view_focused_input_element_value_set(Evas_Object* ewkView, const char* value)
744 LOG_EWK_API_MOCKUP();
747 const char* ewk_view_focused_input_element_value_get(Evas_Object* ewkView)
749 LOG_EWK_API_MOCKUP();
753 Eina_Bool ewk_view_vertical_panning_hold_get(Evas_Object* ewkView)
755 LOG_EWK_API_MOCKUP();
759 void ewk_view_vertical_panning_hold_set(Evas_Object* view, Eina_Bool hold)
761 LOG_EWK_API_MOCKUP();
762 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
763 // FIX ME: Currently the pan support is not present.
764 // In WK2 panning was implemented with evas directly, here its with chorme gesture reconignation
765 // So paning is not present yet
768 void ewk_view_orientation_lock_callback_set(Evas_Object* ewkView, Ewk_Orientation_Lock_Cb func, void* data)
770 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
771 EINA_SAFETY_ON_NULL_RETURN(func);
772 impl->SetOrientationLockCallback(func, data);
776 void ewk_view_back_forward_list_clear(const Evas_Object *view)
778 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
779 impl->BackForwardListClear();
782 Eina_Bool ewk_view_feed_touch_event(Evas_Object *view, Ewk_Touch_Event_Type type, const Eina_List *points, const Evas_Modifier *modifiers)
784 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
786 impl->HandleTouchEvents(chromium_glue::to(type), points, modifiers);
791 Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object *view, Eina_Bool enabled)
793 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
795 impl->SetTouchEventsEnabled(!!enabled);
800 Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object *view)
802 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
804 return impl->TouchEventsEnabled();
807 Ewk_Frame_Ref ewk_view_main_frame_get(Evas_Object* o)
809 EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, NULL);
810 return impl->GetMainFrame();
813 Eina_Bool ewk_view_main_frame_scrollbar_visible_set(Evas_Object* ewkView, Eina_Bool visible)
815 LOG_EWK_API_MOCKUP();
819 void ewk_view_content_security_policy_set(Evas_Object* ewkView, const char* policy, Ewk_CSP_Header_Type type)
821 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
822 EINA_SAFETY_ON_NULL_RETURN(policy);
823 impl->SetContentSecurityPolicy(policy, chromium_glue::to(type));
826 void ewk_view_application_cache_permission_callback_set(Evas_Object* ewkView, Ewk_View_Applicacion_Cache_Permission_Callback callback, void* userData)
828 // Chromium does not support this feature hence the comment
829 LOG_EWK_API_MOCKUP("Not Supported by chromium");
832 void ewk_view_application_cache_permission_reply(Evas_Object* ewkView, Eina_Bool allow)
834 // Chromium does not support this feature hence the comment
835 LOG_EWK_API_MOCKUP("Not Supported by chromium");
838 void ewk_view_exceeded_indexed_database_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, void* userData)
840 // Chromium does not support quota for Indexed DB only.
841 // IndexedDB uses temporary storage that is shared
842 // between other features.
843 LOG_EWK_API_MOCKUP("Not Supported by chromium");
846 void ewk_view_exceeded_indexed_database_quota_reply(Evas_Object* ewkView, Eina_Bool allow)
848 // Chromium does not support quota for Indexed DB only.
849 // IndexedDB uses temporary storage that is shared
850 // between other features.
851 LOG_EWK_API_MOCKUP("Not Supported by chromium");
854 Eina_Bool ewk_view_text_find(Evas_Object *view, const char *text, Ewk_Find_Options options, unsigned int max_match_count)
856 // FIXME: We need to implement next options in Ewk_Find_Options struct. (refer to ewk_view.h)
857 // - EWK_FIND_OPTIONS_AT_WORD_STARTS
858 // - EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START
859 // - EWK_FIND_OPTIONS_WRAP_AROUND
860 // - EWK_FIND_OPTIONS_SHOW_OVERLAY
861 // - EWK_FIND_OPTIONS_SHOW_FIND_INDICATOR
862 // - EWK_FIND_OPTIONS_SHOW_HIGHLIGHT (Currently there is no way to control this option. so it is always set)
864 // FIXME: Updating of max_match_count is not implemented.
866 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
867 EINA_SAFETY_ON_NULL_RETURN_VAL(text, EINA_FALSE);
868 impl->Find(text, chromium_glue::to(options));
872 Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object *view)
874 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
879 void ewk_view_exceeded_database_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Database_Quota_Callback callback, void* userData)
881 // According to chromium source code:
882 // src/third_party/WebKit/Source/modules/webdatabase/SQLTransactionClient.cpp line 67
883 // Chromium does not allow users to manually change the quota for an origin (for now, at least).
884 // This API is impossible to implement right now
885 LOG_EWK_API_MOCKUP("Not Supported by chromium");
888 void ewk_view_exceeded_database_quota_reply(Evas_Object* ewkView, Eina_Bool allow)
890 // According to chromium source code:
891 // src/third_party/WebKit/Source/modules/webdatabase/SQLTransactionClient.cpp line 67
892 // Chromium does not allow users to manually change the quota for an origin (for now, at least).
893 // This API is impossible to implement right now
894 LOG_EWK_API_MOCKUP("Not Supported by chromium");
897 void ewk_view_exceeded_local_file_system_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, void* userData)
899 LOG_EWK_API_MOCKUP();
902 void ewk_view_exceeded_local_file_system_quota_reply(Evas_Object* ewkView, Eina_Bool allow)
904 LOG_EWK_API_MOCKUP();
907 void ewk_view_intercept_request_callback_set (Evas_Object* ewkView, Ewk_View_Intercept_Request_Callback callback, void* user_data)
909 LOG_EWK_API_MOCKUP();
912 void ewk_view_unfocus_allow_callback_set(Evas_Object* ewkView, Ewk_View_Unfocus_Allow_Callback callback, void* user_data)
914 LOG_EWK_API_MOCKUP();
917 void ewk_view_use_settings_font(Evas_Object* ewkView)
919 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
920 impl->UseSettingsFont();
923 char* ewk_view_get_cookies_for_url(Evas_Object* view, const char* url)
925 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
926 EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0);
927 std::string cookiesForURL;
928 cookiesForURL = impl->GetWebContext()->cookieManager()->GetCookiesForURL(std::string(url));
929 if (cookiesForURL.empty())
931 return strndup(cookiesForURL.c_str(), cookiesForURL.length());
934 Eina_Bool ewk_view_fullscreen_exit(Evas_Object* view)
936 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
937 impl->ExitFullscreen();
941 Eina_Bool ewk_view_draws_transparent_background_set(Evas_Object *view, Eina_Bool enabled)
943 EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
944 impl->SetDrawsTransparentBackground(enabled);
948 void ewk_view_browser_font_set(Evas_Object* ewkView)
950 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
951 impl->SetBrowserFont();
954 void ewk_view_session_data_get(Evas_Object* ewkView, const char** data, unsigned* length)
956 EINA_SAFETY_ON_NULL_RETURN(data);
957 EINA_SAFETY_ON_NULL_RETURN(length);
959 WebView* impl = GetWebViewFromEvasObject(ewkView);
966 impl->GetSessionData(data, length);
969 Eina_Bool ewk_view_mode_set(Evas_Object* ewkView, Ewk_View_Mode view_mode)
971 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
973 #if !defined(EWK_BRINGUP)
974 #warning "[M38] view mode is not supported in M38"
976 case EWK_VIEW_MODE_WINDOWED:
977 case EWK_VIEW_MODE_FLOATING:
978 case EWK_VIEW_MODE_FULLSCREEN:
979 case EWK_VIEW_MODE_MAXIMIZED:
980 case EWK_VIEW_MODE_MINIMIZED:
981 impl->SetViewMode((int)view_mode);
990 Eina_Bool ewk_view_split_scroll_overflow_enabled_set(Evas_Object* ewkView, const Eina_Bool enabled)
992 LOG_EWK_API_MOCKUP("for browser");
996 #if defined(OS_TIZEN_TV)
997 Ewk_Back_Forward_List* ewk_view_back_forward_list_get(const Evas_Object* ewkView)
999 LOG_EWK_API_MOCKUP("for Tizen TV Browser");
1004 void ewk_view_draw_focus_ring_enable_set(Evas_Object* ewkView, Eina_Bool enable)
1006 #if defined(OS_TIZEN_TV) && !defined(EWK_BRINGUP)
1007 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1008 impl->setDrawFocusRing(enable);
1010 LOG_EWK_API_MOCKUP("Only for Tizen TV Browser");
1014 #if defined(OS_TIZEN_TV)
1015 double ewk_view_page_zoom_get(const Evas_Object* ewkView)
1017 LOG_EWK_API_MOCKUP("for Tizen TV Browser");
1021 Eina_Bool ewk_view_page_zoom_set(Evas_Object* ewkView, double zoomFactor)
1023 LOG_EWK_API_MOCKUP("for Tizen TV Browser");
1027 Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* context, Ewk_Page_Group* pageGroup)
1029 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
1030 return CreateWebViewAsEvasObject(context, canvas, smart);
1032 #endif // OS_TIZEN_TV
1034 #if !defined(EWK_BRINGUP)
1035 void ewk_view_quota_permission_request_callback_set(Evas_Object* ewkView, Ewk_Quota_Permission_Request_Callback callback, void* user_data)
1037 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1038 impl->SetQuotaPermissionRequestCallback((tizen_webview::QuotaPermissionRequest_Cb)callback, user_data);
1041 void ewk_view_quota_permission_request_reply(const Ewk_Quota_Permission_Request* request, const Eina_Bool allow)
1043 EINA_SAFETY_ON_NULL_RETURN(request);
1044 Evas_Object* ewkView = request->getView();
1045 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1046 impl->QuotaRequestReply(request, allow == EINA_TRUE);
1049 void ewk_view_quota_permission_request_cancel(const Ewk_Quota_Permission_Request* request)
1051 EINA_SAFETY_ON_NULL_RETURN(request);
1052 Evas_Object* ewkView = request->getView();
1053 EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
1054 impl->QuotaRequestCancel(request);