Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / devtools / device / port_forwarding_controller.h
index ae491d7..c1074bf 100644 (file)
 class PrefService;
 class Profile;
 
-class PortForwardingController
-    : private KeyedService,
-      private DevToolsAndroidBridge::DeviceListListener {
+class PortForwardingController {
  public:
+  typedef DevToolsAndroidBridge::PortStatus PortStatus;
+  typedef DevToolsAndroidBridge::PortStatusMap PortStatusMap;
+  typedef DevToolsAndroidBridge::DevicesStatus DevicesStatus;
+
   explicit PortForwardingController(Profile* profile);
 
   virtual ~PortForwardingController();
 
-  // KeyedService implementation.
-  virtual void Shutdown() OVERRIDE;
-
-  class Factory : public BrowserContextKeyedServiceFactory {
-   public:
-    // Returns singleton instance of Factory.
-    static Factory* GetInstance();
-
-    // Returns PortForwardingController associated with |profile|.
-    static PortForwardingController* GetForProfile(Profile* profile);
-
-   private:
-    friend struct DefaultSingletonTraits<Factory>;
-
-    Factory();
-    virtual ~Factory();
-
-    // BrowserContextKeyedServiceFactory overrides:
-    virtual KeyedService* BuildServiceInstanceFor(
-        content::BrowserContext* context) const OVERRIDE;
-    DISALLOW_COPY_AND_ASSIGN(Factory);
-  };
-
-  typedef int PortStatus;
-  typedef std::map<int, PortStatus> PortStatusMap;
-  typedef std::map<std::string, PortStatusMap> DevicesStatus;
-
-  class Listener {
-   public:
-    typedef PortForwardingController::PortStatusMap PortStatusMap;
-    typedef PortForwardingController::DevicesStatus DevicesStatus;
-
-    virtual void PortStatusChanged(const DevicesStatus&) = 0;
-   protected:
-    virtual ~Listener() {}
-  };
-
-  void AddListener(Listener* listener);
-  void RemoveListener(Listener* listener);
+  DevicesStatus DeviceListChanged(
+      const DevToolsAndroidBridge::RemoteDevices& devices);
 
  private:
   class Connection;
   typedef std::map<std::string, Connection*> Registry;
 
-  // DevToolsAndroidBridge::Listener implementation.
-  virtual void DeviceListChanged(
-      const DevToolsAndroidBridge::RemoteDevices& devices) OVERRIDE;
-
   void OnPrefsChange();
 
-  void StartListening();
-  void StopListening();
-
   void UpdateConnections();
-  void ShutdownConnections();
-
-  void NotifyListeners(const DevicesStatus& status) const;
 
   Profile* profile_;
   PrefService* pref_service_;
   PrefChangeRegistrar pref_change_registrar_;
   Registry registry_;
 
-  typedef std::vector<Listener*> Listeners;
-  Listeners listeners_;
-  bool listening_;
-
   typedef std::map<int, std::string> ForwardingMap;
   ForwardingMap forwarding_map_;