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