Make EWK use WebContentsViewDelegate for popup menu handling.
[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(OS_TIZEN_MOBILE)
9 #if !defined(EWK_BRINGUP)
10 // FIXME: appfw/app_service.h is no more in Tizen 2.3, figure out what to include instead.
11 #include <appcore-agent/service_app.h>
12 #endif
13 #include <vector>
14 #endif
15
16 #include <map>
17 #include <string>
18 #include <Evas.h>
19 #include <locale.h>
20
21 #include "base/callback.h"
22 #include "base/memory/scoped_ptr.h"
23 #include "base/synchronization/waitable_event.h"
24 #include "content/public/common/context_menu_params.h"
25 #include "content/public/common/file_chooser_params.h"
26 #include "content/browser/renderer_host/event_with_latency_info.h"
27 #include "content/common/input/input_event_ack_state.h"
28 #include "content/public/browser/navigation_controller.h"
29 #include "content/public/browser/web_contents_delegate.h"
30 #include "content/public/common/menu_item.h"
31 #include "base/id_map.h"
32 #include "context_menu_controller_efl.h"
33 #include "eweb_context.h"
34 #include "private/ewk_hit_test_private.h"
35 #include "private/ewk_auth_challenge_private.h"
36 #include "private/ewk_settings_private.h"
37 #include "private/ewk_web_application_icon_data_private.h"
38 #include "eweb_view_callbacks.h"
39 #include "selection_controller_efl.h"
40 #include "web_contents_delegate_efl.h"
41 #include "context_menu_controller_efl.h"
42 #include "file_chooser_controller_efl.h"
43 #include "ui/gfx/point.h"
44 #include "ui/gfx/size.h"
45 #include "browser/inputpicker/InputPicker.h"
46 #include "third_party/WebKit/Source/platform/text/TextDirection.h"
47 #include "tizen_webview/public/tw_hit_test.h"
48
49 #ifdef TIZEN_CONTENTS_DETECTION
50 #include "popup_controller_efl.h"
51 #endif
52
53 #ifdef TIZEN_EDGE_EFFECT
54 #include "EdgeEffect.h"
55 #endif
56
57 #if defined(OS_TIZEN)
58 #include "browser/selectpicker/popup_picker.h"
59 #endif
60
61 #include "tizen_webview/public/tw_back_forward_history.h"
62 #include "tizen_webview/public/tw_back_forward_list_impl.h"
63 #include "tizen_webview/public/tw_hit_test.h"
64 #include "tizen_webview/public/tw_touch_event.h"
65 #include "tizen_webview/public/tw_callbacks.h"
66 #include "tizen_webview/public/tw_content_security_policy.h"
67 #include "tizen_webview/public/tw_frame.h"
68 #include "tizen_webview/public/tw_find_options.h"
69 #include "tizen_webview/public/tw_touch_event.h"
70
71 namespace content {
72 class RenderViewHost;
73 class RenderWidgetHostViewEfl;
74 class WebContentsDelegateEfl;
75 class ContextMenuControllerEfl;
76 class DevToolsDelegateEfl;
77 class WebContentsViewEfl;
78 #ifdef TIZEN_CONTENTS_DETECTION
79 class PopupControllerEfl;
80 #endif
81 }
82
83 namespace ui {
84 class GestureRecognizer;
85 class GestureEvent;
86 class TouchEvent;
87 }
88
89 namespace tizen_webview {
90 class Hit_Test;
91 class WebContext;
92 class WebView;
93 class WebViewDelegate;
94 class WebViewEvasEventHandler;
95 class PolicyDecision;
96 class Error;
97 }
98
99 class WebAppScreenshotCapturedCallback : public base::RefCounted<WebAppScreenshotCapturedCallback> {
100  public:
101       WebAppScreenshotCapturedCallback(tizen_webview::Web_App_Screenshot_Captured_Callback func, void *user_data, Evas* canvas)
102           : func_(func), user_data_(user_data), canvas_(canvas) {}
103   void Run(Evas_Object* image) {
104     if (func_ != NULL)
105       (func_)(image, user_data_);
106   }
107
108  private:
109   tizen_webview::Web_App_Screenshot_Captured_Callback func_;
110   void *user_data_;
111   Evas* canvas_;
112 };
113
114 class EwkViewPlainTextGetCallback {
115  public:
116   EwkViewPlainTextGetCallback(tizen_webview::View_Plain_Text_Get_Callback callback,
117                               void* user_data)
118     : callback_(callback), user_data_(user_data)
119     { }
120   void TriggerCallback(Evas_Object* obj, const std::string& content_text);
121
122  private:
123   tizen_webview::View_Plain_Text_Get_Callback callback_;
124   void* user_data_;
125 };
126
127 class OrientationLockCallback {
128  public:
129   OrientationLockCallback(tizen_webview::Orientation_Lock_Cb lock,
130                           void* user_data)
131     : lock_(lock),
132       user_data_(user_data)
133     {}
134   private:
135     tizen_webview::Orientation_Lock_Cb lock_;
136     void* user_data_;
137 };
138
139 class MHTMLCallbackDetails {
140  public:
141   MHTMLCallbackDetails(tizen_webview::View_MHTML_Data_Get_Callback callback_func, void *user_data)
142     : callback_func_(callback_func),
143       user_data_(user_data)
144   {}
145   void Run(Evas_Object* obj, const std::string& mhtml_content);
146
147   tizen_webview::View_MHTML_Data_Get_Callback callback_func_;
148   void *user_data_;
149 };
150
151 class WebApplicationIconUrlGetCallback {
152  public:
153   WebApplicationIconUrlGetCallback(tizen_webview::Web_App_Icon_URL_Get_Callback func, void *user_data)
154     : func_(func), user_data_(user_data)
155   {}
156   void Run(const std::string &url) {
157     if (func_) {
158       (func_)(url.c_str(), user_data_);
159     }
160   }
161
162  private:
163   tizen_webview::Web_App_Icon_URL_Get_Callback func_;
164   void *user_data_;
165 };
166
167 class WebApplicationIconUrlsGetCallback {
168  public:
169   WebApplicationIconUrlsGetCallback(tizen_webview::Web_App_Icon_URLs_Get_Callback func, void *user_data)
170     : func_(func), user_data_(user_data)
171   {}
172   void Run(const std::map<std::string, std::string> &urls) {
173     if (func_) {
174       Eina_List *list = NULL;
175       for (std::map<std::string, std::string>::const_iterator it = urls.begin(); it != urls.end(); ++it) {
176         _Ewk_Web_App_Icon_Data *data = ewkWebAppIconDataCreate(it->first, it->second);
177         list = eina_list_append(list, data);
178       }
179       (func_)(list, user_data_);
180     }
181   }
182
183  private:
184   tizen_webview::Web_App_Icon_URLs_Get_Callback func_;
185   void *user_data_;
186 };
187
188 class WebApplicationCapableGetCallback {
189  public:
190   WebApplicationCapableGetCallback(tizen_webview::Web_App_Capable_Get_Callback func, void *user_data)
191     : func_(func), user_data_(user_data)
192   {}
193   void Run(bool capable) {
194     if (func_) {
195       (func_)(capable ? EINA_TRUE : EINA_FALSE, user_data_);
196     }
197   }
198
199  private:
200   tizen_webview::Web_App_Capable_Get_Callback func_;
201   void *user_data_;
202 };
203
204 class AsyncHitTestRequest;
205 class NotificationPermissionCallback {
206  public:
207   NotificationPermissionCallback(
208       Evas_Object* obj,
209       tizen_webview::View_Notification_Permission_Callback func,
210       void* user_data)
211       : obj_(obj), func_(func), user_data_(user_data) {}
212   bool Run(Ewk_Notification_Permission_Request* request) {
213     if (func_) {
214       return (func_)(obj_, request, user_data_) == EINA_TRUE;
215     }
216     return false;
217   }
218
219 private:
220   Evas_Object* obj_;
221   tizen_webview::View_Notification_Permission_Callback func_;
222   void* user_data_;
223 };
224
225 class WebViewAsyncRequestHitTestDataCallback;
226 class JavaScriptDialogManagerEfl;
227 class WebViewGeolocationPermissionCallback;
228 class WebViewUnfocusAllowCallback;
229
230 class EWebView {
231  public:
232   static EWebView* FromEvasObject(Evas_Object* eo);
233   static int GetOrientation();
234
235   // initialize data members and activate event handlers.
236   // call this once after created and before use
237   void Initialize();
238
239   void CreateNewWindow(content::WebContentsDelegate::WebContentsCreateCallback);
240   static Evas_Object* GetHostWindowDelegate(const content::WebContents*);
241
242   tizen_webview::WebView* GetPublicWebView();
243 #if defined(EWK_REFACTOR)
244   tizen_webview::WebViewEvasEventHandler* GetEvasEventHandler() { return evas_event_handler_; }
245 #endif
246   tizen_webview::WebContext* context() const { return context_.get(); }
247   Evas_Object* evas_object() const { return evas_object_; }
248   Evas* GetEvas() const { return evas_object_evas_get(evas_object_); }
249   Evas_Object* GetContentImageObject() const;
250
251   content::WebContents& web_contents() const
252   {
253     return *web_contents_.get();
254   }
255
256   template<EWebViewCallbacks::CallbackType callbackType>
257   EWebViewCallbacks::CallBack<callbackType> SmartCallback() const
258   {
259     return EWebViewCallbacks::CallBack<callbackType>(evas_object_);
260   }
261
262   void set_magnifier(bool status);
263
264   // ewk_view api
265   void SetURL(const char* url_string);
266   const char* GetURL() const;
267   void Reload();
268   void ReloadIgnoringCache();
269   Eina_Bool CanGoBack();
270   Eina_Bool CanGoForward();
271   Eina_Bool HasFocus() const;
272   void SetFocus(Eina_Bool focus);
273   Eina_Bool GoBack();
274   Eina_Bool GoForward();
275   void Suspend();
276   void Resume();
277   void Stop();
278   double GetTextZoomFactor() const;
279   void SetTextZoomFactor(double text_zoom_factor);
280   void ExecuteEditCommand(const char* command, const char* value);
281   void SetOrientation(int orientation);
282   void SetOrientationLockCallback(tizen_webview::Orientation_Lock_Cb func, void* data);
283   bool TouchEventsEnabled() const;
284   void SetTouchEventsEnabled(bool enabled);
285   bool MouseEventsEnabled() const;
286   void SetMouseEventsEnabled(bool enabled);
287   void Show();
288   void Hide();
289   bool ExecuteJavaScript(const char* script, tizen_webview::View_Script_Execute_Callback callback, void* userdata);
290   bool SetUserAgent(const char* userAgent);
291   bool SetUserAgentAppName(const char* application_name);
292   bool SetPrivateBrowsing(bool incognito);
293   bool GetPrivateBrowsing() const;
294   const char* GetUserAgent() const;
295   const char* GetUserAgentAppName() const;
296   const char* GetSelectedText() const;
297   bool IsLastAvailableTextEmpty() const;
298   Ewk_Settings* GetSettings();
299   tizen_webview::Frame* GetMainFrame();
300   void UpdateWebKitPreferences();
301   void LoadHTMLString(const char* html, const char* base_uri, const char* unreachable_uri);
302   void LoadPlainTextString(const char* plain_text);
303   void LoadData(const char* data, size_t size, const char* mime_type, const char* encoding, const char* base_uri, const char* unreachable_uri = NULL);
304   void InvokeLoadError(const tizen_webview::Error &error);
305   void InvokeAuthCallback(LoginDelegateEfl* login_delegate, const GURL& url, const std::string& realm);
306   void Find(const char* text, tizen_webview::Find_Options);
307   void InvokeAuthCallbackOnUI(_Ewk_Auth_Challenge* auth_challenge);
308   void SetContentSecurityPolicy(const char* policy, tizen_webview::ContentSecurityPolicyType type);
309   void ShowPopupMenu(const std::vector<content::MenuItem>& items,
310                      int selectedIndex, bool multiple);
311   Eina_Bool HidePopupMenu();
312   void UpdateFormNavigation(int formElementCount, int currentNodeIndex,
313       bool prevState, bool nextState);
314   void FormNavigate(bool direction);
315   bool IsSelectPickerShown() const;
316   void CloseSelectPicker();
317   bool FormIsNavigating() const { return formIsNavigating_; }
318   void SetFormIsNavigating(bool formIsNavigating);
319   Eina_Bool PopupMenuUpdate(Eina_List* items, int selectedIndex);
320   Eina_Bool DidSelectPopupMenuItem(int selectedIndex);
321   Eina_Bool DidMultipleSelectPopupMenuItem(std::vector<int>& selectedIndices);
322   Eina_Bool PopupMenuClose();
323   void ShowContextMenu(
324       const content::ContextMenuParams& params,
325       content::ContextMenuType type = content::MENU_TYPE_LINK,
326       bool show_selection = true);
327   void CancelContextMenu(int request_id);
328   void SetScale(double scale_factor, int x, int y);
329   bool GetScrollPosition(int* x, int* y) const;
330   void SetScroll(int x, int y);
331   void UrlRequestSet(const char* url,
332       content::NavigationController::LoadURLType loadtype,
333       Eina_Hash* headers,
334       const char* body);
335
336   content::SelectionControllerEfl* GetSelectionController() const { return selection_controller_.get(); }
337 #ifdef TIZEN_CONTENTS_DETECTION
338   content::PopupControllerEfl* GetPopupController() const { return popup_controller_.get(); }
339 #endif
340   void SelectRange(const gfx::Point& start, const gfx::Point& end);
341   void MoveCaret(const gfx::Point& point);
342   void QuerySelectionStyle();
343   void OnQuerySelectionStyleReply(const SelectionStylePrams& params);
344   void SelectClosestWord(const gfx::Point& touch_point);
345   void SelectLinkText(const gfx::Point& touch_point);
346   bool GetSelectionRange(Eina_Rectangle* left_rect, Eina_Rectangle* right_rect);
347   void GetSnapShotForRect(gfx::Rect& rect);
348
349   // Callback OnCopyFromBackingStore will be called once we get the snapshot from render
350   void OnCopyFromBackingStore(bool success, const SkBitmap& bitmap);
351
352   /**
353    * Creates a snapshot of given rectangle from EWebView
354    *
355    * @param rect rectangle of EWebView which will be taken into snapshot
356    *
357    * @return created snapshot or NULL if error occured.
358    * @note ownership of snapshot is passed to caller
359   */
360   Evas_Object* GetSnapshot(Eina_Rectangle rect);
361
362   bool GetSnapshotAsync(Eina_Rectangle rect, Evas* canvas, tizen_webview::Web_App_Screenshot_Captured_Callback callback, void* user_data);
363   void InvokePolicyResponseCallback(tizen_webview::PolicyDecision* policy_decision);
364   void InvokePolicyNavigationCallback(content::RenderViewHost* rvh,
365       NavigationPolicyParams params, bool* handled);
366   void UseSettingsFont();
367
368   tizen_webview::Hit_Test* RequestHitTestDataAt(int x, int y,
369       tizen_webview::Hit_Test_Mode mode);
370   Eina_Bool AsyncRequestHitTestDataAt(int x, int y,
371       tizen_webview::Hit_Test_Mode mode,
372       tizen_webview::View_Hit_Test_Request_Callback,
373       void* user_data);
374   tizen_webview::Hit_Test* RequestHitTestDataAtBlinkCoords(int x, int y,
375       tizen_webview::Hit_Test_Mode mode);
376   Eina_Bool AsyncRequestHitTestDataAtBlinkCords(int x, int y,
377       tizen_webview::Hit_Test_Mode mode,
378       tizen_webview::View_Hit_Test_Request_Callback,
379       void* user_data);
380   void DispatchAsyncHitTestData(const _Ewk_Hit_Test& hit_test_data, const NodeAttributesMap& node_attributes, int64_t request_id);
381   void UpdateHitTestData(const _Ewk_Hit_Test& hit_test_data, const NodeAttributesMap& node_attributes);
382
383   int current_find_request_id() const { return current_find_request_id_; }
384   bool PlainTextGet(tizen_webview::View_Plain_Text_Get_Callback callback, void* user_data);
385   void InvokePlainTextGetCallback(const std::string& content_text, int plain_text_get_callback_id);
386   int SetEwkViewPlainTextGetCallback(tizen_webview::View_Plain_Text_Get_Callback callback, void* user_data);
387   void SetViewGeolocationPermissionCallback(tizen_webview::View_Geolocation_Permission_Callback callback, void* user_data);
388   bool InvokeViewGeolocationPermissionCallback(void* geolocation_permission_request_context, Eina_Bool* result);
389   void SetViewUnfocusAllowCallback(tizen_webview::View_Unfocus_Allow_Callback callback, void* user_data);
390   bool InvokeViewUnfocusAllowCallback(tizen_webview::Unfocus_Direction direction, Eina_Bool* result);
391   void DidChangeContentsSize(int width, int height);
392   const Eina_Rectangle GetContentsSize() const;
393   void GetScrollSize(int* w, int* h);
394   void StopFinding();
395   void SetProgressValue(double progress);
396   double GetProgressValue();
397   const char* GetTitle();
398   bool SaveAsPdf(int width, int height, const std::string& file_name);
399   void BackForwardListClear();
400   tizen_webview::BackForwardList* GetBackForwardList() const;
401   void InvokeBackForwardListChangedCallback();
402   tizen_webview::BackForwardHistory* GetBackForwardHistory() const;
403   bool WebAppCapableGet(tizen_webview::Web_App_Capable_Get_Callback callback, void *userData);
404   bool WebAppIconUrlGet(tizen_webview::Web_App_Icon_URL_Get_Callback callback, void *userData);
405   bool WebAppIconUrlsGet(tizen_webview::Web_App_Icon_URLs_Get_Callback callback, void *userData);
406   void InvokeWebAppCapableGetCallback(bool capable, int callbackId);
407   void InvokeWebAppIconUrlGetCallback(const std::string &iconUrl, int callbackId);
408   void InvokeWebAppIconUrlsGetCallback(const std::map<std::string, std::string> &iconUrls, int callbackId);
409   void SetNotificationPermissionCallback(tizen_webview::View_Notification_Permission_Callback callback, void* user_data);
410   bool IsNotificationPermissionCallbackSet() const;
411   bool InvokeNotificationPermissionCallback(Ewk_Notification_Permission_Request* request);
412
413   bool GetMHTMLData(tizen_webview::View_MHTML_Data_Get_Callback callback, void* user_data);
414   void OnMHTMLContentGet(const std::string& mhtml_content, int callback_id);
415   bool IsFullscreen();
416   void ExitFullscreen();
417   double GetScale();
418   void DidChangePageScaleFactor(double scale_factor);
419   void SetJavaScriptAlertCallback(tizen_webview::View_JavaScript_Alert_Callback callback, void* user_data);
420   void JavaScriptAlertReply();
421   void SetJavaScriptConfirmCallback(tizen_webview::View_JavaScript_Confirm_Callback callback, void* user_data);
422   void JavaScriptConfirmReply(bool result);
423   void SetJavaScriptPromptCallback(tizen_webview::View_JavaScript_Prompt_Callback callback, void* user_data);
424   void JavaScriptPromptReply(const char* result);
425   void set_renderer_crashed();
426   void GetPageScaleRange(double *min_scale, double *max_scale);
427   void DidChangePageScaleRange(double min_scale, double max_scale);
428   void SetDrawsTransparentBackground(bool enabled);
429   void GetSessionData(const char **data, unsigned *length) const;
430   bool RestoreFromSessionData(const char *data, unsigned length);
431   void ShowFileChooser(const content::FileChooserParams&);
432   void DidChangeContentsArea(int width, int height);
433   void SetBrowserFont();
434   void SetCertificatePem(const std::string& certificate);
435   bool IsDragging() const;
436
437   void RequestColorPicker(int r, int g, int b, int a);
438   void DismissColorPicker();
439   bool SetColorPickerColor(int r, int g, int b, int a);
440   void InputPickerShow(
441       ui::TextInputType input_type, double input_value);
442   void FindAndRunSnapshotCallback(Evas_Object* image, int snapshotId);
443
444 #ifdef TIZEN_EDGE_EFFECT
445   scoped_refptr<EdgeEffect> edgeEffect() { return edge_effect_; }
446 #endif
447 #ifdef TIZEN_CONTENTS_DETECTION
448   void ShowContentsDetectedPopup(const char*);
449 #endif
450
451   bool IsIMEShow();
452   gfx::Rect GetIMERect();
453   void ScrollFocusedEditableNode();
454
455   // Returns TCP port number with Inspector, or 0 if error.
456   int StartInspectorServer(int port = 0);
457   bool StopInspectorServer();
458
459   void LoadNotFoundErrorPage(const std::string& invalidUrl);
460   static std::string GetPlatformLocale();
461   bool GetLinkMagnifierEnabled() const;
462   void SetLinkMagnifierEnabled(bool enabled);
463
464   void SetOverrideEncoding(const std::string& encoding);
465   void SetViewMode(blink::WebViewMode view_mode);
466
467   gfx::Point GetContextMenuPosition() const;
468
469   /// ---- Event handling
470   bool HandleShow();
471   bool HandleHide();
472   bool HandleMove(int x, int y);
473   bool HandleResize(int width, int height);
474   bool HandleFocusIn();
475   bool HandleFocusOut();
476
477   bool HandleEvasEvent(const Evas_Event_Mouse_Down* event);
478   bool HandleEvasEvent(const Evas_Event_Mouse_Up* event);
479   bool HandleEvasEvent(const Evas_Event_Mouse_Move* event);
480   bool HandleEvasEvent(const Evas_Event_Mouse_Wheel* event);
481   bool HandleEvasEvent(const Evas_Event_Key_Down* event);
482   bool HandleEvasEvent(const Evas_Event_Key_Up* event);
483   bool HandleGesture(ui::GestureEvent* event);
484   bool HandleTouchEvent(ui::TouchEvent* event);
485   void HandleRendererProcessCrash();
486   void HandlePostponedGesture(int x, int y, ui::EventType type);
487  private:
488   void InitializeContent();
489   void EvasToBlinkCords(int x, int y, int* view_x, int* view_y);
490   Eina_Bool AsyncRequestHitTestDataAtBlinkCords(int x, int y,
491       tizen_webview::Hit_Test_Mode mode,
492       WebViewAsyncRequestHitTestDataCallback* cb);
493   void HandleLongPressGesture(int x, int y, tizen_webview::Hit_Test_Mode mode,
494       tizen_webview::Hit_Test*);
495   void HandleTapGesture(int x, int y, tizen_webview::Hit_Test_Mode mode,
496       tizen_webview::Hit_Test*);
497   content::WebContentsViewEfl* GetWebContentsViewEfl() const;
498
499 #if defined(OS_TIZEN_MOBILE) && !defined(EWK_BRINGUP)
500   static void cameraResultCb(service_h request, service_h reply,
501     service_result_e result, void* data);
502 #endif
503
504 #if defined(OS_TIZEN_MOBILE) && !defined(EWK_BRINGUP)
505   bool LaunchCamera(base::string16 mimetype);
506 #endif
507   content::RenderWidgetHostViewEfl* rwhv() const;
508   JavaScriptDialogManagerEfl* GetJavaScriptDialogManagerEfl();
509
510 #if defined(OS_TIZEN)
511   void ReleasePopupMenuList();
512 #endif
513
514   tizen_webview::WebView* public_webview_;
515 #if defined(EWK_REFACTOR)
516   tizen_webview::WebViewEvasEventHandler* evas_event_handler_;
517 #endif
518   scoped_refptr<tizen_webview::WebContext> context_;
519   scoped_refptr<tizen_webview::WebContext> old_context_;
520   scoped_ptr<content::WebContents> web_contents_;
521   scoped_ptr<content::WebContentsDelegateEfl> web_contents_delegate_;
522   std::string pending_url_request_;
523   scoped_ptr<Ewk_Settings> settings_;
524   scoped_ptr<tizen_webview::Frame> frame_;
525   scoped_ptr<tizen_webview::PolicyDecision> window_policy_;
526   Evas_Object* evas_object_;
527   Evas_Object* native_view_;
528   bool touch_events_enabled_;
529   bool mouse_events_enabled_;
530   double text_zoom_factor_;
531   mutable std::string selected_text_;
532   mutable std::string user_agent_;
533   mutable std::string user_agent_app_name_;
534   scoped_ptr<_Ewk_Auth_Challenge> auth_challenge_;
535
536 #if defined(OS_TIZEN)
537   Eina_List* popupMenuItems_;
538   Popup_Picker* popupPicker_;
539 #endif
540   bool formIsNavigating_;
541   typedef struct {
542     int count;
543     int position;
544     bool prevState;
545     bool nextState;
546   } formNavigation;
547   formNavigation formNavigation_;
548   scoped_ptr<content::ContextMenuControllerEfl> context_menu_;
549   scoped_ptr<content::FileChooserControllerEfl> file_chooser_;
550 #ifdef TIZEN_CONTENTS_DETECTION
551   scoped_ptr<content::PopupControllerEfl> popup_controller_;
552 #endif
553   scoped_ptr<content::SelectionControllerEfl> selection_controller_;
554   base::string16 previous_text_;
555   int current_find_request_id_;
556   static int find_request_id_counter_;
557   IDMap<EwkViewPlainTextGetCallback, IDMapOwnPointer> plain_text_get_callback_map_;
558   gfx::Size contents_size_;
559   double progress_;
560   mutable std::string title_;
561   mutable std::string pem_certificate_;
562   _Ewk_Hit_Test hit_test_data_;
563   base::WaitableEvent hit_test_completion_;
564   IDMap<MHTMLCallbackDetails, IDMapOwnPointer> mhtml_callback_map_;
565   double page_scale_factor_;
566   double min_page_scale_factor_;
567   double max_page_scale_factor_;
568   scoped_ptr<OrientationLockCallback> orientation_lock_callback_;
569   scoped_ptr<WebViewGeolocationPermissionCallback> geolocation_permission_cb_;
570   scoped_ptr<WebViewUnfocusAllowCallback> unfocus_allow_cb_;
571   scoped_ptr<content::InputPicker> inputPicker_;
572   IDMap<WebApplicationIconUrlGetCallback, IDMapOwnPointer> web_app_icon_url_get_callback_map_;
573   IDMap<WebApplicationIconUrlsGetCallback, IDMapOwnPointer> web_app_icon_urls_get_callback_map_;
574   IDMap<WebApplicationCapableGetCallback, IDMapOwnPointer> web_app_capable_get_callback_map_;
575   IDMap< WebAppScreenshotCapturedCallback, IDMapOwnPointer> screen_capture_cb_map_;
576   scoped_ptr<NotificationPermissionCallback> notification_permission_callback_;
577   content::DevToolsDelegateEfl* inspector_server_;
578 #ifdef TIZEN_EDGE_EFFECT
579   scoped_refptr<EdgeEffect> edge_effect_;
580 #endif
581
582 #if defined(OS_TIZEN_MOBILE)
583   content::FileChooserParams::Mode filechooser_mode_;
584 #endif
585   bool is_initialized_;
586
587   scoped_ptr<tizen_webview::BackForwardList> back_forward_list_;
588
589   static content::WebContentsDelegate::WebContentsCreateCallback
590       create_new_window_web_contents_cb_;
591
592 private:
593   Eina_Bool AsyncRequestHitTestPrivate(
594       int x, int y, tizen_webview::Hit_Test_Mode mode,
595       AsyncHitTestRequest* asyncHitTestRequest);
596
597   gfx::Vector2d previous_scroll_position_;
598
599   gfx::Point context_menu_position_;
600
601   std::map<int64_t, WebViewAsyncRequestHitTestDataCallback*> hit_test_callback_;
602   // only tizen_webview::WebView can create and delete this
603   EWebView(tizen_webview::WebView* owner, tizen_webview::WebContext*, Evas_Object* smart_object);
604   ~EWebView();
605   friend class tizen_webview::WebView;
606   friend class tizen_webview::WebViewEvasEventHandler;
607 };
608
609 namespace tizen_webview {
610 typedef ::EWebView WebViewImpl;
611 };
612
613 const unsigned int g_default_tilt_motion_sensitivity = 3;
614
615
616 #endif