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