Index: content/browser/devtools/devtools_manager.h |
diff --git a/content/browser/devtools/devtools_manager.h b/content/browser/devtools/devtools_manager.h |
index 2ae7049ed41fc8819242a0e4b566155d90a9e02b..a053dcda6d7de78d0de0be71f1d1a6a421ae788b 100644 |
--- a/content/browser/devtools/devtools_manager.h |
+++ b/content/browser/devtools/devtools_manager.h |
@@ -6,10 +6,12 @@ |
#define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_H_ |
#include <memory> |
+#include <set> |
#include "base/compiler_specific.h" |
#include "base/macros.h" |
#include "base/memory/singleton.h" |
+#include "base/observer_list.h" |
#include "content/common/content_export.h" |
#include "content/public/browser/devtools_manager_delegate.h" |
@@ -17,21 +19,34 @@ namespace content { |
class DevToolsAgentHostImpl; |
class DevToolsHttpHandler; |
+class WebContentsImpl; |
// This class is a singleton that manage global DevTools state for the whole |
// browser. |
-// TODO(dgozman): remove this class entirely. |
class CONTENT_EXPORT DevToolsManager { |
public: |
// Returns single instance of this class. The instance is destroyed on the |
// browser main loop exit so this method MUST NOT be called after that point. |
static DevToolsManager* GetInstance(); |
+ class Observer { |
+ public: |
+ virtual void AgentHostCreated(DevToolsAgentHostImpl* agent_host) {} |
+ virtual void AgentHostDestroyed(DevToolsAgentHostImpl* agent_host) {} |
+ virtual ~Observer() {} |
+ }; |
+ |
DevToolsManager(); |
virtual ~DevToolsManager(); |
- DevToolsManagerDelegate* delegate() const { return delegate_.get(); } |
+ void AddObserver(Observer* observer); |
+ void RemoveObserver(Observer* observer); |
+ |
+ DevToolsManagerDelegate* GetDelegate(); |
+ void WebContentsCreated(WebContentsImpl* web_contents); |
pfeldman
2016/10/12 23:11:18
These seem random / hacky.
dgozman
2016/10/12 23:23:12
Any ideas?
|
+ void AgentHostCreated(DevToolsAgentHostImpl* agent_host); |
+ void AgentHostDestroyed(DevToolsAgentHostImpl* agent_host); |
void AgentHostStateChanged(DevToolsAgentHostImpl* agent_host, bool attached); |
void SetHttpHandler(std::unique_ptr<DevToolsHttpHandler> http_handler); |
@@ -39,9 +54,12 @@ class CONTENT_EXPORT DevToolsManager { |
private: |
friend struct base::DefaultSingletonTraits<DevToolsManager>; |
+ bool delegate_initialized_; |
std::unique_ptr<DevToolsManagerDelegate> delegate_; |
std::unique_ptr<DevToolsHttpHandler> http_handler_; |
int attached_hosts_count_; |
+ std::set<DevToolsAgentHostImpl*> agent_hosts_; |
+ base::ObserverList<Observer> observers_; |
DISALLOW_COPY_AND_ASSIGN(DevToolsManager); |
}; |