1 // Copyright 2013 The Chromium Authors. 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.
5 #ifndef CHROME_BROWSER_DEVTOOLS_PORT_FORWARDING_CONTROLLER_H_
6 #define CHROME_BROWSER_DEVTOOLS_PORT_FORWARDING_CONTROLLER_H_
10 #include "chrome/browser/devtools/devtools_adb_bridge.h"
11 #include "components/browser_context_keyed_service/browser_context_keyed_service.h"
12 #include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
16 class PortForwardingController
: public BrowserContextKeyedService
{
18 explicit PortForwardingController(PrefService
* pref_service
);
20 virtual ~PortForwardingController();
22 class Factory
: public BrowserContextKeyedServiceFactory
{
24 // Returns singleton instance of Factory.
25 static Factory
* GetInstance();
27 // Returns PortForwardingController associated with |profile|.
28 static PortForwardingController
* GetForProfile(Profile
* profile
);
31 friend struct DefaultSingletonTraits
<Factory
>;
36 // BrowserContextKeyedServiceFactory overrides:
37 virtual BrowserContextKeyedService
* BuildServiceInstanceFor(
38 content::BrowserContext
* context
) const OVERRIDE
;
39 DISALLOW_COPY_AND_ASSIGN(Factory
);
42 typedef int PortStatus
;
43 typedef std::map
<int, PortStatus
> PortStatusMap
;
44 typedef std::map
<std::string
, PortStatusMap
> DevicesStatus
;
46 DevicesStatus
UpdateDeviceList(
47 const DevToolsAdbBridge::RemoteDevices
& devices
);
51 typedef std::map
<std::string
, Connection
* > Registry
;
53 scoped_refptr
<RefCountedAdbThread
> adb_thread_
;
54 PrefService
* pref_service_
;
57 DISALLOW_COPY_AND_ASSIGN(PortForwardingController
);
60 #endif // CHROME_BROWSER_DEVTOOLS_PORT_FORWARDING_CONTROLLER_H_