Chromium Code Reviews| Index: content/public/browser/devtools_target_list.h |
| diff --git a/content/public/browser/devtools_target_list.h b/content/public/browser/devtools_target_list.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b60921cd90d9f7e29a5229cf4030fac99e423631 |
| --- /dev/null |
| +++ b/content/public/browser/devtools_target_list.h |
| @@ -0,0 +1,57 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_TARGET_LIST_H_ |
| +#define CONTENT_PUBLIC_BROWSER_DEVTOOLS_TARGET_LIST_H_ |
| + |
| +#include <map> |
| +#include <string> |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "content/common/content_export.h" |
| + |
| +namespace content { |
| + |
| +class DevToolsAgentHost; |
| + |
| +// Interface responsible for mapping DevToolsAgentHost instances to/from |
| +// string identifiers. |
| +class CONTENT_EXPORT DevToolsAgentHostBinding { |
| + public: |
| + virtual ~DevToolsAgentHostBinding() {} |
| + |
| + // Returns the mapping of DevToolsAgentHost to identifier. |
| + virtual std::string GetIdentifier(DevToolsAgentHost* agent_host) = 0; |
| + |
| + // Returns the mapping of identifier to DevToolsAgentHost. |
| + virtual DevToolsAgentHost* ForIdentifier(const std::string& id) = 0; |
| +}; |
| + |
| +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
|
| + public: |
| + static DevToolsTargetList* GetInstance(); |
| + |
| + virtual ~DevToolsTargetList() {}; |
| + |
| + typedef std::map<std::string, scoped_refptr<DevToolsAgentHost> > AgentsMap; |
| + typedef AgentsMap::iterator iterator; |
| + |
| + AgentsMap& GetAgentsMap(); |
| + |
| + // DevToolsAgentHostBinding implementation. |
| + virtual std::string GetIdentifier(DevToolsAgentHost* agent_host) OVERRIDE; |
| + |
| + virtual DevToolsAgentHost* ForIdentifier(const std::string& id) OVERRIDE; |
| + |
| + private: |
| + AgentsMap agents_map_; |
| + |
| + void GarbageCollect(); |
| + |
| + std::string UpdateMap(DevToolsAgentHost* agent_host); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_TARGET_LIST_H_ |