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/date_time_chooser_efl.h"
19 #include "content/browser/renderer_host/event_with_latency_info.h"
20 #include "content/browser/select_picker/select_picker_base.h"
21 #include "content/browser/selection/selection_controller_efl.h"
22 #include "content/browser/web_contents/web_contents_view_aura.h"
23 #include "content/browser/web_contents/web_contents_view_aura_helper_efl.h"
24 #include "content/public/browser/context_menu_params.h"
25 #include "content/public/browser/navigation_controller.h"
26 #include "content/public/browser/quota_permission_context.h"
27 #include "content/public/browser/web_contents_delegate.h"
28 #include "content/public/browser/web_contents_efl_delegate.h"
29 #include "content/public/common/input_event_ack_state.h"
30 #include "content_browser_client_efl.h"
31 #include "context_menu_controller_efl.h"
32 #include "eweb_context.h"
33 #include "eweb_view_callbacks.h"
34 #include "file_chooser_controller_efl.h"
35 #include "permission_popup_manager.h"
36 #include "popup_controller_efl.h"
37 #include "private/ewk_auth_challenge_private.h"
38 #include "private/ewk_back_forward_list_private.h"
39 #include "private/ewk_history_private.h"
40 #include "private/ewk_hit_test_private.h"
41 #include "private/ewk_settings_private.h"
42 #include "private/ewk_web_application_icon_data_private.h"
43 #include "public/ewk_hit_test_internal.h"
44 #include "public/ewk_touch_internal.h"
45 #include "public/ewk_view_product.h"
46 #include "scroll_detector.h"
47 #include "third_party/blink/public/common/context_menu_data/menu_item_info.h"
48 #include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h"
49 #include "third_party/blink/public/mojom/choosers/popup_menu.mojom.h"
50 #include "ui/aura/window_tree_host.h"
51 #include "ui/gfx/geometry/point.h"
52 #include "ui/gfx/geometry/size.h"
53 #include "web_contents_delegate_efl.h"
58 class WindowParentingClient;
67 class RenderFrameHost;
69 class RenderWidgetHostViewAura;
70 class WebContentsDelegateEfl;
71 class WebContentsViewAura;
72 class ContextMenuControllerEfl;
73 class PopupControllerEfl;
75 class GinNativeBridgeDispatcherHost;
76 class NavigationHandle;
80 class _Ewk_App_Control;
81 class _Ewk_Policy_Decision;
84 class WebViewEvasEventHandler;
85 class _Ewk_Quota_Permission_Request;
87 #if defined(TIZEN_ATK_SUPPORT)
88 class EWebAccessibility;
91 template <typename CallbackPtr, typename CallbackParameter>
92 class WebViewCallback {
94 WebViewCallback() { Set(nullptr, nullptr); }
96 void Set(CallbackPtr cb, void* data) {
101 bool IsCallbackSet() const { return callback_; }
103 Eina_Bool Run(Evas_Object* webview,
104 CallbackParameter param,
105 Eina_Bool* callback_result) {
106 CHECK(callback_result);
107 if (IsCallbackSet()) {
108 *callback_result = callback_(webview, param, user_data_);
114 void Run(Evas_Object* webview, CallbackParameter param) {
116 callback_(webview, param, user_data_);
120 CallbackPtr callback_;
124 template <typename CallbackReturnValue,
125 typename CallbackPtr,
126 typename CallbackParameter>
127 class WebViewCallbackWithReturnValue {
129 WebViewCallbackWithReturnValue() { Set(nullptr, nullptr); }
131 void Set(CallbackPtr cb, void* data) {
136 /* LCOV_EXCL_START */
137 bool IsCallbackSet() const { return callback_; }
139 CallbackReturnValue Run(Evas_Object* webview, CallbackParameter param) {
141 return callback_(webview, param, user_data_);
148 CallbackPtr callback_;
152 template <typename CallbackPtr, typename... CallbackParameter>
153 class WebViewErrorPageLoadCallback {
155 WebViewErrorPageLoadCallback() { Set(nullptr, nullptr); }
157 void Set(CallbackPtr cb, void* data) {
162 bool IsCallbackSet() const { return callback_; }
164 void Run(Evas_Object* webview, CallbackParameter... param) {
166 callback_(webview, param..., user_data_);
170 CallbackPtr callback_;
174 template <typename CallbackPtr, typename... CallbackParameter>
175 class WebViewExceededQuotaCallback {
177 WebViewExceededQuotaCallback() { Set(nullptr, nullptr); }
179 void Set(CallbackPtr cb, void* data) {
184 bool IsCallbackSet() const { return callback_; }
186 /* LCOV_EXCL_START */
187 void Run(Evas_Object* webview, CallbackParameter... param) {
189 callback_(webview, param..., user_data_);
194 CallbackPtr callback_;
198 class BackgroundColorGetCallback {
200 BackgroundColorGetCallback(Ewk_View_Background_Color_Get_Callback func,
202 : func_(func), user_data_(user_data) {}
204 void Run(Evas_Object* webview, int r, int g, int b, int a) {
206 func_(webview, r, g, b, a, user_data_);
210 Ewk_View_Background_Color_Get_Callback func_;
214 class WebApplicationIconUrlGetCallback {
216 WebApplicationIconUrlGetCallback(Ewk_Web_App_Icon_URL_Get_Callback func,
218 : func_(func), user_data_(user_data) {}
219 void Run(const std::string& url) {
221 (func_)(url.c_str(), user_data_);
226 Ewk_Web_App_Icon_URL_Get_Callback func_;
230 class WebApplicationIconUrlsGetCallback {
232 WebApplicationIconUrlsGetCallback(Ewk_Web_App_Icon_URLs_Get_Callback func,
234 : func_(func), user_data_(user_data) {}
235 void Run(const std::map<std::string, std::string>& urls) {
237 Eina_List* list = NULL;
238 for (std::map<std::string, std::string>::const_iterator it = urls.begin();
239 it != urls.end(); ++it) {
240 _Ewk_Web_App_Icon_Data* data =
241 ewkWebAppIconDataCreate(it->first, it->second);
242 list = eina_list_append(list, data);
244 (func_)(list, user_data_);
249 Ewk_Web_App_Icon_URLs_Get_Callback func_;
253 class WebApplicationCapableGetCallback {
255 WebApplicationCapableGetCallback(Ewk_Web_App_Capable_Get_Callback func,
257 : func_(func), user_data_(user_data) {}
258 void Run(bool capable) {
260 (func_)(capable ? EINA_TRUE : EINA_FALSE, user_data_);
265 Ewk_Web_App_Capable_Get_Callback func_;
269 class DidChangeThemeColorCallback {
271 DidChangeThemeColorCallback() : callback_(nullptr), user_data_(nullptr) {}
272 void Set(Ewk_View_Did_Change_Theme_Color_Callback callback, void* user_data) {
273 callback_ = callback;
274 user_data_ = user_data;
276 void Run(Evas_Object* o, const SkColor& color) {
278 callback_(o, SkColorGetR(color), SkColorGetG(color), SkColorGetB(color),
279 SkColorGetA(color), user_data_);
283 Ewk_View_Did_Change_Theme_Color_Callback callback_;
287 class WebViewAsyncRequestHitTestDataCallback;
288 class JavaScriptDialogManagerEfl;
289 class PermissionPopupManager;
293 static EWebView* FromEvasObject(Evas_Object* eo);
295 EWebView(Ewk_Context*, Evas_Object* smart_object);
298 // initialize data members and activate event handlers.
299 // call this once after created and before use
302 bool CreateNewWindow(
303 content::WebContentsEflDelegate::WebContentsCreateCallback);
304 static Evas_Object* GetHostWindowDelegate(const content::WebContents*);
306 content::WebContentsViewAura* wcva() const;
307 content::RenderWidgetHostViewAura* rwhva() const;
308 Ewk_Context* context() const { return context_.get(); }
309 Evas_Object* evas_object() const { return evas_object_; }
310 Evas_Object* native_view() const { return native_view_; }
311 Evas_Object* GetElmWindow() const;
312 Evas* GetEvas() const { return evas_object_evas_get(evas_object_); }
313 PermissionPopupManager* GetPermissionPopupManager() const {
314 return permission_popup_manager_.get();
317 content::WebContents& web_contents() const { return *web_contents_.get(); }
319 #if defined(TIZEN_ATK_SUPPORT)
320 EWebAccessibility& eweb_accessibility() const {
321 return *eweb_accessibility_.get();
325 template <EWebViewCallbacks::CallbackType callbackType>
326 EWebViewCallbacks::CallBack<callbackType> SmartCallback() const {
327 return EWebViewCallbacks::CallBack<callbackType>(evas_object_);
331 void SetURL(const GURL& url, bool from_api = false);
332 const GURL& GetURL() const;
333 const GURL& GetOriginalURL() const;
335 void ReloadBypassingCache();
336 Eina_Bool CanGoBack();
337 Eina_Bool CanGoForward();
338 Eina_Bool HasFocus() const;
339 void SetFocus(Eina_Bool focus);
341 Eina_Bool GoForward();
345 void SetSessionTimeout(uint64_t timeout);
346 double GetTextZoomFactor() const;
347 void SetTextZoomFactor(double text_zoom_factor);
348 double GetPageZoomFactor() const;
349 void SetPageZoomFactor(double page_zoom_factor);
350 void ExecuteEditCommand(const char* command, const char* value);
351 #if BUILDFLAG(IS_TIZEN)
352 void EnterDragState();
354 void SetOrientation(int orientation);
355 int GetOrientation();
356 bool TouchEventsEnabled() const;
357 void SetTouchEventsEnabled(bool enabled);
358 bool MouseEventsEnabled() const;
359 void SetMouseEventsEnabled(bool enabled);
360 void HandleTouchEvents(Ewk_Touch_Event_Type type,
361 const Eina_List* points,
362 const Evas_Modifier* modifiers);
365 bool ExecuteJavaScript(const char* script,
366 Ewk_View_Script_Execute_Callback callback,
368 bool SetUserAgent(const char* userAgent);
369 bool SetUserAgentAppName(const char* application_name);
370 #if BUILDFLAG(IS_TIZEN)
371 bool SetPrivateBrowsing(bool incognito);
372 bool GetPrivateBrowsing() const;
374 const char* GetUserAgent() const;
375 const char* GetUserAgentAppName() const;
376 const char* CacheSelectedText();
377 Ewk_Settings* GetSettings() { return settings_.get(); }
378 _Ewk_Frame* GetMainFrame();
379 void UpdateWebKitPreferences();
380 void LoadHTMLString(const char* html,
381 const char* base_uri,
382 const char* unreachable_uri);
383 void LoadPlainTextString(const char* plain_text);
384 void LoadData(const char* data,
386 const char* mime_type,
387 const char* encoding,
388 const char* base_uri,
389 const char* unreachable_uri = NULL);
391 void InvokeLoadError(const GURL& url, int error_code, bool is_cancellation);
393 void SetViewAuthCallback(Ewk_View_Authentication_Callback callback,
395 void InvokeAuthCallback(LoginDelegateEfl* login_delegate,
397 const std::string& realm);
398 void Find(const char* text, Ewk_Find_Options);
399 void InvokeAuthCallbackOnUI(_Ewk_Auth_Challenge* auth_challenge);
400 void SetContentSecurityPolicy(const char* policy, Ewk_CSP_Header_Type type);
401 void HandlePopupMenu(std::vector<blink::mojom::MenuItemPtr> items,
404 const gfx::Rect& bounds);
405 void HidePopupMenu();
406 void DidSelectPopupMenuItems(std::vector<int>& indices);
407 void DidCancelPopupMenu();
408 void HandleLongPressGesture(const content::ContextMenuParams&);
409 void ShowContextMenu(const content::ContextMenuParams&);
410 void CancelContextMenu(int request_id);
411 void SetScale(double scale_factor);
412 void SetScaleChangedCallback(Ewk_View_Scale_Changed_Callback callback,
415 bool GetScrollPosition(int* x, int* y) const;
416 void SetScroll(int x, int y);
417 void UrlRequestSet(const char* url,
418 content::NavigationController::LoadURLType loadtype,
422 SelectPickerBase* GetSelectPicker() const { return select_picker_.get(); }
423 content::SelectionControllerEfl* GetSelectionController() const;
424 content::PopupControllerEfl* GetPopupController() const {
425 return popup_controller_.get();
427 ScrollDetector* GetScrollDetector() const { return scroll_detector_.get(); }
428 void MoveCaret(const gfx::Point& point);
429 void SelectFocusedLink();
430 bool GetSelectionRange(Eina_Rectangle* left_rect, Eina_Rectangle* right_rect);
431 Eina_Bool ClearSelection();
433 // Callback OnCopyFromBackingStore will be called once we get the snapshot
435 void OnCopyFromBackingStore(bool success, const SkBitmap& bitmap);
440 void UpdateContextMenu(bool is_password_input);
441 void RenderViewReady();
444 * Creates a snapshot of given rectangle from EWebView
446 * @param rect rectangle of EWebView which will be taken into snapshot
447 * @param scale_factor scale factor
448 * @return created snapshot or NULL if error occured.
449 * @note ownership of snapshot is passed to caller
451 Evas_Object* GetSnapshot(Eina_Rectangle rect, float scale_factor);
453 bool GetSnapshotAsync(Eina_Rectangle rect,
454 Ewk_Web_App_Screenshot_Captured_Callback callback,
457 void InvokePolicyResponseCallback(_Ewk_Policy_Decision* policy_decision,
459 void InvokePolicyNavigationCallback(const NavigationPolicyParams& params,
461 void UseSettingsFont();
463 _Ewk_Hit_Test* RequestHitTestDataAt(int x, int y, Ewk_Hit_Test_Mode mode);
464 Eina_Bool AsyncRequestHitTestDataAt(int x,
466 Ewk_Hit_Test_Mode mode,
467 Ewk_View_Hit_Test_Request_Callback,
469 _Ewk_Hit_Test* RequestHitTestDataAtBlinkCoords(int x,
471 Ewk_Hit_Test_Mode mode);
472 Eina_Bool AsyncRequestHitTestDataAtBlinkCords(
475 Ewk_Hit_Test_Mode mode,
476 Ewk_View_Hit_Test_Request_Callback,
478 void DispatchAsyncHitTestData(const Hit_Test_Params& params,
480 void UpdateHitTestData(const Hit_Test_Params& params);
482 int current_find_request_id() const { return current_find_request_id_; }
483 bool PlainTextGet(Ewk_View_Plain_Text_Get_Callback callback, void* user_data);
484 void InvokePlainTextGetCallback(const std::string& content_text,
485 int plain_text_get_callback_id);
486 int SetEwkViewPlainTextGetCallback(Ewk_View_Plain_Text_Get_Callback callback,
488 void SetViewGeolocationPermissionCallback(
489 Ewk_View_Geolocation_Permission_Callback callback,
491 bool InvokeViewGeolocationPermissionCallback(
492 _Ewk_Geolocation_Permission_Request*
493 geolocation_permission_request_context,
495 void SetViewUserMediaPermissionCallback(
496 Ewk_View_User_Media_Permission_Callback callback,
498 bool InvokeViewUserMediaPermissionCallback(
499 _Ewk_User_Media_Permission_Request* user_media_permission_request_context,
501 void SetViewUserMediaPermissionQueryCallback(
502 Ewk_View_User_Media_Permission_Query_Callback callback,
504 Ewk_User_Media_Permission_Query_Result
505 InvokeViewUserMediaPermissionQueryCallback(
506 _Ewk_User_Media_Permission_Query* user_media_permission_query_context);
508 void SetViewLoadErrorPageCallback(Ewk_View_Error_Page_Load_Callback callback,
510 const char* InvokeViewLoadErrorPageCallback(
513 const std::string& error_description);
514 bool IsLoadErrorPageCallbackSet() const;
515 void SetViewUnfocusAllowCallback(Ewk_View_Unfocus_Allow_Callback callback,
517 bool InvokeViewUnfocusAllowCallback(Ewk_Unfocus_Direction direction,
519 void DidChangeContentsSize(int width, int height);
520 const Eina_Rectangle GetContentsSize() const;
521 void GetScrollSize(int* w, int* h);
523 void SetProgressValue(double progress);
524 double GetProgressValue();
525 const char* GetTitle();
526 bool SaveAsPdf(int width, int height, const std::string& file_name);
527 void BackForwardListClear();
528 _Ewk_Back_Forward_List* GetBackForwardList() const;
529 void InvokeBackForwardListChangedCallback();
530 _Ewk_History* GetBackForwardHistory() const;
531 bool WebAppCapableGet(Ewk_Web_App_Capable_Get_Callback callback,
533 bool WebAppIconUrlGet(Ewk_Web_App_Icon_URL_Get_Callback callback,
535 bool WebAppIconUrlsGet(Ewk_Web_App_Icon_URLs_Get_Callback callback,
537 void InvokeWebAppCapableGetCallback(bool capable, int callbackId);
538 void InvokeWebAppIconUrlGetCallback(const std::string& iconUrl,
540 void InvokeWebAppIconUrlsGetCallback(
541 const std::map<std::string, std::string>& iconUrls,
543 void SetNotificationPermissionCallback(
544 Ewk_View_Notification_Permission_Callback callback,
546 bool IsNotificationPermissionCallbackSet() const;
547 bool InvokeNotificationPermissionCallback(
548 Ewk_Notification_Permission_Request* request);
550 bool GetMHTMLData(Ewk_View_MHTML_Data_Get_Callback callback, void* user_data);
551 void OnMHTMLContentGet(const std::string& mhtml_content, int callback_id);
552 bool SavePageAsMHTML(const std::string& path,
553 Ewk_View_Save_Page_Callback callback,
556 void ExitFullscreen();
558 void DidChangePageScaleFactor(double scale_factor);
559 void SetScaledContentsSize();
560 void SetJavaScriptAlertCallback(Ewk_View_JavaScript_Alert_Callback callback,
562 void JavaScriptAlertReply();
563 void SetJavaScriptConfirmCallback(
564 Ewk_View_JavaScript_Confirm_Callback callback,
566 void JavaScriptConfirmReply(bool result);
567 void SetJavaScriptPromptCallback(Ewk_View_JavaScript_Prompt_Callback callback,
569 void JavaScriptPromptReply(const char* result);
570 void set_renderer_crashed();
571 void GetPageScaleRange(double* min_scale, double* max_scale);
572 void SetDrawsTransparentBackground(bool enabled);
573 bool GetBackgroundColor(Ewk_View_Background_Color_Get_Callback callback,
575 void OnGetBackgroundColor(int callback_id, SkColor bg_color);
577 void GetSessionData(const char** data, unsigned* length) const;
578 bool RestoreFromSessionData(const char* data, unsigned length);
579 void ShowFileChooser(content::RenderFrameHost* render_frame_host,
580 const blink::mojom::FileChooserParams&);
581 void SetBrowserFont();
582 bool IsDragging() const;
584 void RequestColorPicker(int r, int g, int b, int a);
585 bool SetColorPickerColor(int r, int g, int b, int a);
586 void InputPickerShow(ui::TextInputType input_type,
588 content::DateTimeChooserEfl* date_time_chooser);
590 void ShowContentsDetectedPopup(const char*);
592 // Returns TCP port number with Inspector, or 0 if error.
593 int StartInspectorServer(int port = 0);
594 bool StopInspectorServer();
596 void LoadNotFoundErrorPage(const std::string& invalidUrl);
597 static std::string GetPlatformLocale();
598 bool GetLinkMagnifierEnabled() const;
599 void SetLinkMagnifierEnabled(bool enabled);
601 bool GetHorizontalPanningHold() const;
602 void SetHorizontalPanningHold(bool hold);
603 bool GetVerticalPanningHold() const;
604 void SetVerticalPanningHold(bool hold);
606 void SetQuotaPermissionRequestCallback(
607 Ewk_Quota_Permission_Request_Callback callback,
609 void InvokeQuotaPermissionRequest(
610 _Ewk_Quota_Permission_Request* request,
611 content::QuotaPermissionContext::PermissionCallback cb);
612 void QuotaRequestReply(const _Ewk_Quota_Permission_Request* request,
614 void QuotaRequestCancel(const _Ewk_Quota_Permission_Request* request);
615 #if !defined(EWK_BRINGUP) // FIXME: m67 bringup
616 void SetViewMode(blink::WebViewMode view_mode);
618 gfx::Point GetContextMenuPosition() const;
620 content::ContextMenuControllerEfl* GetContextMenuController() {
621 return context_menu_.get();
624 bool SetMainFrameScrollbarVisible(bool visible);
625 bool GetMainFrameScrollbarVisible(
626 Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback callback,
628 void InvokeMainFrameScrollbarVisibleCallback(int callback_id, bool visible);
630 void ResetContextMenuController();
631 Eina_Bool AddJavaScriptMessageHandler(Evas_Object* view,
632 Ewk_View_Script_Message_Cb callback,
635 content::GinNativeBridgeDispatcherHost* GetGinNativeBridgeDispatcherHost()
637 return gin_native_bridge_dispatcher_host_.get();
639 bool SetPageVisibility(Ewk_Page_Visibility_State page_visibility_state);
641 void SetExceededIndexedDatabaseQuotaCallback(
642 Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback,
644 void InvokeExceededIndexedDatabaseQuotaCallback(const GURL& origin,
645 int64_t current_quota);
646 void ExceededIndexedDatabaseQuotaReply(bool allow);
648 #if defined(TIZEN_VIDEO_HOLE)
649 void SetVideoHoleSupport(bool enable);
652 /// ---- Event handling
655 bool HandleMove(int x, int y);
656 bool HandleResize(int width, int height);
657 bool HandleTextSelectionDown(int x, int y);
658 bool HandleTextSelectionUp(int x, int y);
660 void HandleRendererProcessCrash();
661 void InvokeWebProcessCrashedCallback();
663 void HandleTapGestureForSelection(bool is_content_editable);
664 void HandleZoomGesture(blink::WebGestureEvent& event);
667 void RequestManifest(Ewk_View_Request_Manifest_Callback callback,
669 void DidRespondRequestManifest(_Ewk_View_Request_Manifest* manifest,
670 Ewk_View_Request_Manifest_Callback callback,
673 void SetBeforeUnloadConfirmPanelCallback(
674 Ewk_View_Before_Unload_Confirm_Panel_Callback callback,
676 void ReplyBeforeUnloadConfirmPanel(Eina_Bool result);
677 void SyncAcceptLanguages(const std::string& accept_languages);
679 void OnOverscrolled(const gfx::Vector2dF& accumulated_overscroll,
680 const gfx::Vector2dF& latest_overscroll_delta);
682 bool SetVisibility(bool enable);
683 void SetDoNotTrack(Eina_Bool);
685 #if defined(TIZEN_ATK_SUPPORT)
686 void UpdateSpatialNavigationStatus(Eina_Bool enable);
687 void UpdateAccessibilityStatus(Eina_Bool enable);
689 bool CheckLazyInitializeAtk() {
690 return is_initialized_ && lazy_initialize_atk_;
696 content::DateTimeChooserEfl* GetDateTimeChooser() {
697 return date_time_chooser_;
700 bool ShouldIgnoreNavigation(content::NavigationHandle* navigation_handle);
702 #if BUILDFLAG(IS_TIZEN_TV)
703 void DrawLabel(Evas_Object* image, Eina_Rectangle rect);
704 void DeactivateAtk(bool deactivated);
706 #endif // IS_TIZEN_TV
708 void SetDidChangeThemeColorCallback(
709 Ewk_View_Did_Change_Theme_Color_Callback callback,
711 void DidChangeThemeColor(const SkColor& color);
713 void OnSelectionRectReceived(const gfx::Rect& selection_rect) const;
716 static void NativeViewResize(void* data,
720 void InitializeContent();
721 void InitializeWindowTreeHost();
722 void SendDelayedMessages(content::RenderViewHost* render_view_host);
724 void EvasToBlinkCords(int x, int y, int* view_x, int* view_y);
725 Eina_Bool AsyncRequestHitTestDataAtBlinkCords(
728 Ewk_Hit_Test_Mode mode,
729 WebViewAsyncRequestHitTestDataCallback* cb);
730 #if BUILDFLAG(IS_TIZEN) && !defined(EWK_BRINGUP)
731 static void cameraResultCb(service_h request,
733 service_result_e result,
737 #if BUILDFLAG(IS_TIZEN) && !defined(EWK_BRINGUP)
738 bool LaunchCamera(std::u16string mimetype);
740 JavaScriptDialogManagerEfl* GetJavaScriptDialogManagerEfl();
742 // Changes viewport without resizing Evas_Object representing webview
743 // and its corresponding RWHV to let Blink renders custom viewport
744 // while showing picker.
745 void AdjustViewPortHeightToPopupMenu(bool is_popup_menu_visible);
747 void ShowContextMenuInternal(const content::ContextMenuParams&);
749 void UpdateWebkitPreferencesEfl(content::RenderViewHost*);
751 void ChangeScroll(int& x, int& y);
752 void ScrollFocusedNodeIntoView();
754 void GenerateMHTML(Ewk_View_Save_Page_Callback callback,
756 const base::FilePath& file_path);
757 void MHTMLGenerated(Ewk_View_Save_Page_Callback callback,
759 const base::FilePath& file_path,
762 static void OnViewFocusIn(void* data, Evas*, Evas_Object*, void*);
763 static void OnViewFocusOut(void* data, Evas*, Evas_Object*, void*);
764 static void VisibleContentChangedCallback(void* user_data,
768 static void OnCustomScrollBeginCallback(void* user_data,
772 static void OnCustomScrollEndCallback(void* user_data,
775 void UpdateContextMenuWithParams(const content::ContextMenuParams& params);
777 static Eina_Bool DelayedPopulateAndShowContextMenu(void* data);
779 scoped_refptr<WebViewEvasEventHandler> evas_event_handler_;
780 scoped_refptr<Ewk_Context> context_;
781 std::unique_ptr<content::WebContents> web_contents_;
782 std::unique_ptr<content::WebContentsDelegateEfl> web_contents_delegate_;
783 std::string pending_url_request_;
784 std::unique_ptr<Ewk_Settings> settings_;
785 std::unique_ptr<_Ewk_Frame> frame_;
786 std::unique_ptr<_Ewk_Policy_Decision> window_policy_;
787 Evas_Object* evas_object_;
788 Evas_Object* native_view_;
789 bool mouse_events_enabled_;
790 double text_zoom_factor_;
791 mutable std::string user_agent_;
792 mutable std::string user_agent_app_name_;
793 std::unique_ptr<_Ewk_Auth_Challenge> auth_challenge_;
794 std::string selected_text_cached_;
796 std::unique_ptr<content::ContextMenuControllerEfl> context_menu_;
797 #if !defined(EWK_BRINGUP) // FIXME: m71 bringup
798 std::unique_ptr<content::FileChooserControllerEfl> file_chooser_;
800 std::unique_ptr<content::PopupControllerEfl> popup_controller_;
801 std::u16string previous_text_;
802 int current_find_request_id_;
803 static int find_request_id_counter_;
805 typedef WebViewCallback<Ewk_View_Plain_Text_Get_Callback, const char*>
806 EwkViewPlainTextGetCallback;
807 base::IDMap<EwkViewPlainTextGetCallback*> plain_text_get_callback_map_;
809 typedef WebViewCallback<Ewk_View_MHTML_Data_Get_Callback, const char*>
810 MHTMLCallbackDetails;
811 base::IDMap<MHTMLCallbackDetails*> mhtml_callback_map_;
813 typedef WebViewCallback<Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback,
815 MainFrameScrollbarVisibleGetCallback;
816 base::IDMap<MainFrameScrollbarVisibleGetCallback*>
817 main_frame_scrollbar_visible_callback_map_;
819 base::IDMap<BackgroundColorGetCallback*> background_color_get_callback_map_;
821 gfx::Size contents_size_;
823 mutable std::string title_;
824 Hit_Test_Params hit_test_params_;
825 base::WaitableEvent hit_test_completion_;
826 double page_scale_factor_;
830 WebViewCallback<Ewk_View_Geolocation_Permission_Callback,
831 _Ewk_Geolocation_Permission_Request*>
832 geolocation_permission_cb_;
833 WebViewCallback<Ewk_View_User_Media_Permission_Callback,
834 _Ewk_User_Media_Permission_Request*>
835 user_media_permission_cb_;
836 WebViewCallbackWithReturnValue<Ewk_User_Media_Permission_Query_Result,
837 Ewk_View_User_Media_Permission_Query_Callback,
838 _Ewk_User_Media_Permission_Query*>
839 user_media_permission_query_cb_;
840 WebViewErrorPageLoadCallback<Ewk_View_Error_Page_Load_Callback,
844 WebViewCallback<Ewk_View_Unfocus_Allow_Callback, Ewk_Unfocus_Direction>
846 WebViewCallback<Ewk_View_Notification_Permission_Callback,
847 Ewk_Notification_Permission_Request*>
848 notification_permission_callback_;
849 WebViewCallback<Ewk_Quota_Permission_Request_Callback,
850 const _Ewk_Quota_Permission_Request*>
851 quota_request_callback_;
852 WebViewCallback<Ewk_View_Authentication_Callback, _Ewk_Auth_Challenge*>
854 WebViewCallback<Ewk_View_Scale_Changed_Callback, double> scale_changed_cb_;
856 std::unique_ptr<content::InputPicker> input_picker_;
858 DidChangeThemeColorCallback did_change_theme_color_callback_;
860 base::IDMap<WebApplicationIconUrlGetCallback*>
861 web_app_icon_url_get_callback_map_;
862 base::IDMap<WebApplicationIconUrlsGetCallback*>
863 web_app_icon_urls_get_callback_map_;
864 base::IDMap<WebApplicationCapableGetCallback*>
865 web_app_capable_get_callback_map_;
866 std::unique_ptr<PermissionPopupManager> permission_popup_manager_;
867 std::unique_ptr<ScrollDetector> scroll_detector_;
869 // Manages injecting native objects.
870 std::unique_ptr<content::GinNativeBridgeDispatcherHost>
871 gin_native_bridge_dispatcher_host_;
873 WebViewExceededQuotaCallback<
874 Ewk_View_Exceeded_Indexed_Database_Quota_Callback,
875 Ewk_Security_Origin*,
877 exceeded_indexed_db_quota_callback_;
878 std::unique_ptr<Ewk_Security_Origin> exceeded_indexed_db_quota_origin_;
880 #if BUILDFLAG(IS_TIZEN)
881 blink::mojom::FileChooserParams::Mode filechooser_mode_;
883 std::map<const _Ewk_Quota_Permission_Request*,
884 content::QuotaPermissionContext::PermissionCallback>
885 quota_permission_request_map_;
887 #if BUILDFLAG(IS_TIZEN)
888 Ecore_Event_Handler* window_rotate_handler_ = nullptr;
891 bool is_initialized_;
893 std::unique_ptr<_Ewk_Back_Forward_List> back_forward_list_;
895 static content::WebContentsEflDelegate::WebContentsCreateCallback
896 create_new_window_web_contents_cb_;
899 gfx::Vector2d previous_scroll_position_;
901 gfx::Point context_menu_position_;
903 content::ContextMenuParams saved_context_menu_params_;
905 std::vector<IPC::Message*> delayed_messages_;
907 std::map<int64_t, WebViewAsyncRequestHitTestDataCallback*> hit_test_callback_;
909 content::AcceptLanguagesHelper::AcceptLangsChangedCallback
910 accept_langs_changed_callback_;
912 std::unique_ptr<SelectPickerBase> select_picker_;
913 std::unique_ptr<aura::WindowTreeHost> host_;
914 std::unique_ptr<aura::client::FocusClient> focus_client_;
915 std::unique_ptr<aura::client::WindowParentingClient> window_parenting_client_;
916 std::unique_ptr<ui::CompositorObserver> compositor_observer_;
917 content::DateTimeChooserEfl* date_time_chooser_ = nullptr;
919 #if defined(TIZEN_ATK_SUPPORT)
920 std::unique_ptr<EWebAccessibility> eweb_accessibility_;
921 bool lazy_initialize_atk_ = false;
923 #if defined(TIZEN_VIDEO_HOLE)
924 bool pending_video_hole_setting_ = false;
927 Ecore_Timer* delayed_show_context_menu_timer_ = nullptr;
930 const unsigned int g_default_tilt_motion_sensitivity = 3;