Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 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. | |
| 4 | |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_TARGET_LIST_H_ | |
| 6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_TARGET_LIST_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "content/common/content_export.h" | |
| 13 | |
| 14 namespace content { | |
| 15 | |
| 16 class DevToolsAgentHost; | |
| 17 | |
| 18 // Interface responsible for mapping DevToolsAgentHost instances to/from | |
| 19 // string identifiers. | |
| 20 class CONTENT_EXPORT DevToolsAgentHostBinding { | |
| 21 public: | |
| 22 virtual ~DevToolsAgentHostBinding() {} | |
| 23 | |
| 24 // Returns the mapping of DevToolsAgentHost to identifier. | |
| 25 virtual std::string GetIdentifier(DevToolsAgentHost* agent_host) = 0; | |
| 26 | |
| 27 // Returns the mapping of identifier to DevToolsAgentHost. | |
| 28 virtual DevToolsAgentHost* ForIdentifier(const std::string& id) = 0; | |
| 29 }; | |
| 30 | |
| 31 class CONTENT_EXPORT DevToolsTargetList : public DevToolsAgentHostBinding { | |
|
pfeldman
2013/03/01 08:49:30
I think these serve slightly different reasons and
Vladislav Kaznacheev
2013/03/01 12:58:35
Left DevToolsAgentHostBinding where it was, made D
| |
| 32 public: | |
| 33 static DevToolsTargetList* GetInstance(); | |
| 34 | |
| 35 virtual ~DevToolsTargetList() {}; | |
| 36 | |
| 37 typedef std::map<std::string, scoped_refptr<DevToolsAgentHost> > AgentsMap; | |
| 38 typedef AgentsMap::iterator iterator; | |
| 39 | |
| 40 AgentsMap& GetAgentsMap(); | |
| 41 | |
| 42 // DevToolsAgentHostBinding implementation. | |
| 43 virtual std::string GetIdentifier(DevToolsAgentHost* agent_host) OVERRIDE; | |
| 44 | |
| 45 virtual DevToolsAgentHost* ForIdentifier(const std::string& id) OVERRIDE; | |
| 46 | |
| 47 private: | |
| 48 AgentsMap agents_map_; | |
| 49 | |
| 50 void GarbageCollect(); | |
| 51 | |
| 52 std::string UpdateMap(DevToolsAgentHost* agent_host); | |
| 53 }; | |
| 54 | |
| 55 } // namespace content | |
| 56 | |
| 57 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_TARGET_LIST_H_ | |
| OLD | NEW |