Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / devtools / devtools_ui_bindings.h
index 94bf7ba..2c47ea7 100644 (file)
@@ -18,7 +18,7 @@
 #include "chrome/browser/devtools/devtools_file_system_indexer.h"
 #include "chrome/browser/devtools/devtools_targets_ui.h"
 #include "content/public/browser/devtools_client_host.h"
-#include "content/public/browser/devtools_frontend_host_delegate.h"
+#include "content/public/browser/devtools_frontend_host.h"
 #include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
 #include "ui/gfx/size.h"
@@ -34,9 +34,10 @@ class WebContents;
 
 // Base implementation of DevTools bindings around front-end.
 class DevToolsUIBindings : public content::NotificationObserver,
-                           public content::DevToolsFrontendHostDelegate,
+                           public content::DevToolsFrontendHost::Delegate,
                            public DevToolsEmbedderMessageDispatcher::Delegate,
-                           public DevToolsAndroidBridge::DeviceCountListener {
+                           public DevToolsAndroidBridge::DeviceCountListener,
+                           public content::DevToolsClientHost {
  public:
   static GURL ApplyThemeToURL(Profile* profile, const GURL& base_url);
 
@@ -46,8 +47,6 @@ class DevToolsUIBindings : public content::NotificationObserver,
     virtual void ActivateWindow() = 0;
     virtual void CloseWindow() = 0;
     virtual void SetInspectedPageBounds(const gfx::Rect& rect) = 0;
-    virtual void SetContentsResizingStrategy(
-        const gfx::Insets& insets, const gfx::Size& min_size) = 0;
     virtual void InspectElementCompleted() = 0;
     virtual void MoveWindow(int x, int y) = 0;
     virtual void SetIsDocked(bool is_docked) = 0;
@@ -65,7 +64,6 @@ class DevToolsUIBindings : public content::NotificationObserver,
 
   content::WebContents* web_contents() { return web_contents_; }
   Profile* profile() { return profile_; }
-  content::DevToolsClientHost* frontend_host() { return frontend_host_.get(); }
 
   // Takes ownership over the |delegate|.
   void SetDelegate(Delegate* delegate);
@@ -73,24 +71,27 @@ class DevToolsUIBindings : public content::NotificationObserver,
                           const base::Value* arg1,
                           const base::Value* arg2,
                           const base::Value* arg3);
-  void DispatchEventOnFrontend(const std::string& event_type,
-                               const base::Value* event_data);
  private:
-  // content::NotificationObserver:
+  // content::NotificationObserver overrides.
   virtual void Observe(int type,
                        const content::NotificationSource& source,
                        const content::NotificationDetails& details) OVERRIDE;
 
-  // content::DevToolsFrontendHostDelegate override:
+  // content::DevToolsFrontendHost::Delegate implementation.
+  virtual void HandleMessageFromDevToolsFrontend(
+      const std::string& message) OVERRIDE;
+  virtual void HandleMessageFromDevToolsFrontendToBackend(
+      const std::string& message) OVERRIDE;
+
+  // content::DevToolsClientHost implementation.
+  virtual void DispatchOnInspectorFrontend(const std::string& message) OVERRIDE;
   virtual void InspectedContentsClosing() OVERRIDE;
-  virtual void DispatchOnEmbedder(const std::string& message) OVERRIDE;
+  virtual void ReplacedWithAnotherClient() OVERRIDE;
 
-  // DevToolsEmbedderMessageDispatcher::Delegate overrides:
+  // DevToolsEmbedderMessageDispatcher::Delegate implementation.
   virtual void ActivateWindow() OVERRIDE;
   virtual void CloseWindow() OVERRIDE;
   virtual void SetInspectedPageBounds(const gfx::Rect& rect) OVERRIDE;
-  virtual void SetContentsResizingStrategy(
-      const gfx::Insets& insets, const gfx::Size& min_size) OVERRIDE;
   virtual void InspectElementCompleted() OVERRIDE;
   virtual void InspectedURLChanged(const std::string& url) OVERRIDE;
   virtual void MoveWindow(int x, int y) OVERRIDE;
@@ -118,8 +119,9 @@ class DevToolsUIBindings : public content::NotificationObserver,
   virtual void ResetZoom() OVERRIDE;
   virtual void OpenUrlOnRemoteDeviceAndInspect(const std::string& browser_id,
                                                const std::string& url) OVERRIDE;
-  virtual void Subscribe(const std::string& event_type) OVERRIDE;
-  virtual void Unsubscribe(const std::string& event_type) OVERRIDE;
+  virtual void SetDeviceCountUpdatesEnabled(bool enabled) OVERRIDE;
+  virtual void SetDevicesUpdatesEnabled(bool enabled) OVERRIDE;
+  virtual void SendMessageToBrowser(const std::string& message) OVERRIDE;
 
   void EnableRemoteDeviceCounter(bool enable);
 
@@ -127,8 +129,8 @@ class DevToolsUIBindings : public content::NotificationObserver,
   virtual void DeviceCountChanged(int count) OVERRIDE;
 
   // Forwards discovered devices to frontend.
-  virtual void PopulateRemoteDevices(const std::string& source,
-                                     scoped_ptr<base::ListValue> targets);
+  virtual void DevicesUpdated(const std::string& source,
+                              const base::ListValue& targets);
 
   void DocumentOnLoadCompletedInMainFrame();
 
@@ -164,9 +166,8 @@ class DevToolsUIBindings : public content::NotificationObserver,
   Profile* profile_;
   content::WebContents* web_contents_;
   scoped_ptr<Delegate> delegate_;
-  bool device_listener_enabled_;
   content::NotificationRegistrar registrar_;
-  scoped_ptr<content::DevToolsClientHost> frontend_host_;
+  scoped_ptr<content::DevToolsFrontendHost> frontend_host_;
   scoped_ptr<DevToolsFileHelper> file_helper_;
   scoped_refptr<DevToolsFileSystemIndexer> file_system_indexer_;
   typedef std::map<
@@ -175,8 +176,8 @@ class DevToolsUIBindings : public content::NotificationObserver,
       IndexingJobsMap;
   IndexingJobsMap indexing_jobs_;
 
-  typedef std::set<std::string> Subscribers;
-  Subscribers subscribers_;
+  bool device_count_updates_enabled_;
+  bool devices_updates_enabled_;
   scoped_ptr<DevToolsTargetsUIHandler> remote_targets_handler_;
   scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_;
   GURL url_;