Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / devtools / port_forwarding_controller.h
blobfac4da598bfef102a2b557cd8a72ed34dacc2b6f
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_
8 #include <map>
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"
14 class PrefService;
16 class PortForwardingController : public BrowserContextKeyedService {
17 public:
18 explicit PortForwardingController(PrefService* pref_service);
20 virtual ~PortForwardingController();
22 class Factory : public BrowserContextKeyedServiceFactory {
23 public:
24 // Returns singleton instance of Factory.
25 static Factory* GetInstance();
27 // Returns PortForwardingController associated with |profile|.
28 static PortForwardingController* GetForProfile(Profile* profile);
30 private:
31 friend struct DefaultSingletonTraits<Factory>;
33 Factory();
34 virtual ~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);
49 private:
50 class Connection;
51 typedef std::map<std::string, Connection* > Registry;
53 scoped_refptr<RefCountedAdbThread> adb_thread_;
54 PrefService* pref_service_;
55 Registry registry_;
57 DISALLOW_COPY_AND_ASSIGN(PortForwardingController);
60 #endif // CHROME_BROWSER_DEVTOOLS_PORT_FORWARDING_CONTROLLER_H_