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 WebViewExceededQuotaCallback {
155 WebViewExceededQuotaCallback() { Set(nullptr, nullptr); }
157 void Set(CallbackPtr cb, void* data) {
162 bool IsCallbackSet() const { return callback_; }
164 /* LCOV_EXCL_START */
165 void Run(Evas_Object* webview, CallbackParameter... param) {
167 callback_(webview, param..., user_data_);
172 CallbackPtr callback_;
176 class BackgroundColorGetCallback {
178 BackgroundColorGetCallback(Ewk_View_Background_Color_Get_Callback func,
180 : func_(func), user_data_(user_data) {}
182 void Run(Evas_Object* webview, int r, int g, int b, int a) {
184 func_(webview, r, g, b, a, user_data_);
188 Ewk_View_Background_Color_Get_Callback func_;
192 class WebApplicationIconUrlGetCallback {
194 WebApplicationIconUrlGetCallback(Ewk_Web_App_Icon_URL_Get_Callback func,
196 : func_(func), user_data_(user_data) {}
197 void Run(const std::string& url) {
199 (func_)(url.c_str(), user_data_);
204 Ewk_Web_App_Icon_URL_Get_Callback func_;
208 class WebApplicationIconUrlsGetCallback {
210 WebApplicationIconUrlsGetCallback(Ewk_Web_App_Icon_URLs_Get_Callback func,
212 : func_(func), user_data_(user_data) {}
213 void Run(const std::map<std::string, std::string>& urls) {
215 Eina_List* list = NULL;
216 for (std::map<std::string, std::string>::const_iterator it = urls.begin();
217 it != urls.end(); ++it) {
218 _Ewk_Web_App_Icon_Data* data =
219 ewkWebAppIconDataCreate(it->first, it->second);
220 list = eina_list_append(list, data);
222 (func_)(list, user_data_);
227 Ewk_Web_App_Icon_URLs_Get_Callback func_;
231 class WebApplicationCapableGetCallback {
233 WebApplicationCapableGetCallback(Ewk_Web_App_Capable_Get_Callback func,
235 : func_(func), user_data_(user_data) {}
236 void Run(bool capable) {
238 (func_)(capable ? EINA_TRUE : EINA_FALSE, user_data_);
243 Ewk_Web_App_Capable_Get_Callback func_;
247 class DidChangeThemeColorCallback {
249 DidChangeThemeColorCallback() : callback_(nullptr), user_data_(nullptr) {}
250 void Set(Ewk_View_Did_Change_Theme_Color_Callback callback, void* user_data) {
251 callback_ = callback;
252 user_data_ = user_data;
254 void Run(Evas_Object* o, const SkColor& color) {
256 callback_(o, SkColorGetR(color), SkColorGetG(color), SkColorGetB(color),
257 SkColorGetA(color), user_data_);
261 Ewk_View_Did_Change_Theme_Color_Callback callback_;
265 class WebViewAsyncRequestHitTestDataCallback;
266 class JavaScriptDialogManagerEfl;
267 class PermissionPopupManager;
271 static EWebView* FromEvasObject(Evas_Object* eo);
273 EWebView(Ewk_Context*, Evas_Object* smart_object);
276 // initialize data members and activate event handlers.
277 // call this once after created and before use
280 bool CreateNewWindow(
281 content::WebContentsEflDelegate::WebContentsCreateCallback);
282 static Evas_Object* GetHostWindowDelegate(const content::WebContents*);
284 content::WebContentsViewAura* wcva() const;
285 content::RenderWidgetHostViewAura* rwhva() const;
286 Ewk_Context* context() const { return context_.get(); }
287 Evas_Object* evas_object() const { return evas_object_; }
288 Evas_Object* native_view() const { return native_view_; }
289 Evas_Object* GetElmWindow() const;
290 Evas* GetEvas() const { return evas_object_evas_get(evas_object_); }
291 PermissionPopupManager* GetPermissionPopupManager() const {
292 return permission_popup_manager_.get();
295 content::WebContents& web_contents() const { return *web_contents_.get(); }
297 #if defined(TIZEN_ATK_SUPPORT)
298 EWebAccessibility& eweb_accessibility() const {
299 return *eweb_accessibility_.get();
303 template <EWebViewCallbacks::CallbackType callbackType>
304 EWebViewCallbacks::CallBack<callbackType> SmartCallback() const {
305 return EWebViewCallbacks::CallBack<callbackType>(evas_object_);
309 void SetURL(const GURL& url, bool from_api = false);
310 const GURL& GetURL() const;
311 const GURL& GetOriginalURL() const;
313 void ReloadBypassingCache();
314 Eina_Bool CanGoBack();
315 Eina_Bool CanGoForward();
316 Eina_Bool HasFocus() const;
317 void SetFocus(Eina_Bool focus);
319 Eina_Bool GoForward();
323 void SetSessionTimeout(uint64_t timeout);
324 double GetTextZoomFactor() const;
325 void SetTextZoomFactor(double text_zoom_factor);
326 double GetPageZoomFactor() const;
327 void SetPageZoomFactor(double page_zoom_factor);
328 void ExecuteEditCommand(const char* command, const char* value);
329 void SetOrientation(int orientation);
330 int GetOrientation();
331 bool TouchEventsEnabled() const;
332 void SetTouchEventsEnabled(bool enabled);
333 bool MouseEventsEnabled() const;
334 void SetMouseEventsEnabled(bool enabled);
335 void HandleTouchEvents(Ewk_Touch_Event_Type type,
336 const Eina_List* points,
337 const Evas_Modifier* modifiers);
340 bool ExecuteJavaScript(const char* script,
341 Ewk_View_Script_Execute_Callback callback,
343 bool SetUserAgent(const char* userAgent);
344 bool SetUserAgentAppName(const char* application_name);
345 #if BUILDFLAG(IS_TIZEN)
346 bool SetPrivateBrowsing(bool incognito);
347 bool GetPrivateBrowsing() const;
349 const char* GetUserAgent() const;
350 const char* GetUserAgentAppName() const;
351 const char* CacheSelectedText();
352 Ewk_Settings* GetSettings() { return settings_.get(); }
353 _Ewk_Frame* GetMainFrame();
354 void UpdateWebKitPreferences();
355 void LoadHTMLString(const char* html,
356 const char* base_uri,
357 const char* unreachable_uri);
358 void LoadPlainTextString(const char* plain_text);
359 void LoadData(const char* data,
361 const char* mime_type,
362 const char* encoding,
363 const char* base_uri,
364 const char* unreachable_uri = NULL);
366 void InvokeLoadError(const GURL& url, int error_code, bool is_cancellation);
368 void SetViewAuthCallback(Ewk_View_Authentication_Callback callback,
370 void InvokeAuthCallback(LoginDelegateEfl* login_delegate,
372 const std::string& realm);
373 void Find(const char* text, Ewk_Find_Options);
374 void InvokeAuthCallbackOnUI(_Ewk_Auth_Challenge* auth_challenge);
375 void SetContentSecurityPolicy(const char* policy, Ewk_CSP_Header_Type type);
376 void HandlePopupMenu(std::vector<blink::mojom::MenuItemPtr> items,
379 const gfx::Rect& bounds);
380 void HidePopupMenu();
381 void DidSelectPopupMenuItems(std::vector<int>& indices);
382 void DidCancelPopupMenu();
383 void HandleLongPressGesture(const content::ContextMenuParams&);
384 void ShowContextMenu(const content::ContextMenuParams&);
385 void CancelContextMenu(int request_id);
386 void SetScale(double scale_factor);
387 void SetScaleChangedCallback(Ewk_View_Scale_Changed_Callback callback,
390 bool GetScrollPosition(int* x, int* y) const;
391 void SetScroll(int x, int y);
392 void UrlRequestSet(const char* url,
393 content::NavigationController::LoadURLType loadtype,
397 SelectPickerBase* GetSelectPicker() const { return select_picker_.get(); }
398 content::SelectionControllerEfl* GetSelectionController() const;
399 content::PopupControllerEfl* GetPopupController() const {
400 return popup_controller_.get();
402 ScrollDetector* GetScrollDetector() const { return scroll_detector_.get(); }
403 void MoveCaret(const gfx::Point& point);
404 void SelectFocusedLink();
405 bool GetSelectionRange(Eina_Rectangle* left_rect, Eina_Rectangle* right_rect);
406 Eina_Bool ClearSelection();
408 // Callback OnCopyFromBackingStore will be called once we get the snapshot
410 void OnCopyFromBackingStore(bool success, const SkBitmap& bitmap);
415 void UpdateContextMenu(bool is_password_input);
416 void RenderViewReady();
419 * Creates a snapshot of given rectangle from EWebView
421 * @param rect rectangle of EWebView which will be taken into snapshot
422 * @param scale_factor scale factor
423 * @return created snapshot or NULL if error occured.
424 * @note ownership of snapshot is passed to caller
426 Evas_Object* GetSnapshot(Eina_Rectangle rect, float scale_factor);
428 bool GetSnapshotAsync(Eina_Rectangle rect,
429 Ewk_Web_App_Screenshot_Captured_Callback callback,
432 void InvokePolicyResponseCallback(_Ewk_Policy_Decision* policy_decision,
434 void InvokePolicyNavigationCallback(const NavigationPolicyParams& params,
436 void UseSettingsFont();
438 _Ewk_Hit_Test* RequestHitTestDataAt(int x, int y, Ewk_Hit_Test_Mode mode);
439 Eina_Bool AsyncRequestHitTestDataAt(int x,
441 Ewk_Hit_Test_Mode mode,
442 Ewk_View_Hit_Test_Request_Callback,
444 _Ewk_Hit_Test* RequestHitTestDataAtBlinkCoords(int x,
446 Ewk_Hit_Test_Mode mode);
447 Eina_Bool AsyncRequestHitTestDataAtBlinkCords(
450 Ewk_Hit_Test_Mode mode,
451 Ewk_View_Hit_Test_Request_Callback,
453 void DispatchAsyncHitTestData(const Hit_Test_Params& params,
455 void UpdateHitTestData(const Hit_Test_Params& params);
457 int current_find_request_id() const { return current_find_request_id_; }
458 bool PlainTextGet(Ewk_View_Plain_Text_Get_Callback callback, void* user_data);
459 void InvokePlainTextGetCallback(const std::string& content_text,
460 int plain_text_get_callback_id);
461 int SetEwkViewPlainTextGetCallback(Ewk_View_Plain_Text_Get_Callback callback,
463 void SetViewGeolocationPermissionCallback(
464 Ewk_View_Geolocation_Permission_Callback callback,
466 bool InvokeViewGeolocationPermissionCallback(
467 _Ewk_Geolocation_Permission_Request*
468 geolocation_permission_request_context,
470 void SetViewUserMediaPermissionCallback(
471 Ewk_View_User_Media_Permission_Callback callback,
473 bool InvokeViewUserMediaPermissionCallback(
474 _Ewk_User_Media_Permission_Request* user_media_permission_request_context,
476 void SetViewUserMediaPermissionQueryCallback(
477 Ewk_View_User_Media_Permission_Query_Callback callback,
479 Ewk_User_Media_Permission_Query_Result
480 InvokeViewUserMediaPermissionQueryCallback(
481 _Ewk_User_Media_Permission_Query* user_media_permission_query_context);
482 void SetViewUnfocusAllowCallback(Ewk_View_Unfocus_Allow_Callback callback,
484 bool InvokeViewUnfocusAllowCallback(Ewk_Unfocus_Direction direction,
486 void DidChangeContentsSize(int width, int height);
487 const Eina_Rectangle GetContentsSize() const;
488 void GetScrollSize(int* w, int* h);
490 void SetProgressValue(double progress);
491 double GetProgressValue();
492 const char* GetTitle();
493 bool SaveAsPdf(int width, int height, const std::string& file_name);
494 void BackForwardListClear();
495 _Ewk_Back_Forward_List* GetBackForwardList() const;
496 void InvokeBackForwardListChangedCallback();
497 _Ewk_History* GetBackForwardHistory() const;
498 bool WebAppCapableGet(Ewk_Web_App_Capable_Get_Callback callback,
500 bool WebAppIconUrlGet(Ewk_Web_App_Icon_URL_Get_Callback callback,
502 bool WebAppIconUrlsGet(Ewk_Web_App_Icon_URLs_Get_Callback callback,
504 void InvokeWebAppCapableGetCallback(bool capable, int callbackId);
505 void InvokeWebAppIconUrlGetCallback(const std::string& iconUrl,
507 void InvokeWebAppIconUrlsGetCallback(
508 const std::map<std::string, std::string>& iconUrls,
510 void SetNotificationPermissionCallback(
511 Ewk_View_Notification_Permission_Callback callback,
513 bool IsNotificationPermissionCallbackSet() const;
514 bool InvokeNotificationPermissionCallback(
515 Ewk_Notification_Permission_Request* request);
517 bool GetMHTMLData(Ewk_View_MHTML_Data_Get_Callback callback, void* user_data);
518 void OnMHTMLContentGet(const std::string& mhtml_content, int callback_id);
519 bool SavePageAsMHTML(const std::string& path,
520 Ewk_View_Save_Page_Callback callback,
523 void ExitFullscreen();
525 void DidChangePageScaleFactor(double scale_factor);
526 void SetScaledContentsSize();
527 void SetJavaScriptAlertCallback(Ewk_View_JavaScript_Alert_Callback callback,
529 void JavaScriptAlertReply();
530 void SetJavaScriptConfirmCallback(
531 Ewk_View_JavaScript_Confirm_Callback callback,
533 void JavaScriptConfirmReply(bool result);
534 void SetJavaScriptPromptCallback(Ewk_View_JavaScript_Prompt_Callback callback,
536 void JavaScriptPromptReply(const char* result);
537 void set_renderer_crashed();
538 void GetPageScaleRange(double* min_scale, double* max_scale);
539 void SetDrawsTransparentBackground(bool enabled);
540 bool GetBackgroundColor(Ewk_View_Background_Color_Get_Callback callback,
542 void OnGetBackgroundColor(int callback_id, SkColor bg_color);
544 void GetSessionData(const char** data, unsigned* length) const;
545 bool RestoreFromSessionData(const char* data, unsigned length);
546 void ShowFileChooser(content::RenderFrameHost* render_frame_host,
547 const blink::mojom::FileChooserParams&);
548 void SetBrowserFont();
549 bool IsDragging() const;
551 void RequestColorPicker(int r, int g, int b, int a);
552 bool SetColorPickerColor(int r, int g, int b, int a);
553 void InputPickerShow(ui::TextInputType input_type,
555 content::DateTimeChooserEfl* date_time_chooser);
557 void ShowContentsDetectedPopup(const char*);
559 // Returns TCP port number with Inspector, or 0 if error.
560 int StartInspectorServer(int port = 0);
561 bool StopInspectorServer();
563 void LoadNotFoundErrorPage(const std::string& invalidUrl);
564 static std::string GetPlatformLocale();
565 bool GetLinkMagnifierEnabled() const;
566 void SetLinkMagnifierEnabled(bool enabled);
568 bool GetHorizontalPanningHold() const;
569 void SetHorizontalPanningHold(bool hold);
570 bool GetVerticalPanningHold() const;
571 void SetVerticalPanningHold(bool hold);
573 void SetQuotaPermissionRequestCallback(
574 Ewk_Quota_Permission_Request_Callback callback,
576 void InvokeQuotaPermissionRequest(
577 _Ewk_Quota_Permission_Request* request,
578 content::QuotaPermissionContext::PermissionCallback cb);
579 void QuotaRequestReply(const _Ewk_Quota_Permission_Request* request,
581 void QuotaRequestCancel(const _Ewk_Quota_Permission_Request* request);
582 #if !defined(EWK_BRINGUP) // FIXME: m67 bringup
583 void SetViewMode(blink::WebViewMode view_mode);
585 gfx::Point GetContextMenuPosition() const;
587 content::ContextMenuControllerEfl* GetContextMenuController() {
588 return context_menu_.get();
591 bool SetMainFrameScrollbarVisible(bool visible);
592 bool GetMainFrameScrollbarVisible(
593 Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback callback,
595 void InvokeMainFrameScrollbarVisibleCallback(int callback_id, bool visible);
597 void ResetContextMenuController();
598 Eina_Bool AddJavaScriptMessageHandler(Evas_Object* view,
599 Ewk_View_Script_Message_Cb callback,
602 content::GinNativeBridgeDispatcherHost* GetGinNativeBridgeDispatcherHost()
604 return gin_native_bridge_dispatcher_host_.get();
606 bool SetPageVisibility(Ewk_Page_Visibility_State page_visibility_state);
608 void SetExceededIndexedDatabaseQuotaCallback(
609 Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback,
611 void InvokeExceededIndexedDatabaseQuotaCallback(const GURL& origin,
612 int64_t current_quota);
613 void ExceededIndexedDatabaseQuotaReply(bool allow);
615 #if defined(TIZEN_VIDEO_HOLE)
616 void SetVideoHoleSupport(bool enable);
619 /// ---- Event handling
622 bool HandleMove(int x, int y);
623 bool HandleResize(int width, int height);
624 bool HandleTextSelectionDown(int x, int y);
625 bool HandleTextSelectionUp(int x, int y);
627 void HandleRendererProcessCrash();
628 void InvokeWebProcessCrashedCallback();
630 void HandleTapGestureForSelection(bool is_content_editable);
631 void HandleZoomGesture(blink::WebGestureEvent& event);
634 void RequestManifest(Ewk_View_Request_Manifest_Callback callback,
636 void DidRespondRequestManifest(_Ewk_View_Request_Manifest* manifest,
637 Ewk_View_Request_Manifest_Callback callback,
640 void SyncAcceptLanguages(const std::string& accept_languages);
642 void OnOverscrolled(const gfx::Vector2dF& accumulated_overscroll,
643 const gfx::Vector2dF& latest_overscroll_delta);
645 bool SetVisibility(bool enable);
647 #if defined(TIZEN_ATK_SUPPORT)
648 void UpdateSpatialNavigationStatus(Eina_Bool enable);
649 void UpdateAccessibilityStatus(Eina_Bool enable);
651 bool CheckLazyInitializeAtk() {
652 return is_initialized_ && lazy_initialize_atk_;
658 content::DateTimeChooserEfl* GetDateTimeChooser() {
659 return date_time_chooser_;
662 bool ShouldIgnoreNavigation(content::NavigationHandle* navigation_handle);
664 #if BUILDFLAG(IS_TIZEN_TV)
665 void DrawLabel(Evas_Object* image, Eina_Rectangle rect);
667 #endif // IS_TIZEN_TV
669 void SetDidChangeThemeColorCallback(
670 Ewk_View_Did_Change_Theme_Color_Callback callback,
672 void DidChangeThemeColor(const SkColor& color);
674 void OnSelectionRectReceived(const gfx::Rect& selection_rect) const;
677 static void NativeViewResize(void* data,
681 void InitializeContent();
682 void InitializeWindowTreeHost();
683 void SendDelayedMessages(content::RenderViewHost* render_view_host);
685 void EvasToBlinkCords(int x, int y, int* view_x, int* view_y);
686 Eina_Bool AsyncRequestHitTestDataAtBlinkCords(
689 Ewk_Hit_Test_Mode mode,
690 WebViewAsyncRequestHitTestDataCallback* cb);
691 #if BUILDFLAG(IS_TIZEN) && !defined(EWK_BRINGUP)
692 static void cameraResultCb(service_h request,
694 service_result_e result,
698 #if BUILDFLAG(IS_TIZEN) && !defined(EWK_BRINGUP)
699 bool LaunchCamera(std::u16string mimetype);
701 JavaScriptDialogManagerEfl* GetJavaScriptDialogManagerEfl();
703 // Changes viewport without resizing Evas_Object representing webview
704 // and its corresponding RWHV to let Blink renders custom viewport
705 // while showing picker.
706 void AdjustViewPortHeightToPopupMenu(bool is_popup_menu_visible);
708 void ShowContextMenuInternal(const content::ContextMenuParams&);
710 void UpdateWebkitPreferencesEfl(content::RenderViewHost*);
712 void ChangeScroll(int& x, int& y);
713 void ScrollFocusedNodeIntoView();
715 void GenerateMHTML(Ewk_View_Save_Page_Callback callback,
717 const base::FilePath& file_path);
718 void MHTMLGenerated(Ewk_View_Save_Page_Callback callback,
720 const base::FilePath& file_path,
723 static void OnViewFocusIn(void* data, Evas*, Evas_Object*, void*);
724 static void OnViewFocusOut(void* data, Evas*, Evas_Object*, void*);
725 static void VisibleContentChangedCallback(void* user_data,
729 static void OnCustomScrollBeginCallback(void* user_data,
733 static void OnCustomScrollEndCallback(void* user_data,
736 void UpdateContextMenuWithParams(const content::ContextMenuParams& params);
738 scoped_refptr<WebViewEvasEventHandler> evas_event_handler_;
739 scoped_refptr<Ewk_Context> context_;
740 std::unique_ptr<content::WebContents> web_contents_;
741 std::unique_ptr<content::WebContentsDelegateEfl> web_contents_delegate_;
742 std::string pending_url_request_;
743 std::unique_ptr<Ewk_Settings> settings_;
744 std::unique_ptr<_Ewk_Frame> frame_;
745 std::unique_ptr<_Ewk_Policy_Decision> window_policy_;
746 Evas_Object* evas_object_;
747 Evas_Object* native_view_;
748 bool mouse_events_enabled_;
749 double text_zoom_factor_;
750 mutable std::string user_agent_;
751 mutable std::string user_agent_app_name_;
752 std::unique_ptr<_Ewk_Auth_Challenge> auth_challenge_;
753 std::string selected_text_cached_;
755 std::unique_ptr<content::ContextMenuControllerEfl> context_menu_;
756 #if !defined(EWK_BRINGUP) // FIXME: m71 bringup
757 std::unique_ptr<content::FileChooserControllerEfl> file_chooser_;
759 std::unique_ptr<content::PopupControllerEfl> popup_controller_;
760 std::u16string previous_text_;
761 int current_find_request_id_;
762 static int find_request_id_counter_;
764 typedef WebViewCallback<Ewk_View_Plain_Text_Get_Callback, const char*>
765 EwkViewPlainTextGetCallback;
766 base::IDMap<EwkViewPlainTextGetCallback*> plain_text_get_callback_map_;
768 typedef WebViewCallback<Ewk_View_MHTML_Data_Get_Callback, const char*>
769 MHTMLCallbackDetails;
770 base::IDMap<MHTMLCallbackDetails*> mhtml_callback_map_;
772 typedef WebViewCallback<Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback,
774 MainFrameScrollbarVisibleGetCallback;
775 base::IDMap<MainFrameScrollbarVisibleGetCallback*>
776 main_frame_scrollbar_visible_callback_map_;
778 base::IDMap<BackgroundColorGetCallback*> background_color_get_callback_map_;
780 gfx::Size contents_size_;
782 mutable std::string title_;
783 Hit_Test_Params hit_test_params_;
784 base::WaitableEvent hit_test_completion_;
785 double page_scale_factor_;
789 WebViewCallback<Ewk_View_Geolocation_Permission_Callback,
790 _Ewk_Geolocation_Permission_Request*>
791 geolocation_permission_cb_;
792 WebViewCallback<Ewk_View_User_Media_Permission_Callback,
793 _Ewk_User_Media_Permission_Request*>
794 user_media_permission_cb_;
795 WebViewCallbackWithReturnValue<Ewk_User_Media_Permission_Query_Result,
796 Ewk_View_User_Media_Permission_Query_Callback,
797 _Ewk_User_Media_Permission_Query*>
798 user_media_permission_query_cb_;
799 WebViewCallback<Ewk_View_Unfocus_Allow_Callback, Ewk_Unfocus_Direction>
801 WebViewCallback<Ewk_View_Notification_Permission_Callback,
802 Ewk_Notification_Permission_Request*>
803 notification_permission_callback_;
804 WebViewCallback<Ewk_Quota_Permission_Request_Callback,
805 const _Ewk_Quota_Permission_Request*>
806 quota_request_callback_;
807 WebViewCallback<Ewk_View_Authentication_Callback, _Ewk_Auth_Challenge*>
809 WebViewCallback<Ewk_View_Scale_Changed_Callback, double> scale_changed_cb_;
811 std::unique_ptr<content::InputPicker> input_picker_;
813 DidChangeThemeColorCallback did_change_theme_color_callback_;
815 base::IDMap<WebApplicationIconUrlGetCallback*>
816 web_app_icon_url_get_callback_map_;
817 base::IDMap<WebApplicationIconUrlsGetCallback*>
818 web_app_icon_urls_get_callback_map_;
819 base::IDMap<WebApplicationCapableGetCallback*>
820 web_app_capable_get_callback_map_;
821 std::unique_ptr<PermissionPopupManager> permission_popup_manager_;
822 std::unique_ptr<ScrollDetector> scroll_detector_;
824 // Manages injecting native objects.
825 std::unique_ptr<content::GinNativeBridgeDispatcherHost>
826 gin_native_bridge_dispatcher_host_;
828 WebViewExceededQuotaCallback<
829 Ewk_View_Exceeded_Indexed_Database_Quota_Callback,
830 Ewk_Security_Origin*,
832 exceeded_indexed_db_quota_callback_;
833 std::unique_ptr<Ewk_Security_Origin> exceeded_indexed_db_quota_origin_;
835 #if BUILDFLAG(IS_TIZEN)
836 blink::mojom::FileChooserParams::Mode filechooser_mode_;
838 std::map<const _Ewk_Quota_Permission_Request*,
839 content::QuotaPermissionContext::PermissionCallback>
840 quota_permission_request_map_;
842 bool is_initialized_;
844 std::unique_ptr<_Ewk_Back_Forward_List> back_forward_list_;
846 static content::WebContentsEflDelegate::WebContentsCreateCallback
847 create_new_window_web_contents_cb_;
850 gfx::Vector2d previous_scroll_position_;
852 gfx::Point context_menu_position_;
854 content::ContextMenuParams saved_context_menu_params_;
856 std::vector<IPC::Message*> delayed_messages_;
858 std::map<int64_t, WebViewAsyncRequestHitTestDataCallback*> hit_test_callback_;
860 content::AcceptLanguagesHelper::AcceptLangsChangedCallback
861 accept_langs_changed_callback_;
863 std::unique_ptr<SelectPickerBase> select_picker_;
864 std::unique_ptr<aura::WindowTreeHost> host_;
865 std::unique_ptr<aura::client::FocusClient> focus_client_;
866 std::unique_ptr<aura::client::WindowParentingClient> window_parenting_client_;
867 std::unique_ptr<ui::CompositorObserver> compositor_observer_;
868 content::DateTimeChooserEfl* date_time_chooser_ = nullptr;
870 #if defined(TIZEN_ATK_SUPPORT)
871 std::unique_ptr<EWebAccessibility> eweb_accessibility_;
872 bool lazy_initialize_atk_ = false;
874 #if defined(TIZEN_VIDEO_HOLE)
875 bool pending_video_hole_setting_ = false;
879 const unsigned int g_default_tilt_motion_sensitivity = 3;