[M108 Migration][API] Re-implement ewk_view_visibility_set
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / eweb_view.h
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.
4
5 #ifndef EWEB_VIEW_H
6 #define EWEB_VIEW_H
7
8 #if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
9 // FIXME: appfw/app_service.h is no more in Tizen 2.3, figure out what to
10 // include instead.
11 #include <appcore-agent/service_app.h>
12 #endif
13
14 #include <map>
15 #include <string>
16 #include <Evas.h>
17 #include <locale.h>
18 #include <vector>
19
20 #include "base/callback.h"
21 #include "base/containers/id_map.h"
22 #include "base/synchronization/waitable_event.h"
23 #include "browser/input_picker/input_picker.h"
24 #include "browser/selectpicker/popup_picker.h"
25 #include "content/browser/date_time_chooser_efl.h"
26 #include "content/browser/renderer_host/event_with_latency_info.h"
27 #include "content/browser/selection/selection_controller_efl.h"
28 #include "content/public/browser/context_menu_params.h"
29 #include "content/public/browser/navigation_controller.h"
30 #include "content/public/browser/quota_permission_context.h"
31 #include "content/public/browser/web_contents_delegate.h"
32 #include "content/public/browser/web_contents_efl_delegate.h"
33 #include "content/public/common/input_event_ack_state.h"
34 #include "content_browser_client_efl.h"
35 #include "context_menu_controller_efl.h"
36 #include "eweb_context.h"
37 #include "eweb_view_callbacks.h"
38 #include "file_chooser_controller_efl.h"
39 #include "permission_popup_manager.h"
40 #include "popup_controller_efl.h"
41 #include "private/ewk_auth_challenge_private.h"
42 #include "private/ewk_back_forward_list_private.h"
43 #include "private/ewk_history_private.h"
44 #include "private/ewk_hit_test_private.h"
45 #include "private/ewk_settings_private.h"
46 #include "private/ewk_web_application_icon_data_private.h"
47 #include "public/ewk_hit_test_internal.h"
48 #include "public/ewk_touch_internal.h"
49 #include "public/ewk_view_product.h"
50 #include "scroll_detector.h"
51 #include "third_party/blink/public/common/context_menu_data/menu_item_info.h"
52 #include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h"
53 #include "ui/aura/window_tree_host.h"
54 #include "ui/gfx/geometry/point.h"
55 #include "ui/gfx/geometry/size.h"
56 #include "web_contents_delegate_efl.h"
57
58 namespace aura {
59 namespace client {
60 class FocusClient;
61 class WindowParentingClient;
62 }  // namespace client
63 }  // namespace aura
64
65 namespace content {
66 class RenderFrameHost;
67 class RenderViewHost;
68 class RenderWidgetHostViewAura;
69 class WebContentsDelegateEfl;
70 class WebContentsViewAura;
71 class ContextMenuControllerEfl;
72 class PopupControllerEfl;
73 class InputPicker;
74 class GinNativeBridgeDispatcherHost;
75 }
76
77 class ErrorParams;
78 class _Ewk_Policy_Decision;
79 class _Ewk_Hit_Test;
80 class Ewk_Context;
81 class WebViewEvasEventHandler;
82 class _Ewk_Quota_Permission_Request;
83
84 template <typename CallbackPtr, typename CallbackParameter>
85 class WebViewCallback {
86  public:
87   WebViewCallback() { Set(nullptr, nullptr); }
88
89   void Set(CallbackPtr cb, void* data) {
90     callback_ = cb;
91     user_data_ = data;
92   }
93
94   bool IsCallbackSet() const { return callback_; }
95
96   Eina_Bool Run(Evas_Object* webview,
97                 CallbackParameter param,
98                 Eina_Bool* callback_result) {
99     CHECK(callback_result);
100     if (IsCallbackSet()) {
101       *callback_result = callback_(webview, param, user_data_);
102       return true;
103     }
104     return false;
105   }
106
107   void Run(Evas_Object* webview, CallbackParameter param) {
108     if (IsCallbackSet())
109       callback_(webview, param, user_data_);
110   }
111
112  private:
113   CallbackPtr callback_;
114   void* user_data_;
115 };
116
117 template <typename CallbackPtr, typename... CallbackParameter>
118 class WebViewExceededQuotaCallback {
119  public:
120   WebViewExceededQuotaCallback() { Set(nullptr, nullptr); }
121
122   void Set(CallbackPtr cb, void* data) {
123     callback_ = cb;
124     user_data_ = data;
125   }
126
127   bool IsCallbackSet() const { return callback_; }
128
129   /* LCOV_EXCL_START */
130   void Run(Evas_Object* webview, CallbackParameter... param) {
131     if (IsCallbackSet())
132       callback_(webview, param..., user_data_);
133   }
134   /* LCOV_EXCL_STOP */
135
136  private:
137   CallbackPtr callback_;
138   void* user_data_;
139 };
140
141 class WebApplicationIconUrlGetCallback {
142  public:
143   WebApplicationIconUrlGetCallback(Ewk_Web_App_Icon_URL_Get_Callback func,
144                                    void* user_data)
145       : func_(func), user_data_(user_data) {}
146   void Run(const std::string& url) {
147     if (func_) {
148       (func_)(url.c_str(), user_data_);
149     }
150   }
151
152  private:
153   Ewk_Web_App_Icon_URL_Get_Callback func_;
154   void* user_data_;
155 };
156
157 class WebApplicationIconUrlsGetCallback {
158  public:
159   WebApplicationIconUrlsGetCallback(Ewk_Web_App_Icon_URLs_Get_Callback func,
160                                     void* user_data)
161       : func_(func), user_data_(user_data) {}
162   void Run(const std::map<std::string, std::string>& urls) {
163     if (func_) {
164       Eina_List* list = NULL;
165       for (std::map<std::string, std::string>::const_iterator it = urls.begin();
166            it != urls.end(); ++it) {
167         _Ewk_Web_App_Icon_Data* data =
168             ewkWebAppIconDataCreate(it->first, it->second);
169         list = eina_list_append(list, data);
170       }
171       (func_)(list, user_data_);
172     }
173   }
174
175  private:
176   Ewk_Web_App_Icon_URLs_Get_Callback func_;
177   void* user_data_;
178 };
179
180 class WebApplicationCapableGetCallback {
181  public:
182   WebApplicationCapableGetCallback(Ewk_Web_App_Capable_Get_Callback func,
183                                    void* user_data)
184       : func_(func), user_data_(user_data) {}
185   void Run(bool capable) {
186     if (func_) {
187       (func_)(capable ? EINA_TRUE : EINA_FALSE, user_data_);
188     }
189   }
190
191  private:
192   Ewk_Web_App_Capable_Get_Callback func_;
193   void* user_data_;
194 };
195
196 class WebViewAsyncRequestHitTestDataCallback;
197 class JavaScriptDialogManagerEfl;
198 class PermissionPopupManager;
199
200 class EWebView {
201  public:
202   static EWebView* FromEvasObject(Evas_Object* eo);
203
204   EWebView(Ewk_Context*, Evas_Object* smart_object);
205   ~EWebView();
206
207   // initialize data members and activate event handlers.
208   // call this once after created and before use
209   void Initialize();
210
211   bool CreateNewWindow(
212       content::WebContentsEflDelegate::WebContentsCreateCallback);
213   static Evas_Object* GetHostWindowDelegate(const content::WebContents*);
214
215   content::WebContentsViewAura* wcva() const;
216   content::RenderWidgetHostViewAura* rwhva() const;
217   Ewk_Context* context() const { return context_.get(); }
218   Evas_Object* evas_object() const { return evas_object_; }
219   Evas_Object* native_view() const { return native_view_; }
220   Evas_Object* GetElmWindow() const;
221   Evas* GetEvas() const { return evas_object_evas_get(evas_object_); }
222   PermissionPopupManager* GetPermissionPopupManager() const {
223     return permission_popup_manager_.get();
224   }
225
226   content::WebContents& web_contents() const { return *web_contents_.get(); }
227
228   template <EWebViewCallbacks::CallbackType callbackType>
229   EWebViewCallbacks::CallBack<callbackType> SmartCallback() const {
230     return EWebViewCallbacks::CallBack<callbackType>(evas_object_);
231   }
232
233   void set_magnifier(bool status);
234
235   // ewk_view api
236   void SetURL(const GURL& url);
237   const GURL& GetURL() const;
238   const GURL& GetOriginalURL() const;
239   void Reload();
240   void ReloadBypassingCache();
241   Eina_Bool CanGoBack();
242   Eina_Bool CanGoForward();
243   Eina_Bool HasFocus() const;
244   void SetFocus(Eina_Bool focus);
245   Eina_Bool GoBack();
246   Eina_Bool GoForward();
247   void Suspend();
248   void Resume();
249   void Stop();
250   double GetTextZoomFactor() const;
251   void SetTextZoomFactor(double text_zoom_factor);
252   double GetPageZoomFactor() const;
253   void SetPageZoomFactor(double page_zoom_factor);
254   void ExecuteEditCommand(const char* command, const char* value);
255   void SetOrientation(int orientation);
256   int GetOrientation();
257   bool TouchEventsEnabled() const;
258   void SetTouchEventsEnabled(bool enabled);
259   bool MouseEventsEnabled() const;
260   void SetMouseEventsEnabled(bool enabled);
261   void HandleTouchEvents(Ewk_Touch_Event_Type type,
262                          const Eina_List* points,
263                          const Evas_Modifier* modifiers);
264   void Show();
265   void Hide();
266   bool ExecuteJavaScript(const char* script,
267                          Ewk_View_Script_Execute_Callback callback,
268                          void* userdata);
269   bool SetUserAgent(const char* userAgent);
270   bool SetUserAgentAppName(const char* application_name);
271   bool SetPrivateBrowsing(bool incognito);
272   bool GetPrivateBrowsing() const;
273   const char* GetUserAgent() const;
274   const char* GetUserAgentAppName() const;
275   const char* CacheSelectedText();
276   Ewk_Settings* GetSettings() { return settings_.get(); }
277   _Ewk_Frame* GetMainFrame();
278   void UpdateWebKitPreferences();
279   void LoadHTMLString(const char* html,
280                       const char* base_uri,
281                       const char* unreachable_uri);
282   void LoadPlainTextString(const char* plain_text);
283   void LoadData(const char* data,
284                 size_t size,
285                 const char* mime_type,
286                 const char* encoding,
287                 const char* base_uri,
288                 const char* unreachable_uri = NULL);
289
290   void InvokeLoadError(const GURL& url, int error_code, bool is_cancellation);
291
292   void SetViewAuthCallback(Ewk_View_Authentication_Callback callback,
293                            void* user_data);
294   void InvokeAuthCallback(LoginDelegateEfl* login_delegate,
295                           const GURL& url,
296                           const std::string& realm);
297   void Find(const char* text, Ewk_Find_Options);
298   void InvokeAuthCallbackOnUI(_Ewk_Auth_Challenge* auth_challenge);
299   void SetContentSecurityPolicy(const char* policy, Ewk_CSP_Header_Type type);
300   void ShowPopupMenu(const std::vector<blink::MenuItemInfo>& items,
301                      int selectedIndex,
302                      bool multiple);
303   Eina_Bool HidePopupMenu();
304   void UpdateFormNavigation(int formElementCount,
305                             int currentNodeIndex,
306                             bool prevState,
307                             bool nextState);
308   void FormNavigate(bool direction);
309   bool IsSelectPickerShown() const;
310   void CloseSelectPicker();
311   bool FormIsNavigating() const { return formIsNavigating_; }
312   void SetFormIsNavigating(bool formIsNavigating);
313   Eina_Bool PopupMenuUpdate(Eina_List* items, int selectedIndex);
314   Eina_Bool DidSelectPopupMenuItem(int selectedIndex);
315   Eina_Bool DidMultipleSelectPopupMenuItem(std::vector<int>& selectedIndices);
316   Eina_Bool PopupMenuClose();
317   void HandleLongPressGesture(const content::ContextMenuParams&);
318   void ShowContextMenu(const content::ContextMenuParams&);
319   void CancelContextMenu(int request_id);
320   void SetScale(double scale_factor);
321   bool GetScrollPosition(int* x, int* y) const;
322   void SetScroll(int x, int y);
323   void UrlRequestSet(const char* url,
324                      content::NavigationController::LoadURLType loadtype,
325                      Eina_Hash* headers,
326                      const char* body);
327
328   content::SelectionControllerEfl* GetSelectionController() const;
329   content::PopupControllerEfl* GetPopupController() const {
330     return popup_controller_.get();
331   }
332   ScrollDetector* GetScrollDetector() const { return scroll_detector_.get(); }
333   void MoveCaret(const gfx::Point& point);
334   void QuerySelectionStyle();
335   void OnQuerySelectionStyleReply(const SelectionStylePrams& params);
336   void SelectLinkText(const gfx::Point& touch_point);
337   bool GetSelectionRange(Eina_Rectangle* left_rect, Eina_Rectangle* right_rect);
338   Eina_Bool ClearSelection();
339
340   // Callback OnCopyFromBackingStore will be called once we get the snapshot
341   // from render
342   void OnCopyFromBackingStore(bool success, const SkBitmap& bitmap);
343
344   void RenderViewCreated(content::RenderViewHost* render_view_host);
345
346   /**
347    * Creates a snapshot of given rectangle from EWebView
348    *
349    * @param rect rectangle of EWebView which will be taken into snapshot
350    * @param scale_factor scale factor
351    * @return created snapshot or NULL if error occured.
352    * @note ownership of snapshot is passed to caller
353    */
354   Evas_Object* GetSnapshot(Eina_Rectangle rect, float scale_factor);
355
356   bool GetSnapshotAsync(Eina_Rectangle rect,
357                         Ewk_Web_App_Screenshot_Captured_Callback callback,
358                         void* user_data,
359                         float scale_factor);
360   void InvokePolicyResponseCallback(_Ewk_Policy_Decision* policy_decision,
361                                     bool* defer);
362   void InvokePolicyNavigationCallback(const NavigationPolicyParams& params,
363                                       bool* handled);
364   void UseSettingsFont();
365
366   _Ewk_Hit_Test* RequestHitTestDataAt(int x, int y, Ewk_Hit_Test_Mode mode);
367   Eina_Bool AsyncRequestHitTestDataAt(int x,
368                                       int y,
369                                       Ewk_Hit_Test_Mode mode,
370                                       Ewk_View_Hit_Test_Request_Callback,
371                                       void* user_data);
372   _Ewk_Hit_Test* RequestHitTestDataAtBlinkCoords(int x,
373                                                  int y,
374                                                  Ewk_Hit_Test_Mode mode);
375   Eina_Bool AsyncRequestHitTestDataAtBlinkCords(
376       int x,
377       int y,
378       Ewk_Hit_Test_Mode mode,
379       Ewk_View_Hit_Test_Request_Callback,
380       void* user_data);
381   void DispatchAsyncHitTestData(const Hit_Test_Params& params,
382                                 int64_t request_id);
383   void UpdateHitTestData(const Hit_Test_Params& params);
384
385   int current_find_request_id() const { return current_find_request_id_; }
386   bool PlainTextGet(Ewk_View_Plain_Text_Get_Callback callback, void* user_data);
387   void InvokePlainTextGetCallback(const std::string& content_text,
388                                   int plain_text_get_callback_id);
389   int SetEwkViewPlainTextGetCallback(Ewk_View_Plain_Text_Get_Callback callback,
390                                      void* user_data);
391   void SetViewGeolocationPermissionCallback(
392       Ewk_View_Geolocation_Permission_Callback callback,
393       void* user_data);
394   bool InvokeViewGeolocationPermissionCallback(
395       _Ewk_Geolocation_Permission_Request*
396           geolocation_permission_request_context,
397       Eina_Bool* result);
398   void SetViewUserMediaPermissionCallback(
399       Ewk_View_User_Media_Permission_Callback callback,
400       void* user_data);
401   bool InvokeViewUserMediaPermissionCallback(
402       _Ewk_User_Media_Permission_Request* user_media_permission_request_context,
403       Eina_Bool* result);
404   void SetViewUnfocusAllowCallback(Ewk_View_Unfocus_Allow_Callback callback,
405                                    void* user_data);
406   bool InvokeViewUnfocusAllowCallback(Ewk_Unfocus_Direction direction,
407                                       Eina_Bool* result);
408   void DidChangeContentsSize(int width, int height);
409   const Eina_Rectangle GetContentsSize() const;
410   void GetScrollSize(int* w, int* h);
411   void StopFinding();
412   void SetProgressValue(double progress);
413   double GetProgressValue();
414   const char* GetTitle();
415   bool SaveAsPdf(int width, int height, const std::string& file_name);
416   void BackForwardListClear();
417   _Ewk_Back_Forward_List* GetBackForwardList() const;
418   void InvokeBackForwardListChangedCallback();
419   _Ewk_History* GetBackForwardHistory() const;
420   bool WebAppCapableGet(Ewk_Web_App_Capable_Get_Callback callback,
421                         void* userData);
422   bool WebAppIconUrlGet(Ewk_Web_App_Icon_URL_Get_Callback callback,
423                         void* userData);
424   bool WebAppIconUrlsGet(Ewk_Web_App_Icon_URLs_Get_Callback callback,
425                          void* userData);
426   void InvokeWebAppCapableGetCallback(bool capable, int callbackId);
427   void InvokeWebAppIconUrlGetCallback(const std::string& iconUrl,
428                                       int callbackId);
429   void InvokeWebAppIconUrlsGetCallback(
430       const std::map<std::string, std::string>& iconUrls,
431       int callbackId);
432   void SetNotificationPermissionCallback(
433       Ewk_View_Notification_Permission_Callback callback,
434       void* user_data);
435   bool IsNotificationPermissionCallbackSet() const;
436   bool InvokeNotificationPermissionCallback(
437       Ewk_Notification_Permission_Request* request);
438
439   bool GetMHTMLData(Ewk_View_MHTML_Data_Get_Callback callback, void* user_data);
440   void OnMHTMLContentGet(const std::string& mhtml_content, int callback_id);
441   bool IsFullscreen();
442   void ExitFullscreen();
443   double GetScale();
444   void DidChangePageScaleFactor(double scale_factor);
445   void SetScaledContentsSize();
446   void SetJavaScriptAlertCallback(Ewk_View_JavaScript_Alert_Callback callback,
447                                   void* user_data);
448   void JavaScriptAlertReply();
449   void SetJavaScriptConfirmCallback(
450       Ewk_View_JavaScript_Confirm_Callback callback,
451       void* user_data);
452   void JavaScriptConfirmReply(bool result);
453   void SetJavaScriptPromptCallback(Ewk_View_JavaScript_Prompt_Callback callback,
454                                    void* user_data);
455   void JavaScriptPromptReply(const char* result);
456   void set_renderer_crashed();
457   void GetPageScaleRange(double* min_scale, double* max_scale);
458   void SetDrawsTransparentBackground(bool enabled);
459   void GetSessionData(const char** data, unsigned* length) const;
460   bool RestoreFromSessionData(const char* data, unsigned length);
461   void ShowFileChooser(content::RenderFrameHost* render_frame_host,
462                        const blink::mojom::FileChooserParams&);
463   void SetBrowserFont();
464   bool IsDragging() const;
465
466   void RequestColorPicker(int r, int g, int b, int a);
467   bool SetColorPickerColor(int r, int g, int b, int a);
468   void InputPickerShow(ui::TextInputType input_type,
469                        double input_value,
470                        content::DateTimeChooserEfl* date_time_chooser);
471
472   void ShowContentsDetectedPopup(const char*);
473
474   // Returns TCP port number with Inspector, or 0 if error.
475   int StartInspectorServer(int port = 0);
476   bool StopInspectorServer();
477
478   void LoadNotFoundErrorPage(const std::string& invalidUrl);
479   static std::string GetPlatformLocale();
480   bool GetLinkMagnifierEnabled() const;
481   void SetLinkMagnifierEnabled(bool enabled);
482
483   void SetOverrideEncoding(const std::string& encoding);
484   void SetQuotaPermissionRequestCallback(
485       Ewk_Quota_Permission_Request_Callback callback,
486       void* user_data);
487   void InvokeQuotaPermissionRequest(
488       _Ewk_Quota_Permission_Request* request,
489       content::QuotaPermissionContext::PermissionCallback cb);
490   void QuotaRequestReply(const _Ewk_Quota_Permission_Request* request,
491                          bool allow);
492   void QuotaRequestCancel(const _Ewk_Quota_Permission_Request* request);
493 #if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
494   void SetViewMode(blink::WebViewMode view_mode);
495 #endif
496   gfx::Point GetContextMenuPosition() const;
497
498   content::ContextMenuControllerEfl* GetContextMenuController() {
499     return context_menu_.get();
500   }
501   void ResetContextMenuController();
502   Eina_Bool AddJavaScriptMessageHandler(Evas_Object* view,
503                                         Ewk_View_Script_Message_Cb callback,
504                                         std::string name);
505
506   content::GinNativeBridgeDispatcherHost* GetGinNativeBridgeDispatcherHost()
507       const {
508     return gin_native_bridge_dispatcher_host_.get();
509   }
510   bool SetPageVisibility(Ewk_Page_Visibility_State page_visibility_state);
511
512   void SetExceededIndexedDatabaseQuotaCallback(
513       Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback,
514       void* user_data);
515   void InvokeExceededIndexedDatabaseQuotaCallback(const GURL& origin,
516                                                   int64_t current_quota);
517   void ExceededIndexedDatabaseQuotaReply(bool allow);
518
519   /// ---- Event handling
520   bool HandleShow();
521   bool HandleHide();
522   bool HandleMove(int x, int y);
523   bool HandleResize(int width, int height);
524   bool HandleTextSelectionDown(int x, int y);
525   bool HandleTextSelectionUp(int x, int y);
526
527   void HandleRendererProcessCrash();
528   void InvokeWebProcessCrashedCallback();
529
530   void HandleTapGestureForSelection(bool is_content_editable);
531   void HandleZoomGesture(blink::WebGestureEvent& event);
532   void ClosePage();
533
534   void RequestManifest(Ewk_View_Request_Manifest_Callback callback,
535                        void* user_data);
536   void DidRespondRequestManifest(_Ewk_View_Request_Manifest* manifest,
537                                  Ewk_View_Request_Manifest_Callback callback,
538                                  void* user_data);
539
540   void SyncAcceptLanguages(const std::string& accept_languages);
541
542   void OnOverscrolled(const gfx::Vector2dF& accumulated_overscroll,
543                       const gfx::Vector2dF& latest_overscroll_delta);
544
545   bool SetVisibility(bool enable);
546
547   content::DateTimeChooserEfl* GetDateTimeChooser() {
548     return date_time_chooser_;
549   }
550
551  private:
552   void InitializeContent();
553   void InitializeWindowTreeHost();
554   void SendDelayedMessages(content::RenderViewHost* render_view_host);
555
556   void EvasToBlinkCords(int x, int y, int* view_x, int* view_y);
557   Eina_Bool AsyncRequestHitTestDataAtBlinkCords(
558       int x,
559       int y,
560       Ewk_Hit_Test_Mode mode,
561       WebViewAsyncRequestHitTestDataCallback* cb);
562 #if BUILDFLAG(IS_TIZEN) && !defined(EWK_BRINGUP)
563   static void cameraResultCb(service_h request,
564                              service_h reply,
565                              service_result_e result,
566                              void* data);
567 #endif
568
569 #if BUILDFLAG(IS_TIZEN) && !defined(EWK_BRINGUP)
570   bool LaunchCamera(std::u16string mimetype);
571 #endif
572 #if !defined(USE_AURA)
573   content::RenderWidgetHostViewEfl* rwhv() const;
574 #endif
575   JavaScriptDialogManagerEfl* GetJavaScriptDialogManagerEfl();
576
577   void ReleasePopupMenuList();
578
579   void ShowContextMenuInternal(const content::ContextMenuParams&);
580
581   void UpdateWebkitPreferencesEfl(content::RenderViewHost*);
582
583   void ChangeScroll(int& x, int& y);
584
585   scoped_refptr<WebViewEvasEventHandler> evas_event_handler_;
586   scoped_refptr<Ewk_Context> context_;
587   scoped_refptr<Ewk_Context> old_context_;
588   std::unique_ptr<content::WebContents> web_contents_;
589   std::unique_ptr<content::WebContentsDelegateEfl> web_contents_delegate_;
590   std::string pending_url_request_;
591   std::unique_ptr<Ewk_Settings> settings_;
592   std::unique_ptr<_Ewk_Frame> frame_;
593   std::unique_ptr<_Ewk_Policy_Decision> window_policy_;
594   Evas_Object* evas_object_;
595   Evas_Object* native_view_;
596   bool touch_events_enabled_;
597   bool mouse_events_enabled_;
598   double text_zoom_factor_;
599   mutable std::string user_agent_;
600   mutable std::string user_agent_app_name_;
601   std::unique_ptr<_Ewk_Auth_Challenge> auth_challenge_;
602   std::string selected_text_cached_;
603
604   Eina_List* popupMenuItems_;
605   Popup_Picker* popupPicker_;
606   bool formIsNavigating_;
607   typedef struct {
608     int count;
609     int position;
610     bool prevState;
611     bool nextState;
612   } formNavigation;
613   formNavigation formNavigation_;
614   std::unique_ptr<content::ContextMenuControllerEfl> context_menu_;
615 #if !defined(EWK_BRINGUP)  // FIXME: m71 bringup
616   std::unique_ptr<content::FileChooserControllerEfl> file_chooser_;
617 #endif
618   std::unique_ptr<content::PopupControllerEfl> popup_controller_;
619   std::u16string previous_text_;
620   int current_find_request_id_;
621   static int find_request_id_counter_;
622
623   typedef WebViewCallback<Ewk_View_Plain_Text_Get_Callback, const char*>
624       EwkViewPlainTextGetCallback;
625   base::IDMap<EwkViewPlainTextGetCallback*> plain_text_get_callback_map_;
626
627   typedef WebViewCallback<Ewk_View_MHTML_Data_Get_Callback, const char*>
628       MHTMLCallbackDetails;
629   base::IDMap<MHTMLCallbackDetails*> mhtml_callback_map_;
630
631   gfx::Size contents_size_;
632   double progress_;
633   mutable std::string title_;
634   Hit_Test_Params hit_test_params_;
635   base::WaitableEvent hit_test_completion_;
636   double page_scale_factor_;
637   double x_delta_;
638   double y_delta_;
639
640   WebViewCallback<Ewk_View_Geolocation_Permission_Callback,
641                   _Ewk_Geolocation_Permission_Request*>
642       geolocation_permission_cb_;
643   WebViewCallback<Ewk_View_User_Media_Permission_Callback,
644                   _Ewk_User_Media_Permission_Request*>
645       user_media_permission_cb_;
646   WebViewCallback<Ewk_View_Unfocus_Allow_Callback, Ewk_Unfocus_Direction>
647       unfocus_allow_cb_;
648   WebViewCallback<Ewk_View_Notification_Permission_Callback,
649                   Ewk_Notification_Permission_Request*>
650       notification_permission_callback_;
651   WebViewCallback<Ewk_Quota_Permission_Request_Callback,
652                   const _Ewk_Quota_Permission_Request*>
653       quota_request_callback_;
654   WebViewCallback<Ewk_View_Authentication_Callback, _Ewk_Auth_Challenge*>
655       authentication_cb_;
656
657   std::unique_ptr<content::InputPicker> input_picker_;
658   base::IDMap<WebApplicationIconUrlGetCallback*>
659       web_app_icon_url_get_callback_map_;
660   base::IDMap<WebApplicationIconUrlsGetCallback*>
661       web_app_icon_urls_get_callback_map_;
662   base::IDMap<WebApplicationCapableGetCallback*>
663       web_app_capable_get_callback_map_;
664   std::unique_ptr<PermissionPopupManager> permission_popup_manager_;
665   std::unique_ptr<ScrollDetector> scroll_detector_;
666
667   // Manages injecting native objects.
668   std::unique_ptr<content::GinNativeBridgeDispatcherHost>
669       gin_native_bridge_dispatcher_host_;
670
671   WebViewExceededQuotaCallback<
672       Ewk_View_Exceeded_Indexed_Database_Quota_Callback,
673       Ewk_Security_Origin*,
674       long long>
675       exceeded_indexed_db_quota_callback_;
676   std::unique_ptr<Ewk_Security_Origin> exceeded_indexed_db_quota_origin_;
677
678 #if BUILDFLAG(IS_TIZEN)
679   blink::mojom::FileChooserParams::Mode filechooser_mode_;
680 #endif
681   std::map<const _Ewk_Quota_Permission_Request*,
682            content::QuotaPermissionContext::PermissionCallback>
683       quota_permission_request_map_;
684
685   bool is_initialized_;
686
687   std::unique_ptr<_Ewk_Back_Forward_List> back_forward_list_;
688
689   static content::WebContentsEflDelegate::WebContentsCreateCallback
690       create_new_window_web_contents_cb_;
691
692  private:
693   gfx::Vector2d previous_scroll_position_;
694
695   gfx::Point context_menu_position_;
696
697   std::vector<IPC::Message*> delayed_messages_;
698
699   std::map<int64_t, WebViewAsyncRequestHitTestDataCallback*> hit_test_callback_;
700
701   content::AcceptLanguagesHelper::AcceptLangsChangedCallback
702       accept_langs_changed_callback_;
703
704   std::unique_ptr<aura::WindowTreeHost> host_;
705   std::unique_ptr<aura::client::FocusClient> focus_client_;
706   std::unique_ptr<aura::client::WindowParentingClient> window_parenting_client_;
707   content::DateTimeChooserEfl* date_time_chooser_ = nullptr;
708 };
709
710 const unsigned int g_default_tilt_motion_sensitivity = 3;
711
712 #endif