Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / guestview / webview / webview_guest.h
index 386d0f6..7df3965 100644 (file)
@@ -41,11 +41,12 @@ class WebViewGuest : public GuestView,
 
   // GuestDelegate implementation.
   virtual void AddMessageToConsole(int32 level,
-                                   const string16& message,
+                                   const base::string16& message,
                                    int32 line_no,
-                                   const string16& source_id) OVERRIDE;
+                                   const base::string16& source_id) OVERRIDE;
   virtual void LoadProgressed(double progress) OVERRIDE;
   virtual void Close() OVERRIDE;
+  virtual void DidAttach() OVERRIDE;
   virtual void EmbedderDestroyed() OVERRIDE;
   virtual void GuestProcessGone(base::TerminationStatus status) OVERRIDE;
   virtual bool HandleKeyboardEvent(
@@ -71,6 +72,12 @@ class WebViewGuest : public GuestView,
                        const content::NotificationSource& source,
                        const content::NotificationDetails& details) OVERRIDE;
 
+  // Set the zoom factor.
+  virtual void SetZoom(double zoom_factor) OVERRIDE;
+
+  // Returns the current zoom factor.
+  double GetZoom();
+
   // If possible, navigate the guest to |relative_index| entries away from the
   // current navigation entry.
   void Go(int relative_index);
@@ -122,21 +129,35 @@ class WebViewGuest : public GuestView,
  private:
   virtual ~WebViewGuest();
 
+  // A map to store the callback for a request keyed by the request's id.
+  struct PermissionResponseInfo {
+    PermissionResponseCallback callback;
+    BrowserPluginPermissionType permission_type;
+    bool allowed_by_default;
+    PermissionResponseInfo();
+    PermissionResponseInfo(const PermissionResponseCallback& callback,
+                           BrowserPluginPermissionType permission_type,
+                           bool allowed_by_default);
+    ~PermissionResponseInfo();
+  };
+
+  static void RecordUserInitiatedUMA(const PermissionResponseInfo& info,
+                                     bool allow);
   // WebContentsObserver implementation.
   virtual void DidCommitProvisionalLoadForFrame(
       int64 frame_id,
-      const string16& frame_unique_name,
+      const base::string16& frame_unique_name,
       bool is_main_frame,
       const GURL& url,
       content::PageTransition transition_type,
       content::RenderViewHost* render_view_host) OVERRIDE;
   virtual void DidFailProvisionalLoad(
       int64 frame_id,
-      const string16& frame_unique_name,
+      const base::string16& frame_unique_name,
       bool is_main_frame,
       const GURL& validated_url,
       int error_code,
-      const string16& error_description,
+      const base::string16& error_description,
       content::RenderViewHost* render_view_host) OVERRIDE;
   virtual void DidStartProvisionalLoadForFrame(
       int64 frame_id,
@@ -146,10 +167,14 @@ class WebViewGuest : public GuestView,
       bool is_error_page,
       bool is_iframe_srcdoc,
       content::RenderViewHost* render_view_host) OVERRIDE;
+  virtual void DocumentLoadedInFrame(
+      int64 frame_id,
+      content::RenderViewHost* render_view_host) OVERRIDE;
   virtual void DidStopLoading(
       content::RenderViewHost* render_view_host) OVERRIDE;
   virtual void WebContentsDestroyed(
       content::WebContents* web_contents) OVERRIDE;
+  virtual void UserAgentOverrideSet(const std::string& user_agent) OVERRIDE;
 
   // Called after the load handler is called in the guest's main frame.
   void LoadHandlerCalled();
@@ -159,12 +184,12 @@ class WebViewGuest : public GuestView,
                     const GURL& new_url,
                     bool is_top_level);
 
-  static bool AllowChromeExtensionURLs();
-
   void AddWebViewToExtensionRendererState();
   static void RemoveWebViewFromExtensionRendererState(
       content::WebContents* web_contents);
 
+  void InjectChromeVoxIfNeeded(content::RenderViewHost* render_view_host);
+
   ObserverList<extensions::TabHelper::ScriptExecutionObserver>
       script_observers_;
   scoped_ptr<extensions::ScriptExecutor> script_executor_;
@@ -175,21 +200,25 @@ class WebViewGuest : public GuestView,
   // We only need the ids to be unique for a given WebViewGuest.
   int next_permission_request_id_;
 
-  // A map to store the callback for a request keyed by the request's id.
-  struct PermissionResponseInfo {
-    PermissionResponseCallback callback;
-    bool allowed_by_default;
-    PermissionResponseInfo();
-    PermissionResponseInfo(const PermissionResponseCallback& callback,
-                           bool allowed_by_default);
-    ~PermissionResponseInfo();
-  };
   typedef std::map<int, PermissionResponseInfo> RequestMap;
   RequestMap pending_permission_requests_;
 
   // True if the user agent is overridden.
   bool is_overriding_user_agent_;
 
+  // Indicates that the page needs to be reloaded once it has been attached to
+  // an embedder.
+  bool pending_reload_on_attachment_;
+
+  // Main frame ID of last committed page.
+  int64 main_frame_id_;
+
+  // Set to |true| if ChromeVox was already injected in main frame.
+  bool chromevox_injected_;
+
+  // Stores the current zoom factor.
+  double current_zoom_factor_;
+
   DISALLOW_COPY_AND_ASSIGN(WebViewGuest);
 };