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/renderer_host/event_with_latency_info.h"
19 #include "content/browser/select_picker/select_picker_base.h"
20 #include "content/browser/selection/selection_controller_efl.h"
21 #include "content/browser/web_contents/web_contents_view_aura.h"
22 #include "content/browser/web_contents/web_contents_view_aura_helper_efl.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/web_contents_efl_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 WebViewEvasEventHandler;
88 class _Ewk_Quota_Permission_Request;
90 #if defined(TIZEN_ATK_SUPPORT)
91 class EWebAccessibility;
94 template <typename CallbackPtr, typename CallbackParameter>
95 class WebViewCallback {
97 WebViewCallback() { Set(nullptr, nullptr); }
99 void Set(CallbackPtr cb, void* data) {
104 bool IsCallbackSet() const { return callback_; }
106 Eina_Bool Run(Evas_Object* webview,
107 CallbackParameter param,
108 Eina_Bool* callback_result) {
109 CHECK(callback_result);
110 if (IsCallbackSet()) {
111 *callback_result = callback_(webview, param, user_data_);
117 void Run(Evas_Object* webview, CallbackParameter param) {
119 callback_(webview, param, user_data_);
123 CallbackPtr callback_;
127 template <typename CallbackReturnValue,
128 typename CallbackPtr,
129 typename CallbackParameter>
130 class WebViewCallbackWithReturnValue {
132 WebViewCallbackWithReturnValue() { Set(nullptr, nullptr); }
134 void Set(CallbackPtr cb, void* data) {
139 /* LCOV_EXCL_START */
140 bool IsCallbackSet() const { return callback_; }
142 CallbackReturnValue Run(Evas_Object* webview, CallbackParameter param) {
144 return callback_(webview, param, user_data_);
151 CallbackPtr callback_;
155 template <typename CallbackPtr, typename... CallbackParameter>
156 class WebViewErrorPageLoadCallback {
158 WebViewErrorPageLoadCallback() { Set(nullptr, nullptr); }
160 void Set(CallbackPtr cb, void* data) {
165 bool IsCallbackSet() const { return callback_; }
167 void Run(Evas_Object* webview, CallbackParameter... param) {
169 callback_(webview, param..., user_data_);
173 CallbackPtr callback_;
177 template <typename CallbackPtr, typename... CallbackParameter>
178 class WebViewExceededQuotaCallback {
180 WebViewExceededQuotaCallback() { Set(nullptr, nullptr); }
182 void Set(CallbackPtr cb, void* data) {
187 bool IsCallbackSet() const { return callback_; }
189 /* LCOV_EXCL_START */
190 void Run(Evas_Object* webview, CallbackParameter... param) {
192 callback_(webview, param..., user_data_);
197 CallbackPtr callback_;
201 class BackgroundColorGetCallback {
203 BackgroundColorGetCallback(Ewk_View_Background_Color_Get_Callback func,
205 : func_(func), user_data_(user_data) {}
207 void Run(Evas_Object* webview, int r, int g, int b, int a) {
209 func_(webview, r, g, b, a, user_data_);
213 Ewk_View_Background_Color_Get_Callback func_;
217 class WebApplicationIconUrlGetCallback {
219 WebApplicationIconUrlGetCallback(Ewk_Web_App_Icon_URL_Get_Callback func,
221 : func_(func), user_data_(user_data) {}
222 void Run(const std::string& url) {
224 (func_)(url.c_str(), user_data_);
229 Ewk_Web_App_Icon_URL_Get_Callback func_;
233 class WebApplicationIconUrlsGetCallback {
235 WebApplicationIconUrlsGetCallback(Ewk_Web_App_Icon_URLs_Get_Callback func,
237 : func_(func), user_data_(user_data) {}
238 void Run(const std::map<std::string, std::string>& urls) {
240 Eina_List* list = NULL;
241 for (std::map<std::string, std::string>::const_iterator it = urls.begin();
242 it != urls.end(); ++it) {
243 _Ewk_Web_App_Icon_Data* data =
244 ewkWebAppIconDataCreate(it->first, it->second);
245 list = eina_list_append(list, data);
247 (func_)(list, user_data_);
252 Ewk_Web_App_Icon_URLs_Get_Callback func_;
256 class WebApplicationCapableGetCallback {
258 WebApplicationCapableGetCallback(Ewk_Web_App_Capable_Get_Callback func,
260 : func_(func), user_data_(user_data) {}
261 void Run(bool capable) {
263 (func_)(capable ? EINA_TRUE : EINA_FALSE, user_data_);
268 Ewk_Web_App_Capable_Get_Callback func_;
272 class DidChangeThemeColorCallback {
274 DidChangeThemeColorCallback() : callback_(nullptr), user_data_(nullptr) {}
275 void Set(Ewk_View_Did_Change_Theme_Color_Callback callback, void* user_data) {
276 callback_ = callback;
277 user_data_ = user_data;
279 void Run(Evas_Object* o, const SkColor& color) {
281 callback_(o, SkColorGetR(color), SkColorGetG(color), SkColorGetB(color),
282 SkColorGetA(color), user_data_);
286 Ewk_View_Did_Change_Theme_Color_Callback callback_;
290 class WebViewAsyncRequestHitTestDataCallback;
291 class JavaScriptDialogManagerEfl;
292 class PermissionPopupManager;
296 static EWebView* FromEvasObject(Evas_Object* eo);
298 EWebView(Ewk_Context*, Evas_Object* smart_object);
301 // initialize data members and activate event handlers.
302 // call this once after created and before use
305 bool CreateNewWindow(
306 content::WebContentsEflDelegate::WebContentsCreateCallback);
307 static Evas_Object* GetHostWindowDelegate(const content::WebContents*);
309 content::WebContentsViewAura* wcva() const;
310 content::RenderWidgetHostViewAura* rwhva() const;
311 Ewk_Context* context() const { return context_.get(); }
312 Evas_Object* evas_object() const { return evas_object_; }
313 Evas_Object* native_view() const { return native_view_; }
314 Evas_Object* GetElmWindow() const;
315 Evas* GetEvas() const { return evas_object_evas_get(evas_object_); }
316 PermissionPopupManager* GetPermissionPopupManager() const {
317 return permission_popup_manager_.get();
320 content::WebContents& web_contents() const { return *web_contents_.get(); }
321 content::WebContentsViewAura* GetWebContentsViewAura() const;
323 #if defined(TIZEN_ATK_SUPPORT)
324 EWebAccessibility& eweb_accessibility() const {
325 return *eweb_accessibility_.get();
329 template <EWebViewCallbacks::CallbackType callbackType>
330 EWebViewCallbacks::CallBack<callbackType> SmartCallback() const {
331 return EWebViewCallbacks::CallBack<callbackType>(evas_object_);
335 void SetURL(const GURL& url, bool from_api = false);
336 const GURL& GetURL() const;
337 const GURL& GetOriginalURL() const;
339 void ReloadBypassingCache();
340 Eina_Bool CanGoBack();
341 Eina_Bool CanGoForward();
342 Eina_Bool HasFocus() const;
343 void SetFocus(Eina_Bool focus);
345 Eina_Bool GoForward();
349 #if BUILDFLAG(IS_TIZEN_TV)
350 void SetFloatVideoWindowState(bool enabled);
351 #endif // IS_TIZEN_TV
352 void SetSessionTimeout(uint64_t timeout);
353 double GetTextZoomFactor() const;
354 void SetTextZoomFactor(double text_zoom_factor);
355 double GetPageZoomFactor() const;
356 void SetPageZoomFactor(double page_zoom_factor);
357 void ExecuteEditCommand(const char* command, const char* value);
358 #if BUILDFLAG(IS_TIZEN)
359 void EnterDragState();
361 void SetOrientation(int orientation);
362 int GetOrientation();
363 bool TouchEventsEnabled() const;
364 void SetTouchEventsEnabled(bool enabled);
365 bool MouseEventsEnabled() const;
366 void SetMouseEventsEnabled(bool enabled);
367 void HandleTouchEvents(Ewk_Touch_Event_Type type,
368 const Eina_List* points,
369 const Evas_Modifier* modifiers);
372 bool ExecuteJavaScript(const char* script,
373 Ewk_View_Script_Execute_Callback callback,
375 bool SetUserAgent(const char* userAgent);
376 bool SetUserAgentAppName(const char* application_name);
377 #if BUILDFLAG(IS_TIZEN)
378 bool SetPrivateBrowsing(bool incognito);
379 bool GetPrivateBrowsing() const;
381 const char* GetUserAgent() const;
382 const char* GetUserAgentAppName() const;
383 const char* CacheSelectedText();
384 Ewk_Settings* GetSettings() { return settings_.get(); }
385 _Ewk_Frame* GetMainFrame();
386 void UpdateWebKitPreferences();
387 void LoadHTMLString(const char* html,
388 const char* base_uri,
389 const char* unreachable_uri);
390 void LoadPlainTextString(const char* plain_text);
392 void LoadHTMLStringOverridingCurrentEntry(const char* html,
393 const char* base_uri,
394 const char* unreachable_url);
395 void LoadData(const char* data,
397 const char* mime_type,
398 const char* encoding,
399 const char* base_uri,
400 const char* unreachable_uri = NULL,
401 bool should_replace_current_entry = false);
402 void InvokeLoadError(const GURL& url, int error_code, bool is_cancellation);
404 void SetViewAuthCallback(Ewk_View_Authentication_Callback callback,
406 void InvokeAuthCallback(LoginDelegateEfl* login_delegate,
408 const std::string& realm);
409 void Find(const char* text, Ewk_Find_Options);
410 void InvokeAuthCallbackOnUI(_Ewk_Auth_Challenge* auth_challenge);
411 void SetContentSecurityPolicy(const char* policy, Ewk_CSP_Header_Type type);
412 void HandlePopupMenu(std::vector<blink::mojom::MenuItemPtr> items,
415 const gfx::Rect& bounds);
416 void HidePopupMenu();
417 void DidSelectPopupMenuItems(std::vector<int>& indices);
418 void DidCancelPopupMenu();
419 void HandleLongPressGesture(const content::ContextMenuParams&);
420 void ShowContextMenu(const content::ContextMenuParams&);
421 void CancelContextMenu(int request_id);
422 void SetScale(double scale_factor);
423 void SetScaleChangedCallback(Ewk_View_Scale_Changed_Callback callback,
426 bool GetScrollPosition(int* x, int* y) const;
427 void SetScroll(int x, int y);
428 void UrlRequestSet(const char* url,
429 content::NavigationController::LoadURLType loadtype,
433 SelectPickerBase* GetSelectPicker() const { return select_picker_.get(); }
434 content::SelectionControllerEfl* GetSelectionController() const;
435 content::PopupControllerEfl* GetPopupController() const {
436 return popup_controller_.get();
438 ScrollDetector* GetScrollDetector() const { return scroll_detector_.get(); }
439 void MoveCaret(const gfx::Point& point);
440 void SelectFocusedLink();
441 bool GetSelectionRange(Eina_Rectangle* left_rect, Eina_Rectangle* right_rect);
442 Eina_Bool ClearSelection();
444 // Callback OnCopyFromBackingStore will be called once we get the snapshot
446 void OnCopyFromBackingStore(bool success, const SkBitmap& bitmap);
451 void UpdateContextMenu(bool is_password_input);
452 void RenderViewReady();
455 * Creates a snapshot of given rectangle from EWebView
457 * @param rect rectangle of EWebView which will be taken into snapshot
458 * @param scale_factor scale factor
459 * @return created snapshot or NULL if error occured.
460 * @note ownership of snapshot is passed to caller
462 Evas_Object* GetSnapshot(Eina_Rectangle rect, float scale_factor);
464 bool GetSnapshotAsync(Eina_Rectangle rect,
465 Ewk_Web_App_Screenshot_Captured_Callback callback,
468 void InvokePolicyResponseCallback(_Ewk_Policy_Decision* policy_decision,
470 void InvokePolicyNavigationCallback(const NavigationPolicyParams& params,
472 void UseSettingsFont();
474 _Ewk_Hit_Test* RequestHitTestDataAt(int x, int y, Ewk_Hit_Test_Mode mode);
475 Eina_Bool AsyncRequestHitTestDataAt(int x,
477 Ewk_Hit_Test_Mode mode,
478 Ewk_View_Hit_Test_Request_Callback,
480 _Ewk_Hit_Test* RequestHitTestDataAtBlinkCoords(int x,
482 Ewk_Hit_Test_Mode mode);
483 Eina_Bool AsyncRequestHitTestDataAtBlinkCords(
486 Ewk_Hit_Test_Mode mode,
487 Ewk_View_Hit_Test_Request_Callback,
489 void DispatchAsyncHitTestData(const Hit_Test_Params& params,
491 void UpdateHitTestData(const Hit_Test_Params& params);
493 int current_find_request_id() const { return current_find_request_id_; }
494 bool PlainTextGet(Ewk_View_Plain_Text_Get_Callback callback, void* user_data);
495 void InvokePlainTextGetCallback(const std::string& content_text,
496 int plain_text_get_callback_id);
497 int SetEwkViewPlainTextGetCallback(Ewk_View_Plain_Text_Get_Callback callback,
499 void SetViewGeolocationPermissionCallback(
500 Ewk_View_Geolocation_Permission_Callback callback,
502 bool InvokeViewGeolocationPermissionCallback(
503 _Ewk_Geolocation_Permission_Request*
504 geolocation_permission_request_context,
506 void SetViewUserMediaPermissionCallback(
507 Ewk_View_User_Media_Permission_Callback callback,
509 bool InvokeViewUserMediaPermissionCallback(
510 _Ewk_User_Media_Permission_Request* user_media_permission_request_context,
512 void SetViewUserMediaPermissionQueryCallback(
513 Ewk_View_User_Media_Permission_Query_Callback callback,
515 Ewk_User_Media_Permission_Query_Result
516 InvokeViewUserMediaPermissionQueryCallback(
517 _Ewk_User_Media_Permission_Query* user_media_permission_query_context);
519 void SetViewLoadErrorPageCallback(Ewk_View_Error_Page_Load_Callback callback,
521 const char* InvokeViewLoadErrorPageCallback(
524 const std::string& error_description);
525 bool IsLoadErrorPageCallbackSet() const;
526 void SetViewUnfocusAllowCallback(Ewk_View_Unfocus_Allow_Callback callback,
528 bool InvokeViewUnfocusAllowCallback(Ewk_Unfocus_Direction direction,
530 void DidChangeContentsSize(int width, int height);
531 const Eina_Rectangle GetContentsSize() const;
532 void GetScrollSize(int* w, int* h);
534 void SetProgressValue(double progress);
535 double GetProgressValue();
536 const char* GetTitle();
537 bool SaveAsPdf(int width, int height, const std::string& file_name);
538 void BackForwardListClear();
539 _Ewk_Back_Forward_List* GetBackForwardList() const;
540 void InvokeBackForwardListChangedCallback();
541 _Ewk_History* GetBackForwardHistory() const;
542 bool WebAppCapableGet(Ewk_Web_App_Capable_Get_Callback callback,
544 bool WebAppIconUrlGet(Ewk_Web_App_Icon_URL_Get_Callback callback,
546 bool WebAppIconUrlsGet(Ewk_Web_App_Icon_URLs_Get_Callback callback,
548 void InvokeWebAppCapableGetCallback(bool capable, int callbackId);
549 void InvokeWebAppIconUrlGetCallback(const std::string& iconUrl,
551 void InvokeWebAppIconUrlsGetCallback(
552 const std::map<std::string, std::string>& iconUrls,
554 void SetNotificationPermissionCallback(
555 Ewk_View_Notification_Permission_Callback callback,
557 bool IsNotificationPermissionCallbackSet() const;
558 bool InvokeNotificationPermissionCallback(
559 Ewk_Notification_Permission_Request* request);
561 bool GetMHTMLData(Ewk_View_MHTML_Data_Get_Callback callback, void* user_data);
562 void OnMHTMLContentGet(const std::string& mhtml_content, int callback_id);
563 bool SavePageAsMHTML(const std::string& path,
564 Ewk_View_Save_Page_Callback callback,
567 void ExitFullscreen();
569 void DidChangePageScaleFactor(double scale_factor);
570 void SetScaledContentsSize();
571 void SetJavaScriptAlertCallback(Ewk_View_JavaScript_Alert_Callback callback,
573 void JavaScriptAlertReply();
574 void SetJavaScriptConfirmCallback(
575 Ewk_View_JavaScript_Confirm_Callback callback,
577 void JavaScriptConfirmReply(bool result);
578 void SetJavaScriptPromptCallback(Ewk_View_JavaScript_Prompt_Callback callback,
580 void JavaScriptPromptReply(const char* result);
581 void set_renderer_crashed();
582 void GetPageScaleRange(double* min_scale, double* max_scale);
583 bool SetDrawsTransparentBackground(bool enabled);
584 bool GetDrawsTransparentBackground();
585 bool SetBackgroundColor(int red, int green, int blue, int alpha);
586 bool GetBackgroundColor(Ewk_View_Background_Color_Get_Callback callback,
588 void OnGetBackgroundColor(int callback_id, SkColor bg_color);
590 void GetSessionData(const char** data, unsigned* length) const;
591 bool RestoreFromSessionData(const char* data, unsigned length);
592 void ShowFileChooser(content::RenderFrameHost* render_frame_host,
593 const blink::mojom::FileChooserParams&);
594 void SetBrowserFont();
595 bool IsDragging() const;
597 void RequestColorPicker(int r, int g, int b, int a);
598 bool SetColorPickerColor(int r, int g, int b, int a);
599 void InputPickerShow(ui::TextInputType input_type,
601 content::DateTimeChooserEfl* date_time_chooser);
603 void ShowContentsDetectedPopup(const char*);
605 // Returns TCP port number with Inspector, or 0 if error.
606 int StartInspectorServer(int port = 0);
607 bool StopInspectorServer();
609 void LoadNotFoundErrorPage(const std::string& invalidUrl);
610 static std::string GetPlatformLocale();
611 bool GetLinkMagnifierEnabled() const;
612 void SetLinkMagnifierEnabled(bool enabled);
614 bool GetHorizontalPanningHold() const;
615 void SetHorizontalPanningHold(bool hold);
616 bool GetVerticalPanningHold() const;
617 void SetVerticalPanningHold(bool hold);
619 void SetQuotaPermissionRequestCallback(
620 Ewk_Quota_Permission_Request_Callback callback,
622 #if !defined(EWK_BRINGUP) // FIXME: m114 bringup
623 void InvokeQuotaPermissionRequest(
624 _Ewk_Quota_Permission_Request* request,
625 content::QuotaPermissionContext::PermissionCallback cb);
626 void QuotaRequestReply(const _Ewk_Quota_Permission_Request* request,
628 void QuotaRequestCancel(const _Ewk_Quota_Permission_Request* request);
629 void SetViewMode(blink::WebViewMode view_mode);
631 gfx::Point GetContextMenuPosition() const;
633 content::ContextMenuControllerEfl* GetContextMenuController() {
634 return context_menu_.get();
637 bool SetMainFrameScrollbarVisible(bool visible);
638 bool GetMainFrameScrollbarVisible(
639 Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback callback,
641 void InvokeMainFrameScrollbarVisibleCallback(int callback_id, bool visible);
643 void ResetContextMenuController();
644 Eina_Bool AddJavaScriptMessageHandler(Evas_Object* view,
645 Ewk_View_Script_Message_Cb callback,
648 content::GinNativeBridgeDispatcherHost* GetGinNativeBridgeDispatcherHost()
650 return gin_native_bridge_dispatcher_host_.get();
652 bool SetPageVisibility(Ewk_Page_Visibility_State page_visibility_state);
654 void SetExceededIndexedDatabaseQuotaCallback(
655 Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback,
657 void InvokeExceededIndexedDatabaseQuotaCallback(const GURL& origin,
658 int64_t current_quota);
659 void ExceededIndexedDatabaseQuotaReply(bool allow);
661 #if defined(TIZEN_VIDEO_HOLE)
662 void EnableVideoHoleSupport();
665 #if defined(TIZEN_TBM_SUPPORT)
666 void SetOffscreenRendering(bool enable);
669 /// ---- Event handling
672 bool HandleMove(int x, int y);
673 bool HandleResize(int width, int height);
674 bool HandleTextSelectionDown(int x, int y);
675 bool HandleTextSelectionUp(int x, int y);
677 void HandleRendererProcessCrash();
678 void InvokeWebProcessCrashedCallback();
680 void HandleTapGestureForSelection(bool is_content_editable);
681 void HandleZoomGesture(blink::WebGestureEvent& event);
684 void RequestManifest(Ewk_View_Request_Manifest_Callback callback,
686 void DidRespondRequestManifest(_Ewk_View_Request_Manifest* manifest,
687 Ewk_View_Request_Manifest_Callback callback,
690 void SetBeforeUnloadConfirmPanelCallback(
691 Ewk_View_Before_Unload_Confirm_Panel_Callback callback,
693 void ReplyBeforeUnloadConfirmPanel(Eina_Bool result);
694 void SyncAcceptLanguages(const std::string& accept_languages);
696 #if BUILDFLAG(IS_TIZEN_TV)
697 //Browser edge scroll
698 bool EdgeScrollBy(int delta_x, int delta_y);
699 void GetMousePosition(gfx::Point&);
700 void InvokeEdgeScrollByCallback(const gfx::Point&, bool);
703 void OnOverscrolled(const gfx::Vector2dF& accumulated_overscroll,
704 const gfx::Vector2dF& latest_overscroll_delta);
706 bool SetVisibility(bool enable);
707 void SetDoNotTrack(Eina_Bool);
709 #if defined(TIZEN_ATK_SUPPORT)
710 void UpdateSpatialNavigationStatus(Eina_Bool enable);
711 void UpdateAccessibilityStatus(Eina_Bool enable);
713 bool CheckLazyInitializeAtk() {
714 return is_initialized_ && lazy_initialize_atk_;
719 #if defined(TIZEN_PEPPER_EXTENSIONS)
720 void InitializePepperExtensionSystem();
721 EwkExtensionSystemDelegate* GetExtensionDelegate();
723 void SetPepperExtensionWidgetInfo(Ewk_Value widget_pepper_ext_info);
724 void SetPepperExtensionCallback(Generic_Sync_Call_Callback cb, void* data);
725 void RegisterPepperExtensionDelegate();
726 void UnregisterPepperExtensionDelegate();
729 bool ShouldIgnoreNavigation(content::NavigationHandle* navigation_handle);
731 #if BUILDFLAG(IS_TIZEN_TV)
732 void DrawLabel(Evas_Object* image, Eina_Rectangle rect);
733 void DeactivateAtk(bool deactivated);
735 void AddDynamicCertificatePath(const std::string& host,
736 const std::string& cert_path);
738 bool SetMixedContents(bool allow);
739 void ClearAllTilesResources();
740 bool UseEarlyRWI() { return use_early_rwi_; }
741 bool RWIInfoShowed() { return rwi_info_showed_; }
742 GURL RWIURL() { return rwi_gurl_; }
743 void OnDialogClosed();
744 #endif // IS_TIZEN_TV
746 void SetDidChangeThemeColorCallback(
747 Ewk_View_Did_Change_Theme_Color_Callback callback,
749 void DidChangeThemeColor(const SkColor& color);
751 void OnSelectionRectReceived(const gfx::Rect& selection_rect) const;
754 static void NativeViewResize(void* data,
758 void InitializeContent();
759 void InitializeWindowTreeHost();
760 void SendDelayedMessages(content::RenderViewHost* render_view_host);
762 void EvasToBlinkCords(int x, int y, int* view_x, int* view_y);
763 Eina_Bool AsyncRequestHitTestDataAtBlinkCords(
766 Ewk_Hit_Test_Mode mode,
767 WebViewAsyncRequestHitTestDataCallback* cb);
769 #if BUILDFLAG(IS_TIZEN_TV)
770 void InitInspectorServer();
772 void RunPendingSetFocus(Eina_Bool focus);
775 #if BUILDFLAG(IS_TIZEN) && !defined(EWK_BRINGUP)
776 static void cameraResultCb(service_h request,
778 service_result_e result,
781 bool LaunchCamera(std::u16string mimetype);
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 OnViewFocusIn(void* data, Evas*, Evas_Object*, void*);
807 static void OnViewFocusOut(void* data, Evas*, Evas_Object*, void*);
808 static void VisibleContentChangedCallback(void* user_data,
812 static void OnCustomScrollBeginCallback(void* user_data,
816 static void OnCustomScrollEndCallback(void* user_data,
819 void UpdateContextMenuWithParams(const content::ContextMenuParams& params);
821 static Eina_Bool DelayedPopulateAndShowContextMenu(void* data);
823 scoped_refptr<WebViewEvasEventHandler> evas_event_handler_;
824 scoped_refptr<Ewk_Context> context_;
825 std::unique_ptr<content::WebContents> web_contents_;
826 std::unique_ptr<content::WebContentsDelegateEfl> web_contents_delegate_;
827 std::string pending_url_request_;
828 std::unique_ptr<Ewk_Settings> settings_;
829 std::unique_ptr<_Ewk_Frame> frame_;
830 std::unique_ptr<_Ewk_Policy_Decision> window_policy_;
831 Evas_Object* evas_object_;
832 Evas_Object* native_view_;
833 bool mouse_events_enabled_;
834 double text_zoom_factor_;
835 mutable std::string user_agent_;
836 mutable std::string user_agent_app_name_;
837 std::unique_ptr<_Ewk_Auth_Challenge> auth_challenge_;
838 std::string selected_text_cached_;
840 std::unique_ptr<content::ContextMenuControllerEfl> context_menu_;
841 #if !defined(EWK_BRINGUP) // FIXME: m71 bringup
842 std::unique_ptr<content::FileChooserControllerEfl> file_chooser_;
844 std::unique_ptr<content::PopupControllerEfl> popup_controller_;
845 std::u16string previous_text_;
846 int current_find_request_id_;
847 static int find_request_id_counter_;
849 typedef WebViewCallback<Ewk_View_Plain_Text_Get_Callback, const char*>
850 EwkViewPlainTextGetCallback;
851 base::IDMap<EwkViewPlainTextGetCallback*> plain_text_get_callback_map_;
853 typedef WebViewCallback<Ewk_View_MHTML_Data_Get_Callback, const char*>
854 MHTMLCallbackDetails;
855 base::IDMap<MHTMLCallbackDetails*> mhtml_callback_map_;
857 typedef WebViewCallback<Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback,
859 MainFrameScrollbarVisibleGetCallback;
860 base::IDMap<MainFrameScrollbarVisibleGetCallback*>
861 main_frame_scrollbar_visible_callback_map_;
863 base::IDMap<BackgroundColorGetCallback*> background_color_get_callback_map_;
865 gfx::Size contents_size_;
867 mutable std::string title_;
868 Hit_Test_Params hit_test_params_;
869 base::WaitableEvent hit_test_completion_;
870 double page_scale_factor_;
874 WebViewCallback<Ewk_View_Geolocation_Permission_Callback,
875 _Ewk_Geolocation_Permission_Request*>
876 geolocation_permission_cb_;
877 WebViewCallback<Ewk_View_User_Media_Permission_Callback,
878 _Ewk_User_Media_Permission_Request*>
879 user_media_permission_cb_;
880 WebViewCallbackWithReturnValue<Ewk_User_Media_Permission_Query_Result,
881 Ewk_View_User_Media_Permission_Query_Callback,
882 _Ewk_User_Media_Permission_Query*>
883 user_media_permission_query_cb_;
884 WebViewErrorPageLoadCallback<Ewk_View_Error_Page_Load_Callback,
888 WebViewCallback<Ewk_View_Unfocus_Allow_Callback, Ewk_Unfocus_Direction>
890 WebViewCallback<Ewk_View_Notification_Permission_Callback,
891 Ewk_Notification_Permission_Request*>
892 notification_permission_callback_;
893 WebViewCallback<Ewk_Quota_Permission_Request_Callback,
894 const _Ewk_Quota_Permission_Request*>
895 quota_request_callback_;
896 WebViewCallback<Ewk_View_Authentication_Callback, _Ewk_Auth_Challenge*>
898 WebViewCallback<Ewk_View_Scale_Changed_Callback, double> scale_changed_cb_;
900 std::unique_ptr<content::InputPicker> input_picker_;
902 DidChangeThemeColorCallback did_change_theme_color_callback_;
904 base::IDMap<WebApplicationIconUrlGetCallback*>
905 web_app_icon_url_get_callback_map_;
906 base::IDMap<WebApplicationIconUrlsGetCallback*>
907 web_app_icon_urls_get_callback_map_;
908 base::IDMap<WebApplicationCapableGetCallback*>
909 web_app_capable_get_callback_map_;
910 std::unique_ptr<PermissionPopupManager> permission_popup_manager_;
911 std::unique_ptr<ScrollDetector> scroll_detector_;
913 // Manages injecting native objects.
914 std::unique_ptr<content::GinNativeBridgeDispatcherHost>
915 gin_native_bridge_dispatcher_host_;
917 WebViewExceededQuotaCallback<
918 Ewk_View_Exceeded_Indexed_Database_Quota_Callback,
919 Ewk_Security_Origin*,
921 exceeded_indexed_db_quota_callback_;
922 std::unique_ptr<Ewk_Security_Origin> exceeded_indexed_db_quota_origin_;
923 #if !defined(EWK_BRINGUP) // FIXME: m114 bringup
924 std::map<const _Ewk_Quota_Permission_Request*,
925 content::QuotaPermissionContext::PermissionCallback>
926 quota_permission_request_map_;
928 #if BUILDFLAG(IS_TIZEN)
929 blink::mojom::FileChooserParams::Mode filechooser_mode_ =
930 blink::mojom::FileChooserParams::Mode::kOpen;
931 Ecore_Event_Handler* window_rotate_handler_ = nullptr;
934 bool is_initialized_;
936 #if BUILDFLAG(IS_TIZEN_TV)
937 bool is_processing_edge_scroll_;
939 bool rwi_info_showed_;
942 base::OnceClosure pending_setfocus_closure_;
945 std::unique_ptr<_Ewk_Back_Forward_List> back_forward_list_;
947 static content::WebContentsEflDelegate::WebContentsCreateCallback
948 create_new_window_web_contents_cb_;
950 #if defined(TIZEN_VIDEO_HOLE)
951 void EnableVideoHoleSupportInternal();
953 gfx::Vector2d previous_scroll_position_;
955 gfx::Point context_menu_position_;
957 content::ContextMenuParams saved_context_menu_params_;
959 std::vector<IPC::Message*> delayed_messages_;
961 std::map<int64_t, WebViewAsyncRequestHitTestDataCallback*> hit_test_callback_;
963 content::AcceptLanguagesHelper::AcceptLangsChangedCallback
964 accept_langs_changed_callback_;
966 std::unique_ptr<SelectPickerBase> select_picker_;
967 std::unique_ptr<aura::WindowTreeHost> host_;
968 std::unique_ptr<aura::client::FocusClient> focus_client_;
969 std::unique_ptr<aura::client::WindowParentingClient> window_parenting_client_;
970 std::unique_ptr<ui::CompositorObserver> compositor_observer_;
972 #if defined(TIZEN_ATK_SUPPORT)
973 std::unique_ptr<EWebAccessibility> eweb_accessibility_;
974 bool lazy_initialize_atk_ = false;
976 #if defined(TIZEN_PEPPER_EXTENSIONS)
977 content::ExtensionSystemDelegateManager::RenderFrameID render_frame_id_;
979 #if defined(TIZEN_VIDEO_HOLE)
980 bool pending_video_hole_setting_ = false;
983 Ecore_Timer* delayed_show_context_menu_timer_ = nullptr;
986 const unsigned int g_default_tilt_motion_sensitivity = 3;