1 // Copyright 2014 Samsung Electronics. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
14 #include "base/containers/id_map.h"
15 #include "base/functional/callback.h"
16 #include "base/synchronization/waitable_event.h"
17 #include "browser/input_picker/input_picker.h"
18 #include "content/browser/select_picker/select_picker_base.h"
19 #include "content/browser/selection/selection_controller_efl.h"
20 #include "content/browser/web_contents/web_contents_view_aura.h"
21 #include "content/browser/web_contents/web_contents_view_aura_helper_efl.h"
22 #include "content/common/input/event_with_latency_info.h"
23 #include "content/public/browser/context_menu_params.h"
24 #include "content/public/browser/navigation_controller.h"
25 #include "content/public/browser/web_contents_delegate.h"
26 #include "content/public/browser/webview_delegate.h"
27 #include "content/public/common/input_event_ack_state.h"
28 #include "content_browser_client_efl.h"
29 #include "context_menu_controller_efl.h"
30 #include "eweb_context.h"
31 #include "eweb_view_callbacks.h"
32 #include "file_chooser_controller_efl.h"
33 #include "permission_popup_manager.h"
34 #include "popup_controller_efl.h"
35 #include "private/ewk_auth_challenge_private.h"
36 #include "private/ewk_back_forward_list_private.h"
37 #include "private/ewk_history_private.h"
38 #include "private/ewk_hit_test_private.h"
39 #include "private/ewk_settings_private.h"
40 #include "private/ewk_web_application_icon_data_private.h"
41 #include "public/ewk_hit_test_internal.h"
42 #include "public/ewk_touch_internal.h"
43 #include "public/ewk_view_product.h"
44 #include "scroll_detector.h"
45 #include "third_party/blink/public/common/context_menu_data/menu_item_info.h"
46 #include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h"
47 #include "third_party/blink/public/mojom/choosers/popup_menu.mojom.h"
48 #include "ui/aura/window_tree_host.h"
49 #include "ui/gfx/geometry/point.h"
50 #include "ui/gfx/geometry/size.h"
51 #include "web_contents_delegate_efl.h"
52 #if defined(TIZEN_PEPPER_EXTENSIONS)
53 #include "ewk_extension_system_delegate.h"
54 #include "public/ewk_value_product.h"
60 class WindowParentingClient;
69 class RenderFrameHost;
71 class RenderWidgetHostViewAura;
72 class WebContentsDelegateEfl;
73 class WebContentsViewAura;
74 class ContextMenuControllerEfl;
75 class PopupControllerEfl;
76 class DateTimeChooserEfl;
78 class GinNativeBridgeDispatcherHost;
79 class NavigationHandle;
83 class _Ewk_App_Control;
84 class _Ewk_Policy_Decision;
87 class _Ewk_Quota_Permission_Request;
89 #if BUILDFLAG(IS_TIZEN_TV)
90 struct _Ewk_File_Chooser_Request;
93 #if defined(TIZEN_ATK_SUPPORT)
94 class EWebAccessibility;
97 template <typename CallbackPtr, typename CallbackParameter>
98 class WebViewCallback {
100 WebViewCallback() { Set(nullptr, nullptr); }
102 void Set(CallbackPtr cb, void* data) {
107 bool IsCallbackSet() const { return callback_; }
109 Eina_Bool Run(Evas_Object* webview,
110 CallbackParameter param,
111 Eina_Bool* callback_result) {
112 CHECK(callback_result);
113 if (IsCallbackSet()) {
114 *callback_result = callback_(webview, param, user_data_);
120 void Run(Evas_Object* webview, CallbackParameter param) {
122 callback_(webview, param, user_data_);
126 CallbackPtr callback_;
130 template <typename CallbackReturnValue,
131 typename CallbackPtr,
132 typename CallbackParameter>
133 class WebViewCallbackWithReturnValue {
135 WebViewCallbackWithReturnValue() { Set(nullptr, nullptr); }
137 void Set(CallbackPtr cb, void* data) {
142 /* LCOV_EXCL_START */
143 bool IsCallbackSet() const { return callback_; }
145 CallbackReturnValue Run(Evas_Object* webview, CallbackParameter param) {
147 return callback_(webview, param, user_data_);
154 CallbackPtr callback_;
158 template <typename CallbackPtr, typename... CallbackParameter>
159 class WebViewErrorPageLoadCallback {
161 WebViewErrorPageLoadCallback() { Set(nullptr, nullptr); }
163 void Set(CallbackPtr cb, void* data) {
168 bool IsCallbackSet() const { return callback_; }
170 void Run(Evas_Object* webview, CallbackParameter... param) {
172 callback_(webview, param..., user_data_);
176 CallbackPtr callback_;
180 template <typename CallbackPtr, typename... CallbackParameter>
181 class WebViewExceededQuotaCallback {
183 WebViewExceededQuotaCallback() { Set(nullptr, nullptr); }
185 void Set(CallbackPtr cb, void* data) {
190 bool IsCallbackSet() const { return callback_; }
192 /* LCOV_EXCL_START */
193 void Run(Evas_Object* webview, CallbackParameter... param) {
195 callback_(webview, param..., user_data_);
200 CallbackPtr callback_;
204 class BackgroundColorGetCallback {
206 BackgroundColorGetCallback(Ewk_View_Background_Color_Get_Callback func,
208 : func_(func), user_data_(user_data) {}
210 void Run(Evas_Object* webview, int r, int g, int b, int a) {
212 func_(webview, r, g, b, a, user_data_);
216 Ewk_View_Background_Color_Get_Callback func_;
220 class WebApplicationIconUrlGetCallback {
222 WebApplicationIconUrlGetCallback(Ewk_Web_App_Icon_URL_Get_Callback func,
224 : func_(func), user_data_(user_data) {}
225 void Run(const std::string& url) {
227 (func_)(url.c_str(), user_data_);
232 Ewk_Web_App_Icon_URL_Get_Callback func_;
236 class WebApplicationIconUrlsGetCallback {
238 WebApplicationIconUrlsGetCallback(Ewk_Web_App_Icon_URLs_Get_Callback func,
240 : func_(func), user_data_(user_data) {}
241 void Run(const std::map<std::string, std::string>& urls) {
243 Eina_List* list = NULL;
244 for (std::map<std::string, std::string>::const_iterator it = urls.begin();
245 it != urls.end(); ++it) {
246 _Ewk_Web_App_Icon_Data* data =
247 ewkWebAppIconDataCreate(it->first, it->second);
248 list = eina_list_append(list, data);
250 (func_)(list, user_data_);
255 Ewk_Web_App_Icon_URLs_Get_Callback func_;
259 class WebApplicationCapableGetCallback {
261 WebApplicationCapableGetCallback(Ewk_Web_App_Capable_Get_Callback func,
263 : func_(func), user_data_(user_data) {}
264 void Run(bool capable) {
266 (func_)(capable ? EINA_TRUE : EINA_FALSE, user_data_);
271 Ewk_Web_App_Capable_Get_Callback func_;
275 class DidChangeThemeColorCallback {
277 DidChangeThemeColorCallback() : callback_(nullptr), user_data_(nullptr) {}
278 void Set(Ewk_View_Did_Change_Theme_Color_Callback callback, void* user_data) {
279 callback_ = callback;
280 user_data_ = user_data;
282 void Run(Evas_Object* o, const SkColor& color) {
284 callback_(o, SkColorGetR(color), SkColorGetG(color), SkColorGetB(color),
285 SkColorGetA(color), user_data_);
289 Ewk_View_Did_Change_Theme_Color_Callback callback_;
293 class WebViewAsyncRequestHitTestDataCallback;
294 class JavaScriptDialogManagerEfl;
295 class PermissionPopupManager;
299 static EWebView* FromEwkView(Evas_Object* ewk_view);
301 EWebView(Ewk_Context*, Evas_Object* smart_object);
304 // initialize data members and activate event handlers.
305 // call this once after created and before use
308 bool CreateNewWindow(content::WebViewDelegate::WebContentsCreateCallback);
309 static Evas_Object* GetHostWindowDelegate(const content::WebContents*);
311 content::WebContentsViewAura* wcva() const;
312 content::RenderWidgetHostViewAura* rwhva() const;
313 Ewk_Context* context() const { return context_.get(); }
314 Evas_Object* ewk_view() const { return ewk_view_; }
315 Evas_Object* efl_main_layout() const { return efl_main_layout_; }
316 Evas_Object* GetElmWindow() const;
317 Evas* GetEvas() const { return evas_object_evas_get(ewk_view_); }
318 PermissionPopupManager* GetPermissionPopupManager() const {
319 return permission_popup_manager_.get();
322 content::WebContents& web_contents() const { return *web_contents_.get(); }
323 content::WebContentsViewAura* GetWebContentsViewAura() const;
325 #if defined(TIZEN_ATK_SUPPORT)
326 EWebAccessibility& eweb_accessibility() const {
327 return *eweb_accessibility_.get();
331 template <EWebViewCallbacks::CallbackType callbackType>
332 EWebViewCallbacks::CallBack<callbackType> SmartCallback() const {
333 return EWebViewCallbacks::CallBack<callbackType>(ewk_view_);
337 void SetURL(const GURL& url, bool from_api = false);
338 const GURL& GetURL() const;
339 const GURL& GetOriginalURL() const;
341 void ReloadBypassingCache();
342 Eina_Bool CanGoBack();
343 Eina_Bool CanGoForward();
344 Eina_Bool HasFocus() const;
345 void SetFocus(Eina_Bool focus);
347 Eina_Bool GoForward();
351 #if BUILDFLAG(IS_TIZEN_TV)
352 void SetFloatVideoWindowState(bool enabled);
353 #endif // IS_TIZEN_TV
354 void SetSessionTimeout(uint64_t timeout);
355 double GetTextZoomFactor() const;
356 void SetTextZoomFactor(double text_zoom_factor);
357 double GetPageZoomFactor() const;
358 void SetPageZoomFactor(double page_zoom_factor);
359 void ExecuteEditCommand(const char* command, const char* value);
360 #if BUILDFLAG(IS_TIZEN)
361 void EnterDragState();
363 void SetOrientation(int orientation);
364 int GetOrientation();
365 bool TouchEventsEnabled() const;
366 void SetTouchEventsEnabled(bool enabled);
367 bool MouseEventsEnabled() const;
368 void SetMouseEventsEnabled(bool enabled);
369 void SendKeyEvent(Evas_Object* ewk_view, void* key_event, bool is_press);
370 bool SetKeyEventsEnabled(bool enabled);
371 void HandleTouchEvents(Ewk_Touch_Event_Type type,
372 const Eina_List* points,
373 const Evas_Modifier* modifiers);
376 bool ExecuteJavaScript(const char* script,
377 Ewk_View_Script_Execute_Callback callback,
379 bool SetUserAgent(const char* userAgent);
380 bool SetUserAgentAppName(const char* application_name);
381 #if BUILDFLAG(IS_TIZEN)
382 bool SetPrivateBrowsing(bool incognito);
383 bool GetPrivateBrowsing() const;
385 const char* GetUserAgent() const;
386 const char* GetUserAgentAppName() const;
387 const char* CacheSelectedText();
388 Ewk_Settings* GetSettings() { return settings_.get(); }
389 _Ewk_Frame* GetMainFrame();
390 void UpdateWebKitPreferences();
391 void LoadHTMLString(const char* html,
392 const char* base_uri,
393 const char* unreachable_uri);
394 void LoadPlainTextString(const char* plain_text);
396 void LoadHTMLStringOverridingCurrentEntry(const char* html,
397 const char* base_uri,
398 const char* unreachable_url);
399 void LoadData(const char* data,
401 const char* mime_type,
402 const char* encoding,
403 const char* base_uri,
404 const char* unreachable_uri = NULL,
405 bool should_replace_current_entry = false);
406 void InvokeLoadError(const GURL& url, int error_code, bool is_cancellation);
408 void SetViewAuthCallback(Ewk_View_Authentication_Callback callback,
410 void InvokeAuthCallback(LoginDelegateEfl* login_delegate,
412 const std::string& realm);
413 void Find(const char* text, Ewk_Find_Options);
414 void InvokeAuthCallbackOnUI(_Ewk_Auth_Challenge* auth_challenge);
415 void SetContentSecurityPolicy(const char* policy, Ewk_CSP_Header_Type type);
416 void HandlePopupMenu(std::vector<blink::mojom::MenuItemPtr> items,
419 const gfx::Rect& bounds);
420 void HidePopupMenu();
421 void DidSelectPopupMenuItems(std::vector<int>& indices);
422 void DidCancelPopupMenu();
423 void HandleLongPressGesture(const content::ContextMenuParams&);
424 void ShowContextMenu(const content::ContextMenuParams&);
425 void CancelContextMenu(int request_id);
426 void SetScale(double scale_factor);
427 void SetScaleChangedCallback(Ewk_View_Scale_Changed_Callback callback,
430 bool GetScrollPosition(int* x, int* y) const;
431 void SetScroll(int x, int y);
432 void UrlRequestSet(const char* url,
433 content::NavigationController::LoadURLType loadtype,
437 SelectPickerBase* GetSelectPicker() const { return select_picker_.get(); }
438 content::SelectionControllerEfl* GetSelectionController() const;
439 content::PopupControllerEfl* GetPopupController() const {
440 return popup_controller_.get();
442 ScrollDetector* GetScrollDetector() const { return scroll_detector_.get(); }
443 void MoveCaret(const gfx::Point& point);
444 void SelectFocusedLink();
445 bool GetSelectionRange(Eina_Rectangle* left_rect, Eina_Rectangle* right_rect);
446 Eina_Bool ClearSelection();
448 // Callback OnCopyFromBackingStore will be called once we get the snapshot
450 void OnCopyFromBackingStore(bool success, const SkBitmap& bitmap);
455 void UpdateContextMenu(bool is_password_input);
456 void RenderViewReady();
459 * Creates a snapshot of given rectangle from EWebView
461 * @param rect rectangle of EWebView which will be taken into snapshot
462 * @param scale_factor scale factor
463 * @return created snapshot or NULL if error occured.
464 * @note ownership of snapshot is passed to caller
466 Evas_Object* GetSnapshot(Eina_Rectangle rect, float scale_factor);
468 bool GetSnapshotAsync(Eina_Rectangle rect,
469 Ewk_Web_App_Screenshot_Captured_Callback callback,
472 void InvokePolicyResponseCallback(_Ewk_Policy_Decision* policy_decision,
474 void InvokePolicyNavigationCallback(const NavigationPolicyParams& params,
476 void UseSettingsFont();
478 _Ewk_Hit_Test* RequestHitTestDataAt(int x, int y, Ewk_Hit_Test_Mode mode);
479 Eina_Bool AsyncRequestHitTestDataAt(int x,
481 Ewk_Hit_Test_Mode mode,
482 Ewk_View_Hit_Test_Request_Callback,
484 _Ewk_Hit_Test* RequestHitTestDataAtBlinkCoords(int x,
486 Ewk_Hit_Test_Mode mode);
487 Eina_Bool AsyncRequestHitTestDataAtBlinkCords(
490 Ewk_Hit_Test_Mode mode,
491 Ewk_View_Hit_Test_Request_Callback,
493 void DispatchAsyncHitTestData(const Hit_Test_Params& params,
495 void UpdateHitTestData(const Hit_Test_Params& params);
497 int current_find_request_id() const { return current_find_request_id_; }
498 bool PlainTextGet(Ewk_View_Plain_Text_Get_Callback callback, void* user_data);
499 void InvokePlainTextGetCallback(const std::string& content_text,
500 int plain_text_get_callback_id);
501 int SetEwkViewPlainTextGetCallback(Ewk_View_Plain_Text_Get_Callback callback,
503 void SetViewGeolocationPermissionCallback(
504 Ewk_View_Geolocation_Permission_Callback callback,
506 bool InvokeViewGeolocationPermissionCallback(
507 _Ewk_Geolocation_Permission_Request*
508 geolocation_permission_request_context,
510 void SetViewUserMediaPermissionCallback(
511 Ewk_View_User_Media_Permission_Callback callback,
513 bool InvokeViewUserMediaPermissionCallback(
514 _Ewk_User_Media_Permission_Request* user_media_permission_request_context,
516 void SetViewUserMediaPermissionQueryCallback(
517 Ewk_View_User_Media_Permission_Query_Callback callback,
519 Ewk_User_Media_Permission_Query_Result
520 InvokeViewUserMediaPermissionQueryCallback(
521 _Ewk_User_Media_Permission_Query* user_media_permission_query_context);
523 void SetViewLoadErrorPageCallback(Ewk_View_Error_Page_Load_Callback callback,
525 const char* InvokeViewLoadErrorPageCallback(
528 const std::string& error_description);
529 bool IsLoadErrorPageCallbackSet() const;
530 void SetViewUnfocusAllowCallback(Ewk_View_Unfocus_Allow_Callback callback,
532 bool InvokeViewUnfocusAllowCallback(Ewk_Unfocus_Direction direction,
534 void DidChangeContentsSize(int width, int height);
535 const Eina_Rectangle GetContentsSize() const;
536 void GetScrollSize(int* w, int* h);
538 void SetProgressValue(double progress);
539 double GetProgressValue();
540 const char* GetTitle();
541 bool SaveAsPdf(int width, int height, const std::string& file_name);
542 void BackForwardListClear();
543 _Ewk_Back_Forward_List* GetBackForwardList() const;
544 void InvokeBackForwardListChangedCallback();
545 _Ewk_History* GetBackForwardHistory() const;
546 bool WebAppCapableGet(Ewk_Web_App_Capable_Get_Callback callback,
548 bool WebAppIconUrlGet(Ewk_Web_App_Icon_URL_Get_Callback callback,
550 bool WebAppIconUrlsGet(Ewk_Web_App_Icon_URLs_Get_Callback callback,
552 void InvokeWebAppCapableGetCallback(bool capable, int callbackId);
553 void InvokeWebAppIconUrlGetCallback(const std::string& iconUrl,
555 void InvokeWebAppIconUrlsGetCallback(
556 const std::map<std::string, std::string>& iconUrls,
558 void SetNotificationPermissionCallback(
559 Ewk_View_Notification_Permission_Callback callback,
561 bool IsNotificationPermissionCallbackSet() const;
562 bool InvokeNotificationPermissionCallback(
563 Ewk_Notification_Permission_Request* request);
565 bool GetMHTMLData(Ewk_View_MHTML_Data_Get_Callback callback, void* user_data);
566 void OnMHTMLContentGet(const std::string& mhtml_content, int callback_id);
567 bool SavePageAsMHTML(const std::string& path,
568 Ewk_View_Save_Page_Callback callback,
571 void ExitFullscreen();
573 void DidChangePageScaleFactor(double scale_factor);
574 void SetScaledContentsSize();
575 void SetJavaScriptAlertCallback(Ewk_View_JavaScript_Alert_Callback callback,
577 void JavaScriptAlertReply();
578 void SetJavaScriptConfirmCallback(
579 Ewk_View_JavaScript_Confirm_Callback callback,
581 void JavaScriptConfirmReply(bool result);
582 void SetJavaScriptPromptCallback(Ewk_View_JavaScript_Prompt_Callback callback,
584 void JavaScriptPromptReply(const char* result);
585 void set_renderer_crashed();
586 void GetPageScaleRange(double* min_scale, double* max_scale);
587 bool SetDrawsTransparentBackground(bool enabled);
588 bool GetDrawsTransparentBackground();
589 bool SetBackgroundColor(int red, int green, int blue, int alpha);
590 bool GetBackgroundColor(Ewk_View_Background_Color_Get_Callback callback,
592 void OnGetBackgroundColor(int callback_id, SkColor bg_color);
594 void GetSessionData(const char** data, unsigned* length) const;
595 bool RestoreFromSessionData(const char* data, unsigned length);
596 void ShowFileChooser(scoped_refptr<content::FileSelectListener> listener,
597 const blink::mojom::FileChooserParams&);
598 void SetBrowserFont();
599 bool IsDragging() const;
601 void RequestColorPicker(int r, int g, int b, int a);
602 bool SetColorPickerColor(int r, int g, int b, int a);
603 void InputPickerShow(ui::TextInputType input_type,
605 content::DateTimeChooserEfl* date_time_chooser);
607 void ShowContentsDetectedPopup(const char*);
609 // Returns TCP port number with Inspector, or 0 if error.
610 int StartInspectorServer(int port = 0);
611 bool StopInspectorServer();
613 void LoadNotFoundErrorPage(const std::string& invalidUrl);
614 static std::string GetPlatformLocale();
615 bool GetLinkMagnifierEnabled() const;
616 void SetLinkMagnifierEnabled(bool enabled);
618 bool GetHorizontalPanningHold() const;
619 void SetHorizontalPanningHold(bool hold);
620 bool GetVerticalPanningHold() const;
621 void SetVerticalPanningHold(bool hold);
623 void SetQuotaPermissionRequestCallback(
624 Ewk_Quota_Permission_Request_Callback callback,
626 #if !defined(EWK_BRINGUP) // FIXME: m114 bringup
627 void InvokeQuotaPermissionRequest(
628 _Ewk_Quota_Permission_Request* request,
629 content::QuotaPermissionContext::PermissionCallback cb);
630 void QuotaRequestReply(const _Ewk_Quota_Permission_Request* request,
632 void QuotaRequestCancel(const _Ewk_Quota_Permission_Request* request);
633 void SetViewMode(blink::WebViewMode view_mode);
635 gfx::Point GetContextMenuPosition() const;
637 content::ContextMenuControllerEfl* GetContextMenuController() {
638 return context_menu_.get();
641 bool SetMainFrameScrollbarVisible(bool visible);
642 bool GetMainFrameScrollbarVisible(
643 Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback callback,
645 void InvokeMainFrameScrollbarVisibleCallback(int callback_id, bool visible);
647 void ResetContextMenuController();
648 Eina_Bool AddJavaScriptMessageHandler(Evas_Object* view,
649 Ewk_View_Script_Message_Cb callback,
652 content::GinNativeBridgeDispatcherHost* GetGinNativeBridgeDispatcherHost()
654 return gin_native_bridge_dispatcher_host_.get();
656 bool SetPageVisibility(Ewk_Page_Visibility_State page_visibility_state);
658 void SetExceededIndexedDatabaseQuotaCallback(
659 Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback,
661 void InvokeExceededIndexedDatabaseQuotaCallback(const GURL& origin,
662 int64_t current_quota);
663 void ExceededIndexedDatabaseQuotaReply(bool allow);
665 #if defined(TIZEN_VIDEO_HOLE)
666 void EnableVideoHoleSupport();
669 #if defined(TIZEN_TBM_SUPPORT)
670 void SetOffscreenRendering(bool enable);
673 /// ---- Event handling
676 bool HandleMove(int x, int y);
677 bool HandleResize(int width, int height);
678 bool HandleTextSelectionDown(int x, int y);
679 bool HandleTextSelectionUp(int x, int y);
681 void HandleRendererProcessCrash();
682 void InvokeWebProcessCrashedCallback();
684 void HandleTapGestureForSelection(bool is_content_editable);
685 void HandleZoomGesture(blink::WebGestureEvent& event);
688 void RequestManifest(Ewk_View_Request_Manifest_Callback callback,
690 void DidRespondRequestManifest(_Ewk_View_Request_Manifest* manifest,
691 Ewk_View_Request_Manifest_Callback callback,
694 void SetBeforeUnloadConfirmPanelCallback(
695 Ewk_View_Before_Unload_Confirm_Panel_Callback callback,
697 void ReplyBeforeUnloadConfirmPanel(Eina_Bool result);
698 void SyncAcceptLanguages(const std::string& accept_languages);
700 #if BUILDFLAG(IS_TIZEN_TV)
701 //Browser edge scroll
702 bool EdgeScrollBy(int delta_x, int delta_y);
703 void GetMousePosition(gfx::Point&);
704 void InvokeEdgeScrollByCallback(const gfx::Point&, bool);
707 void OnOverscrolled(const gfx::Vector2dF& accumulated_overscroll,
708 const gfx::Vector2dF& latest_overscroll_delta);
710 bool SetVisibility(bool enable);
711 void SetDoNotTrack(Eina_Bool);
713 #if defined(TIZEN_ATK_SUPPORT)
714 void UpdateSpatialNavigationStatus(Eina_Bool enable);
715 void UpdateAccessibilityStatus(Eina_Bool enable);
717 bool CheckLazyInitializeAtk() {
718 return is_initialized_ && lazy_initialize_atk_;
723 #if defined(TIZEN_PEPPER_EXTENSIONS)
724 void InitializePepperExtensionSystem();
725 EwkExtensionSystemDelegate* GetExtensionDelegate();
727 void SetPepperExtensionWidgetInfo(Ewk_Value widget_pepper_ext_info);
728 void SetPepperExtensionCallback(Generic_Sync_Call_Callback cb, void* data);
729 void RegisterPepperExtensionDelegate();
730 void UnregisterPepperExtensionDelegate();
733 bool ShouldIgnoreNavigation(content::NavigationHandle* navigation_handle);
735 #if BUILDFLAG(IS_TIZEN_TV)
736 void DrawLabel(Evas_Object* image, Eina_Rectangle rect);
737 void DeactivateAtk(bool deactivated);
739 void AddDynamicCertificatePath(const std::string& host,
740 const std::string& cert_path);
742 bool SetMixedContents(bool allow);
743 void ClearAllTilesResources();
744 bool UseEarlyRWI() { return use_early_rwi_; }
745 bool RWIInfoShowed() { return rwi_info_showed_; }
746 GURL RWIURL() { return rwi_gurl_; }
747 void OnDialogClosed();
748 void NotifyMediaStateChanged(uint32_t type,
751 void SetHighBitRate(Eina_Bool is_high_bitrate);
752 bool IsHighBitRate() const { return is_high_bitrate_; }
753 #endif // IS_TIZEN_TV
755 void SetDidChangeThemeColorCallback(
756 Ewk_View_Did_Change_Theme_Color_Callback callback,
758 void DidChangeThemeColor(const SkColor& color);
760 void OnSelectionRectReceived(const gfx::Rect& selection_rect) const;
763 static void NativeViewResize(void* data,
767 void InitializeContent();
768 void InitializeWindowTreeHost();
769 void SendDelayedMessages(content::RenderViewHost* render_view_host);
771 void EvasToBlinkCords(int x, int y, int* view_x, int* view_y);
772 Eina_Bool AsyncRequestHitTestDataAtBlinkCords(
775 Ewk_Hit_Test_Mode mode,
776 WebViewAsyncRequestHitTestDataCallback* cb);
778 #if BUILDFLAG(IS_TIZEN_TV)
779 void InitInspectorServer();
781 void RunPendingSetFocus(Eina_Bool focus);
784 JavaScriptDialogManagerEfl* GetJavaScriptDialogManagerEfl();
786 // Changes viewport without resizing Evas_Object representing webview
787 // and its corresponding RWHV to let Blink renders custom viewport
788 // while showing picker.
789 void AdjustViewPortHeightToPopupMenu(bool is_popup_menu_visible);
791 void ShowContextMenuInternal(const content::ContextMenuParams&);
793 void UpdateWebkitPreferencesEfl(content::RenderViewHost*);
795 void ChangeScroll(int& x, int& y);
796 void ScrollFocusedNodeIntoView();
798 void GenerateMHTML(Ewk_View_Save_Page_Callback callback,
800 const base::FilePath& file_path);
801 void MHTMLGenerated(Ewk_View_Save_Page_Callback callback,
803 const base::FilePath& file_path,
806 static void VisibleContentChangedCallback(void* user_data,
810 static void OnCustomScrollBeginCallback(void* user_data,
814 static void OnCustomScrollEndCallback(void* user_data,
817 void UpdateContextMenuWithParams(const content::ContextMenuParams& params);
819 static Eina_Bool DelayedPopulateAndShowContextMenu(void* data);
821 scoped_refptr<Ewk_Context> context_;
822 std::unique_ptr<content::WebContents> web_contents_;
823 std::unique_ptr<content::WebContentsDelegateEfl> web_contents_delegate_;
824 std::unique_ptr<content::WebViewDelegate> webview_delegate_;
825 std::string pending_url_request_;
826 std::unique_ptr<Ewk_Settings> settings_;
827 std::unique_ptr<_Ewk_Frame> frame_;
828 std::unique_ptr<_Ewk_Policy_Decision> window_policy_;
829 Evas_Object* ewk_view_;
830 Evas_Object* efl_main_layout_;
831 bool key_events_enabled_ = true;
832 bool mouse_events_enabled_;
833 double text_zoom_factor_;
834 mutable std::string user_agent_;
835 mutable std::string user_agent_app_name_;
836 std::unique_ptr<_Ewk_Auth_Challenge> auth_challenge_;
837 std::string selected_text_cached_;
839 std::unique_ptr<content::ContextMenuControllerEfl> context_menu_;
840 #if BUILDFLAG(IS_TIZEN_TV)
841 std::unique_ptr<_Ewk_File_Chooser_Request> file_chooser_request_;
843 std::unique_ptr<content::FileChooserControllerEfl> file_chooser_;
845 std::unique_ptr<content::PopupControllerEfl> popup_controller_;
846 std::u16string previous_text_;
847 int current_find_request_id_;
848 static int find_request_id_counter_;
850 typedef WebViewCallback<Ewk_View_Plain_Text_Get_Callback, const char*>
851 EwkViewPlainTextGetCallback;
852 base::IDMap<EwkViewPlainTextGetCallback*> plain_text_get_callback_map_;
854 typedef WebViewCallback<Ewk_View_MHTML_Data_Get_Callback, const char*>
855 MHTMLCallbackDetails;
856 base::IDMap<MHTMLCallbackDetails*> mhtml_callback_map_;
858 typedef WebViewCallback<Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback,
860 MainFrameScrollbarVisibleGetCallback;
861 base::IDMap<MainFrameScrollbarVisibleGetCallback*>
862 main_frame_scrollbar_visible_callback_map_;
864 base::IDMap<BackgroundColorGetCallback*> background_color_get_callback_map_;
866 gfx::Size contents_size_;
868 mutable std::string title_;
869 Hit_Test_Params hit_test_params_;
870 base::WaitableEvent hit_test_completion_;
871 double page_scale_factor_;
875 WebViewCallback<Ewk_View_Geolocation_Permission_Callback,
876 _Ewk_Geolocation_Permission_Request*>
877 geolocation_permission_cb_;
878 WebViewCallback<Ewk_View_User_Media_Permission_Callback,
879 _Ewk_User_Media_Permission_Request*>
880 user_media_permission_cb_;
881 WebViewCallbackWithReturnValue<Ewk_User_Media_Permission_Query_Result,
882 Ewk_View_User_Media_Permission_Query_Callback,
883 _Ewk_User_Media_Permission_Query*>
884 user_media_permission_query_cb_;
885 WebViewErrorPageLoadCallback<Ewk_View_Error_Page_Load_Callback,
889 WebViewCallback<Ewk_View_Unfocus_Allow_Callback, Ewk_Unfocus_Direction>
891 WebViewCallback<Ewk_View_Notification_Permission_Callback,
892 Ewk_Notification_Permission_Request*>
893 notification_permission_callback_;
894 WebViewCallback<Ewk_Quota_Permission_Request_Callback,
895 const _Ewk_Quota_Permission_Request*>
896 quota_request_callback_;
897 WebViewCallback<Ewk_View_Authentication_Callback, _Ewk_Auth_Challenge*>
899 WebViewCallback<Ewk_View_Scale_Changed_Callback, double> scale_changed_cb_;
901 std::unique_ptr<content::InputPicker> input_picker_;
903 DidChangeThemeColorCallback did_change_theme_color_callback_;
905 base::IDMap<WebApplicationIconUrlGetCallback*>
906 web_app_icon_url_get_callback_map_;
907 base::IDMap<WebApplicationIconUrlsGetCallback*>
908 web_app_icon_urls_get_callback_map_;
909 base::IDMap<WebApplicationCapableGetCallback*>
910 web_app_capable_get_callback_map_;
911 std::unique_ptr<PermissionPopupManager> permission_popup_manager_;
912 std::unique_ptr<ScrollDetector> scroll_detector_;
914 // Manages injecting native objects.
915 std::unique_ptr<content::GinNativeBridgeDispatcherHost>
916 gin_native_bridge_dispatcher_host_;
918 WebViewExceededQuotaCallback<
919 Ewk_View_Exceeded_Indexed_Database_Quota_Callback,
920 Ewk_Security_Origin*,
922 exceeded_indexed_db_quota_callback_;
923 std::unique_ptr<Ewk_Security_Origin> exceeded_indexed_db_quota_origin_;
924 #if !defined(EWK_BRINGUP) // FIXME: m114 bringup
925 std::map<const _Ewk_Quota_Permission_Request*,
926 content::QuotaPermissionContext::PermissionCallback>
927 quota_permission_request_map_;
929 #if BUILDFLAG(IS_TIZEN)
930 blink::mojom::FileChooserParams::Mode filechooser_mode_ =
931 blink::mojom::FileChooserParams::Mode::kOpen;
932 Ecore_Event_Handler* window_rotate_handler_ = nullptr;
935 bool is_initialized_;
937 #if BUILDFLAG(IS_TIZEN_TV)
938 bool is_processing_edge_scroll_;
940 bool rwi_info_showed_;
942 bool is_high_bitrate_ = false;
944 base::OnceClosure pending_setfocus_closure_;
947 std::unique_ptr<_Ewk_Back_Forward_List> back_forward_list_;
949 static content::WebViewDelegate::WebContentsCreateCallback
950 create_new_window_web_contents_cb_;
952 #if defined(TIZEN_VIDEO_HOLE)
953 void EnableVideoHoleSupportInternal();
955 gfx::Vector2d previous_scroll_position_;
957 gfx::Point context_menu_position_;
959 content::ContextMenuParams saved_context_menu_params_;
961 std::vector<IPC::Message*> delayed_messages_;
963 std::map<int64_t, WebViewAsyncRequestHitTestDataCallback*> hit_test_callback_;
965 content::AcceptLanguagesHelper::AcceptLangsChangedCallback
966 accept_langs_changed_callback_;
968 std::unique_ptr<SelectPickerBase> select_picker_;
969 std::unique_ptr<aura::WindowTreeHost> host_;
970 std::unique_ptr<aura::client::FocusClient> focus_client_;
971 std::unique_ptr<aura::client::WindowParentingClient> window_parenting_client_;
972 std::unique_ptr<ui::CompositorObserver> compositor_observer_;
974 #if defined(TIZEN_ATK_SUPPORT)
975 std::unique_ptr<EWebAccessibility> eweb_accessibility_;
976 bool lazy_initialize_atk_ = false;
978 #if defined(TIZEN_PEPPER_EXTENSIONS)
979 content::ExtensionSystemDelegateManager::RenderFrameID render_frame_id_;
981 #if defined(TIZEN_VIDEO_HOLE)
982 bool pending_video_hole_setting_ = false;
985 Ecore_Timer* delayed_show_context_menu_timer_ = nullptr;
988 const unsigned int g_default_tilt_motion_sensitivity = 3;