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