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/callback.h"
15 #include "base/containers/id_map.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/quota_permission_context.h"
26 #include "content/public/browser/web_contents_delegate.h"
27 #include "content/public/browser/web_contents_efl_delegate.h"
28 #include "content/public/common/input_event_ack_state.h"
29 #include "content_browser_client_efl.h"
30 #include "context_menu_controller_efl.h"
31 #include "eweb_context.h"
32 #include "eweb_view_callbacks.h"
33 #include "file_chooser_controller_efl.h"
34 #include "permission_popup_manager.h"
35 #include "popup_controller_efl.h"
36 #include "private/ewk_auth_challenge_private.h"
37 #include "private/ewk_back_forward_list_private.h"
38 #include "private/ewk_history_private.h"
39 #include "private/ewk_hit_test_private.h"
40 #include "private/ewk_settings_private.h"
41 #include "private/ewk_web_application_icon_data_private.h"
42 #include "public/ewk_hit_test_internal.h"
43 #include "public/ewk_touch_internal.h"
44 #include "public/ewk_view_product.h"
45 #include "scroll_detector.h"
46 #include "third_party/blink/public/common/context_menu_data/menu_item_info.h"
47 #include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h"
48 #include "third_party/blink/public/mojom/choosers/popup_menu.mojom.h"
49 #include "ui/aura/window_tree_host.h"
50 #include "ui/gfx/geometry/point.h"
51 #include "ui/gfx/geometry/size.h"
52 #include "web_contents_delegate_efl.h"
53 #if defined(TIZEN_PEPPER_EXTENSIONS)
54 #include "ewk_extension_system_delegate.h"
55 #include "public/ewk_value_product.h"
61 class WindowParentingClient;
70 class RenderFrameHost;
72 class RenderWidgetHostViewAura;
73 class WebContentsDelegateEfl;
74 class WebContentsViewAura;
75 class ContextMenuControllerEfl;
76 class PopupControllerEfl;
77 class DateTimeChooserEfl;
79 class GinNativeBridgeDispatcherHost;
80 class NavigationHandle;
84 class _Ewk_App_Control;
85 class _Ewk_Policy_Decision;
88 class WebViewEvasEventHandler;
89 class _Ewk_Quota_Permission_Request;
91 #if defined(TIZEN_ATK_SUPPORT)
92 class EWebAccessibility;
95 template <typename CallbackPtr, typename CallbackParameter>
96 class WebViewCallback {
98 WebViewCallback() { Set(nullptr, nullptr); }
100 void Set(CallbackPtr cb, void* data) {
105 bool IsCallbackSet() const { return callback_; }
107 Eina_Bool Run(Evas_Object* webview,
108 CallbackParameter param,
109 Eina_Bool* callback_result) {
110 CHECK(callback_result);
111 if (IsCallbackSet()) {
112 *callback_result = callback_(webview, param, user_data_);
118 void Run(Evas_Object* webview, CallbackParameter param) {
120 callback_(webview, param, user_data_);
124 CallbackPtr callback_;
128 template <typename CallbackReturnValue,
129 typename CallbackPtr,
130 typename CallbackParameter>
131 class WebViewCallbackWithReturnValue {
133 WebViewCallbackWithReturnValue() { Set(nullptr, nullptr); }
135 void Set(CallbackPtr cb, void* data) {
140 /* LCOV_EXCL_START */
141 bool IsCallbackSet() const { return callback_; }
143 CallbackReturnValue Run(Evas_Object* webview, CallbackParameter param) {
145 return callback_(webview, param, user_data_);
152 CallbackPtr callback_;
156 template <typename CallbackPtr, typename... CallbackParameter>
157 class WebViewErrorPageLoadCallback {
159 WebViewErrorPageLoadCallback() { Set(nullptr, nullptr); }
161 void Set(CallbackPtr cb, void* data) {
166 bool IsCallbackSet() const { return callback_; }
168 void Run(Evas_Object* webview, CallbackParameter... param) {
170 callback_(webview, param..., user_data_);
174 CallbackPtr callback_;
178 template <typename CallbackPtr, typename... CallbackParameter>
179 class WebViewExceededQuotaCallback {
181 WebViewExceededQuotaCallback() { Set(nullptr, nullptr); }
183 void Set(CallbackPtr cb, void* data) {
188 bool IsCallbackSet() const { return callback_; }
190 /* LCOV_EXCL_START */
191 void Run(Evas_Object* webview, CallbackParameter... param) {
193 callback_(webview, param..., user_data_);
198 CallbackPtr callback_;
202 class BackgroundColorGetCallback {
204 BackgroundColorGetCallback(Ewk_View_Background_Color_Get_Callback func,
206 : func_(func), user_data_(user_data) {}
208 void Run(Evas_Object* webview, int r, int g, int b, int a) {
210 func_(webview, r, g, b, a, user_data_);
214 Ewk_View_Background_Color_Get_Callback func_;
218 class WebApplicationIconUrlGetCallback {
220 WebApplicationIconUrlGetCallback(Ewk_Web_App_Icon_URL_Get_Callback func,
222 : func_(func), user_data_(user_data) {}
223 void Run(const std::string& url) {
225 (func_)(url.c_str(), user_data_);
230 Ewk_Web_App_Icon_URL_Get_Callback func_;
234 class WebApplicationIconUrlsGetCallback {
236 WebApplicationIconUrlsGetCallback(Ewk_Web_App_Icon_URLs_Get_Callback func,
238 : func_(func), user_data_(user_data) {}
239 void Run(const std::map<std::string, std::string>& urls) {
241 Eina_List* list = NULL;
242 for (std::map<std::string, std::string>::const_iterator it = urls.begin();
243 it != urls.end(); ++it) {
244 _Ewk_Web_App_Icon_Data* data =
245 ewkWebAppIconDataCreate(it->first, it->second);
246 list = eina_list_append(list, data);
248 (func_)(list, user_data_);
253 Ewk_Web_App_Icon_URLs_Get_Callback func_;
257 class WebApplicationCapableGetCallback {
259 WebApplicationCapableGetCallback(Ewk_Web_App_Capable_Get_Callback func,
261 : func_(func), user_data_(user_data) {}
262 void Run(bool capable) {
264 (func_)(capable ? EINA_TRUE : EINA_FALSE, user_data_);
269 Ewk_Web_App_Capable_Get_Callback func_;
273 class DidChangeThemeColorCallback {
275 DidChangeThemeColorCallback() : callback_(nullptr), user_data_(nullptr) {}
276 void Set(Ewk_View_Did_Change_Theme_Color_Callback callback, void* user_data) {
277 callback_ = callback;
278 user_data_ = user_data;
280 void Run(Evas_Object* o, const SkColor& color) {
282 callback_(o, SkColorGetR(color), SkColorGetG(color), SkColorGetB(color),
283 SkColorGetA(color), user_data_);
287 Ewk_View_Did_Change_Theme_Color_Callback callback_;
291 class WebViewAsyncRequestHitTestDataCallback;
292 class JavaScriptDialogManagerEfl;
293 class PermissionPopupManager;
297 static EWebView* FromEvasObject(Evas_Object* eo);
299 EWebView(Ewk_Context*, Evas_Object* smart_object);
302 // initialize data members and activate event handlers.
303 // call this once after created and before use
306 bool CreateNewWindow(
307 content::WebContentsEflDelegate::WebContentsCreateCallback);
308 static Evas_Object* GetHostWindowDelegate(const content::WebContents*);
310 content::WebContentsViewAura* wcva() const;
311 content::RenderWidgetHostViewAura* rwhva() const;
312 Ewk_Context* context() const { return context_.get(); }
313 Evas_Object* evas_object() const { return evas_object_; }
314 Evas_Object* native_view() const { return native_view_; }
315 Evas_Object* GetElmWindow() const;
316 Evas* GetEvas() const { return evas_object_evas_get(evas_object_); }
317 PermissionPopupManager* GetPermissionPopupManager() const {
318 return permission_popup_manager_.get();
321 content::WebContents& web_contents() const { return *web_contents_.get(); }
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 void SetSessionTimeout(uint64_t timeout);
350 double GetTextZoomFactor() const;
351 void SetTextZoomFactor(double text_zoom_factor);
352 double GetPageZoomFactor() const;
353 void SetPageZoomFactor(double page_zoom_factor);
354 void ExecuteEditCommand(const char* command, const char* value);
355 #if BUILDFLAG(IS_TIZEN)
356 void EnterDragState();
358 void SetOrientation(int orientation);
359 int GetOrientation();
360 bool TouchEventsEnabled() const;
361 void SetTouchEventsEnabled(bool enabled);
362 bool MouseEventsEnabled() const;
363 void SetMouseEventsEnabled(bool enabled);
364 void HandleTouchEvents(Ewk_Touch_Event_Type type,
365 const Eina_List* points,
366 const Evas_Modifier* modifiers);
369 bool ExecuteJavaScript(const char* script,
370 Ewk_View_Script_Execute_Callback callback,
372 bool SetUserAgent(const char* userAgent);
373 bool SetUserAgentAppName(const char* application_name);
374 #if BUILDFLAG(IS_TIZEN)
375 bool SetPrivateBrowsing(bool incognito);
376 bool GetPrivateBrowsing() const;
378 const char* GetUserAgent() const;
379 const char* GetUserAgentAppName() const;
380 const char* CacheSelectedText();
381 Ewk_Settings* GetSettings() { return settings_.get(); }
382 _Ewk_Frame* GetMainFrame();
383 void UpdateWebKitPreferences();
384 void LoadHTMLString(const char* html,
385 const char* base_uri,
386 const char* unreachable_uri);
387 void LoadPlainTextString(const char* plain_text);
389 void LoadHTMLStringOverridingCurrentEntry(const char* html,
390 const char* base_uri,
391 const char* unreachable_url);
392 void LoadData(const char* data,
394 const char* mime_type,
395 const char* encoding,
396 const char* base_uri,
397 const char* unreachable_uri = NULL,
398 bool should_replace_current_entry = false);
399 void InvokeLoadError(const GURL& url, int error_code, bool is_cancellation);
401 void SetViewAuthCallback(Ewk_View_Authentication_Callback callback,
403 void InvokeAuthCallback(LoginDelegateEfl* login_delegate,
405 const std::string& realm);
406 void Find(const char* text, Ewk_Find_Options);
407 void InvokeAuthCallbackOnUI(_Ewk_Auth_Challenge* auth_challenge);
408 void SetContentSecurityPolicy(const char* policy, Ewk_CSP_Header_Type type);
409 void HandlePopupMenu(std::vector<blink::mojom::MenuItemPtr> items,
412 const gfx::Rect& bounds);
413 void HidePopupMenu();
414 void DidSelectPopupMenuItems(std::vector<int>& indices);
415 void DidCancelPopupMenu();
416 void HandleLongPressGesture(const content::ContextMenuParams&);
417 void ShowContextMenu(const content::ContextMenuParams&);
418 void CancelContextMenu(int request_id);
419 void SetScale(double scale_factor);
420 void SetScaleChangedCallback(Ewk_View_Scale_Changed_Callback callback,
423 bool GetScrollPosition(int* x, int* y) const;
424 void SetScroll(int x, int y);
425 void UrlRequestSet(const char* url,
426 content::NavigationController::LoadURLType loadtype,
430 SelectPickerBase* GetSelectPicker() const { return select_picker_.get(); }
431 content::SelectionControllerEfl* GetSelectionController() const;
432 content::PopupControllerEfl* GetPopupController() const {
433 return popup_controller_.get();
435 ScrollDetector* GetScrollDetector() const { return scroll_detector_.get(); }
436 void MoveCaret(const gfx::Point& point);
437 void SelectFocusedLink();
438 bool GetSelectionRange(Eina_Rectangle* left_rect, Eina_Rectangle* right_rect);
439 Eina_Bool ClearSelection();
441 // Callback OnCopyFromBackingStore will be called once we get the snapshot
443 void OnCopyFromBackingStore(bool success, const SkBitmap& bitmap);
448 void UpdateContextMenu(bool is_password_input);
449 void RenderViewReady();
452 * Creates a snapshot of given rectangle from EWebView
454 * @param rect rectangle of EWebView which will be taken into snapshot
455 * @param scale_factor scale factor
456 * @return created snapshot or NULL if error occured.
457 * @note ownership of snapshot is passed to caller
459 Evas_Object* GetSnapshot(Eina_Rectangle rect, float scale_factor);
461 bool GetSnapshotAsync(Eina_Rectangle rect,
462 Ewk_Web_App_Screenshot_Captured_Callback callback,
465 void InvokePolicyResponseCallback(_Ewk_Policy_Decision* policy_decision,
467 void InvokePolicyNavigationCallback(const NavigationPolicyParams& params,
469 void UseSettingsFont();
471 _Ewk_Hit_Test* RequestHitTestDataAt(int x, int y, Ewk_Hit_Test_Mode mode);
472 Eina_Bool AsyncRequestHitTestDataAt(int x,
474 Ewk_Hit_Test_Mode mode,
475 Ewk_View_Hit_Test_Request_Callback,
477 _Ewk_Hit_Test* RequestHitTestDataAtBlinkCoords(int x,
479 Ewk_Hit_Test_Mode mode);
480 Eina_Bool AsyncRequestHitTestDataAtBlinkCords(
483 Ewk_Hit_Test_Mode mode,
484 Ewk_View_Hit_Test_Request_Callback,
486 void DispatchAsyncHitTestData(const Hit_Test_Params& params,
488 void UpdateHitTestData(const Hit_Test_Params& params);
490 int current_find_request_id() const { return current_find_request_id_; }
491 bool PlainTextGet(Ewk_View_Plain_Text_Get_Callback callback, void* user_data);
492 void InvokePlainTextGetCallback(const std::string& content_text,
493 int plain_text_get_callback_id);
494 int SetEwkViewPlainTextGetCallback(Ewk_View_Plain_Text_Get_Callback callback,
496 void SetViewGeolocationPermissionCallback(
497 Ewk_View_Geolocation_Permission_Callback callback,
499 bool InvokeViewGeolocationPermissionCallback(
500 _Ewk_Geolocation_Permission_Request*
501 geolocation_permission_request_context,
503 void SetViewUserMediaPermissionCallback(
504 Ewk_View_User_Media_Permission_Callback callback,
506 bool InvokeViewUserMediaPermissionCallback(
507 _Ewk_User_Media_Permission_Request* user_media_permission_request_context,
509 void SetViewUserMediaPermissionQueryCallback(
510 Ewk_View_User_Media_Permission_Query_Callback callback,
512 Ewk_User_Media_Permission_Query_Result
513 InvokeViewUserMediaPermissionQueryCallback(
514 _Ewk_User_Media_Permission_Query* user_media_permission_query_context);
516 void SetViewLoadErrorPageCallback(Ewk_View_Error_Page_Load_Callback callback,
518 const char* InvokeViewLoadErrorPageCallback(
521 const std::string& error_description);
522 bool IsLoadErrorPageCallbackSet() const;
523 void SetViewUnfocusAllowCallback(Ewk_View_Unfocus_Allow_Callback callback,
525 bool InvokeViewUnfocusAllowCallback(Ewk_Unfocus_Direction direction,
527 void DidChangeContentsSize(int width, int height);
528 const Eina_Rectangle GetContentsSize() const;
529 void GetScrollSize(int* w, int* h);
531 void SetProgressValue(double progress);
532 double GetProgressValue();
533 const char* GetTitle();
534 bool SaveAsPdf(int width, int height, const std::string& file_name);
535 void BackForwardListClear();
536 _Ewk_Back_Forward_List* GetBackForwardList() const;
537 void InvokeBackForwardListChangedCallback();
538 _Ewk_History* GetBackForwardHistory() const;
539 bool WebAppCapableGet(Ewk_Web_App_Capable_Get_Callback callback,
541 bool WebAppIconUrlGet(Ewk_Web_App_Icon_URL_Get_Callback callback,
543 bool WebAppIconUrlsGet(Ewk_Web_App_Icon_URLs_Get_Callback callback,
545 void InvokeWebAppCapableGetCallback(bool capable, int callbackId);
546 void InvokeWebAppIconUrlGetCallback(const std::string& iconUrl,
548 void InvokeWebAppIconUrlsGetCallback(
549 const std::map<std::string, std::string>& iconUrls,
551 void SetNotificationPermissionCallback(
552 Ewk_View_Notification_Permission_Callback callback,
554 bool IsNotificationPermissionCallbackSet() const;
555 bool InvokeNotificationPermissionCallback(
556 Ewk_Notification_Permission_Request* request);
558 bool GetMHTMLData(Ewk_View_MHTML_Data_Get_Callback callback, void* user_data);
559 void OnMHTMLContentGet(const std::string& mhtml_content, int callback_id);
560 bool SavePageAsMHTML(const std::string& path,
561 Ewk_View_Save_Page_Callback callback,
564 void ExitFullscreen();
566 void DidChangePageScaleFactor(double scale_factor);
567 void SetScaledContentsSize();
568 void SetJavaScriptAlertCallback(Ewk_View_JavaScript_Alert_Callback callback,
570 void JavaScriptAlertReply();
571 void SetJavaScriptConfirmCallback(
572 Ewk_View_JavaScript_Confirm_Callback callback,
574 void JavaScriptConfirmReply(bool result);
575 void SetJavaScriptPromptCallback(Ewk_View_JavaScript_Prompt_Callback callback,
577 void JavaScriptPromptReply(const char* result);
578 void set_renderer_crashed();
579 void GetPageScaleRange(double* min_scale, double* max_scale);
580 void SetDrawsTransparentBackground(bool enabled);
581 bool GetBackgroundColor(Ewk_View_Background_Color_Get_Callback callback,
583 void OnGetBackgroundColor(int callback_id, SkColor bg_color);
585 void GetSessionData(const char** data, unsigned* length) const;
586 bool RestoreFromSessionData(const char* data, unsigned length);
587 void ShowFileChooser(content::RenderFrameHost* render_frame_host,
588 const blink::mojom::FileChooserParams&);
589 void SetBrowserFont();
590 bool IsDragging() const;
592 void RequestColorPicker(int r, int g, int b, int a);
593 bool SetColorPickerColor(int r, int g, int b, int a);
594 void InputPickerShow(ui::TextInputType input_type,
596 content::DateTimeChooserEfl* date_time_chooser);
598 void ShowContentsDetectedPopup(const char*);
600 // Returns TCP port number with Inspector, or 0 if error.
601 int StartInspectorServer(int port = 0);
602 bool StopInspectorServer();
604 void LoadNotFoundErrorPage(const std::string& invalidUrl);
605 static std::string GetPlatformLocale();
606 bool GetLinkMagnifierEnabled() const;
607 void SetLinkMagnifierEnabled(bool enabled);
609 bool GetHorizontalPanningHold() const;
610 void SetHorizontalPanningHold(bool hold);
611 bool GetVerticalPanningHold() const;
612 void SetVerticalPanningHold(bool hold);
614 void SetQuotaPermissionRequestCallback(
615 Ewk_Quota_Permission_Request_Callback callback,
617 void InvokeQuotaPermissionRequest(
618 _Ewk_Quota_Permission_Request* request,
619 content::QuotaPermissionContext::PermissionCallback cb);
620 void QuotaRequestReply(const _Ewk_Quota_Permission_Request* request,
622 void QuotaRequestCancel(const _Ewk_Quota_Permission_Request* request);
623 #if !defined(EWK_BRINGUP) // FIXME: m67 bringup
624 void SetViewMode(blink::WebViewMode view_mode);
626 gfx::Point GetContextMenuPosition() const;
628 content::ContextMenuControllerEfl* GetContextMenuController() {
629 return context_menu_.get();
632 bool SetMainFrameScrollbarVisible(bool visible);
633 bool GetMainFrameScrollbarVisible(
634 Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback callback,
636 void InvokeMainFrameScrollbarVisibleCallback(int callback_id, bool visible);
638 void ResetContextMenuController();
639 Eina_Bool AddJavaScriptMessageHandler(Evas_Object* view,
640 Ewk_View_Script_Message_Cb callback,
643 content::GinNativeBridgeDispatcherHost* GetGinNativeBridgeDispatcherHost()
645 return gin_native_bridge_dispatcher_host_.get();
647 bool SetPageVisibility(Ewk_Page_Visibility_State page_visibility_state);
649 void SetExceededIndexedDatabaseQuotaCallback(
650 Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback,
652 void InvokeExceededIndexedDatabaseQuotaCallback(const GURL& origin,
653 int64_t current_quota);
654 void ExceededIndexedDatabaseQuotaReply(bool allow);
656 #if defined(TIZEN_VIDEO_HOLE)
657 void EnableVideoHoleSupport();
660 #if defined(TIZEN_TBM_SUPPORT)
661 void SetOffscreenRendering(bool enable);
664 /// ---- Event handling
667 bool HandleMove(int x, int y);
668 bool HandleResize(int width, int height);
669 bool HandleTextSelectionDown(int x, int y);
670 bool HandleTextSelectionUp(int x, int y);
672 void HandleRendererProcessCrash();
673 void InvokeWebProcessCrashedCallback();
675 void HandleTapGestureForSelection(bool is_content_editable);
676 void HandleZoomGesture(blink::WebGestureEvent& event);
679 void RequestManifest(Ewk_View_Request_Manifest_Callback callback,
681 void DidRespondRequestManifest(_Ewk_View_Request_Manifest* manifest,
682 Ewk_View_Request_Manifest_Callback callback,
685 void SetBeforeUnloadConfirmPanelCallback(
686 Ewk_View_Before_Unload_Confirm_Panel_Callback callback,
688 void ReplyBeforeUnloadConfirmPanel(Eina_Bool result);
689 void SyncAcceptLanguages(const std::string& accept_languages);
691 #if BUILDFLAG(IS_TIZEN_TV)
692 //Browser edge scroll
693 bool EdgeScrollBy(int delta_x, int delta_y);
694 void GetMousePosition(gfx::Point&);
695 void InvokeEdgeScrollByCallback(const gfx::Point&, bool);
698 void OnOverscrolled(const gfx::Vector2dF& accumulated_overscroll,
699 const gfx::Vector2dF& latest_overscroll_delta);
701 bool SetVisibility(bool enable);
702 void SetDoNotTrack(Eina_Bool);
704 #if defined(TIZEN_ATK_SUPPORT)
705 void UpdateSpatialNavigationStatus(Eina_Bool enable);
706 void UpdateAccessibilityStatus(Eina_Bool enable);
708 bool CheckLazyInitializeAtk() {
709 return is_initialized_ && lazy_initialize_atk_;
714 #if defined(TIZEN_PEPPER_EXTENSIONS)
715 void InitializePepperExtensionSystem();
716 EwkExtensionSystemDelegate* GetExtensionDelegate();
718 void SetPepperExtensionWidgetInfo(Ewk_Value widget_pepper_ext_info);
719 void SetPepperExtensionCallback(Generic_Sync_Call_Callback cb, void* data);
720 void RegisterPepperExtensionDelegate();
721 void UnregisterPepperExtensionDelegate();
724 bool ShouldIgnoreNavigation(content::NavigationHandle* navigation_handle);
726 #if BUILDFLAG(IS_TIZEN_TV)
727 void DrawLabel(Evas_Object* image, Eina_Rectangle rect);
728 void DeactivateAtk(bool deactivated);
730 void AddDynamicCertificatePath(const std::string& host,
731 const std::string& cert_path);
733 bool SetMixedContents(bool allow);
734 void ClearAllTilesResources();
735 bool UseEarlyRWI() { return use_early_rwi_; }
736 bool RWIInfoShowed() { return rwi_info_showed_; }
737 GURL RWIURL() { return rwi_gurl_; }
738 void OnDialogClosed();
739 #endif // IS_TIZEN_TV
741 void SetDidChangeThemeColorCallback(
742 Ewk_View_Did_Change_Theme_Color_Callback callback,
744 void DidChangeThemeColor(const SkColor& color);
746 void OnSelectionRectReceived(const gfx::Rect& selection_rect) const;
749 static void NativeViewResize(void* data,
753 void InitializeContent();
754 void InitializeWindowTreeHost();
755 void SendDelayedMessages(content::RenderViewHost* render_view_host);
757 void EvasToBlinkCords(int x, int y, int* view_x, int* view_y);
758 Eina_Bool AsyncRequestHitTestDataAtBlinkCords(
761 Ewk_Hit_Test_Mode mode,
762 WebViewAsyncRequestHitTestDataCallback* cb);
764 #if BUILDFLAG(IS_TIZEN_TV)
765 void InitInspectorServer();
767 void RunPendingSetFocus(Eina_Bool focus);
770 #if BUILDFLAG(IS_TIZEN) && !defined(EWK_BRINGUP)
771 static void cameraResultCb(service_h request,
773 service_result_e result,
776 bool LaunchCamera(std::u16string mimetype);
779 JavaScriptDialogManagerEfl* GetJavaScriptDialogManagerEfl();
781 // Changes viewport without resizing Evas_Object representing webview
782 // and its corresponding RWHV to let Blink renders custom viewport
783 // while showing picker.
784 void AdjustViewPortHeightToPopupMenu(bool is_popup_menu_visible);
786 void ShowContextMenuInternal(const content::ContextMenuParams&);
788 void UpdateWebkitPreferencesEfl(content::RenderViewHost*);
790 void ChangeScroll(int& x, int& y);
791 void ScrollFocusedNodeIntoView();
793 void GenerateMHTML(Ewk_View_Save_Page_Callback callback,
795 const base::FilePath& file_path);
796 void MHTMLGenerated(Ewk_View_Save_Page_Callback callback,
798 const base::FilePath& file_path,
801 static void OnViewFocusIn(void* data, Evas*, Evas_Object*, void*);
802 static void OnViewFocusOut(void* data, Evas*, Evas_Object*, void*);
803 static void VisibleContentChangedCallback(void* user_data,
807 static void OnCustomScrollBeginCallback(void* user_data,
811 static void OnCustomScrollEndCallback(void* user_data,
814 void UpdateContextMenuWithParams(const content::ContextMenuParams& params);
816 static Eina_Bool DelayedPopulateAndShowContextMenu(void* data);
818 scoped_refptr<WebViewEvasEventHandler> evas_event_handler_;
819 scoped_refptr<Ewk_Context> context_;
820 std::unique_ptr<content::WebContents> web_contents_;
821 std::unique_ptr<content::WebContentsDelegateEfl> web_contents_delegate_;
822 std::string pending_url_request_;
823 std::unique_ptr<Ewk_Settings> settings_;
824 std::unique_ptr<_Ewk_Frame> frame_;
825 std::unique_ptr<_Ewk_Policy_Decision> window_policy_;
826 Evas_Object* evas_object_;
827 Evas_Object* native_view_;
828 bool mouse_events_enabled_;
829 double text_zoom_factor_;
830 mutable std::string user_agent_;
831 mutable std::string user_agent_app_name_;
832 std::unique_ptr<_Ewk_Auth_Challenge> auth_challenge_;
833 std::string selected_text_cached_;
835 std::unique_ptr<content::ContextMenuControllerEfl> context_menu_;
836 #if !defined(EWK_BRINGUP) // FIXME: m71 bringup
837 std::unique_ptr<content::FileChooserControllerEfl> file_chooser_;
839 std::unique_ptr<content::PopupControllerEfl> popup_controller_;
840 std::u16string previous_text_;
841 int current_find_request_id_;
842 static int find_request_id_counter_;
844 typedef WebViewCallback<Ewk_View_Plain_Text_Get_Callback, const char*>
845 EwkViewPlainTextGetCallback;
846 base::IDMap<EwkViewPlainTextGetCallback*> plain_text_get_callback_map_;
848 typedef WebViewCallback<Ewk_View_MHTML_Data_Get_Callback, const char*>
849 MHTMLCallbackDetails;
850 base::IDMap<MHTMLCallbackDetails*> mhtml_callback_map_;
852 typedef WebViewCallback<Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback,
854 MainFrameScrollbarVisibleGetCallback;
855 base::IDMap<MainFrameScrollbarVisibleGetCallback*>
856 main_frame_scrollbar_visible_callback_map_;
858 base::IDMap<BackgroundColorGetCallback*> background_color_get_callback_map_;
860 gfx::Size contents_size_;
862 mutable std::string title_;
863 Hit_Test_Params hit_test_params_;
864 base::WaitableEvent hit_test_completion_;
865 double page_scale_factor_;
869 WebViewCallback<Ewk_View_Geolocation_Permission_Callback,
870 _Ewk_Geolocation_Permission_Request*>
871 geolocation_permission_cb_;
872 WebViewCallback<Ewk_View_User_Media_Permission_Callback,
873 _Ewk_User_Media_Permission_Request*>
874 user_media_permission_cb_;
875 WebViewCallbackWithReturnValue<Ewk_User_Media_Permission_Query_Result,
876 Ewk_View_User_Media_Permission_Query_Callback,
877 _Ewk_User_Media_Permission_Query*>
878 user_media_permission_query_cb_;
879 WebViewErrorPageLoadCallback<Ewk_View_Error_Page_Load_Callback,
883 WebViewCallback<Ewk_View_Unfocus_Allow_Callback, Ewk_Unfocus_Direction>
885 WebViewCallback<Ewk_View_Notification_Permission_Callback,
886 Ewk_Notification_Permission_Request*>
887 notification_permission_callback_;
888 WebViewCallback<Ewk_Quota_Permission_Request_Callback,
889 const _Ewk_Quota_Permission_Request*>
890 quota_request_callback_;
891 WebViewCallback<Ewk_View_Authentication_Callback, _Ewk_Auth_Challenge*>
893 WebViewCallback<Ewk_View_Scale_Changed_Callback, double> scale_changed_cb_;
895 std::unique_ptr<content::InputPicker> input_picker_;
897 DidChangeThemeColorCallback did_change_theme_color_callback_;
899 base::IDMap<WebApplicationIconUrlGetCallback*>
900 web_app_icon_url_get_callback_map_;
901 base::IDMap<WebApplicationIconUrlsGetCallback*>
902 web_app_icon_urls_get_callback_map_;
903 base::IDMap<WebApplicationCapableGetCallback*>
904 web_app_capable_get_callback_map_;
905 std::unique_ptr<PermissionPopupManager> permission_popup_manager_;
906 std::unique_ptr<ScrollDetector> scroll_detector_;
908 // Manages injecting native objects.
909 std::unique_ptr<content::GinNativeBridgeDispatcherHost>
910 gin_native_bridge_dispatcher_host_;
912 WebViewExceededQuotaCallback<
913 Ewk_View_Exceeded_Indexed_Database_Quota_Callback,
914 Ewk_Security_Origin*,
916 exceeded_indexed_db_quota_callback_;
917 std::unique_ptr<Ewk_Security_Origin> exceeded_indexed_db_quota_origin_;
919 std::map<const _Ewk_Quota_Permission_Request*,
920 content::QuotaPermissionContext::PermissionCallback>
921 quota_permission_request_map_;
923 #if BUILDFLAG(IS_TIZEN)
924 blink::mojom::FileChooserParams::Mode filechooser_mode_ =
925 blink::mojom::FileChooserParams::Mode::kOpen;
926 Ecore_Event_Handler* window_rotate_handler_ = nullptr;
929 bool is_initialized_;
931 #if BUILDFLAG(IS_TIZEN_TV)
932 bool is_processing_edge_scroll_;
934 bool rwi_info_showed_;
937 base::OnceClosure pending_setfocus_closure_;
940 std::unique_ptr<_Ewk_Back_Forward_List> back_forward_list_;
942 static content::WebContentsEflDelegate::WebContentsCreateCallback
943 create_new_window_web_contents_cb_;
945 #if defined(TIZEN_VIDEO_HOLE)
946 void EnableVideoHoleSupportInternal();
948 gfx::Vector2d previous_scroll_position_;
950 gfx::Point context_menu_position_;
952 content::ContextMenuParams saved_context_menu_params_;
954 std::vector<IPC::Message*> delayed_messages_;
956 std::map<int64_t, WebViewAsyncRequestHitTestDataCallback*> hit_test_callback_;
958 content::AcceptLanguagesHelper::AcceptLangsChangedCallback
959 accept_langs_changed_callback_;
961 std::unique_ptr<SelectPickerBase> select_picker_;
962 std::unique_ptr<aura::WindowTreeHost> host_;
963 std::unique_ptr<aura::client::FocusClient> focus_client_;
964 std::unique_ptr<aura::client::WindowParentingClient> window_parenting_client_;
965 std::unique_ptr<ui::CompositorObserver> compositor_observer_;
967 #if defined(TIZEN_ATK_SUPPORT)
968 std::unique_ptr<EWebAccessibility> eweb_accessibility_;
969 bool lazy_initialize_atk_ = false;
971 #if defined(TIZEN_VIDEO_HOLE)
972 bool pending_video_hole_setting_ = false;
975 Ecore_Timer* delayed_show_context_menu_timer_ = nullptr;
978 const unsigned int g_default_tilt_motion_sensitivity = 3;