Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(529)

Unified Diff: headless/lib/browser/headless_web_contents_impl.cc

Issue 2843773002: HeadlessWebContents Observers for devtools clients attaching/detatching (Closed)
Patch Set: Added a test Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: headless/lib/browser/headless_web_contents_impl.cc
diff --git a/headless/lib/browser/headless_web_contents_impl.cc b/headless/lib/browser/headless_web_contents_impl.cc
index aea5aefc8f15bce048c19a4e765d00e8884c8c0e..07492082253fda0adb7a0c103042b449294941c1 100644
--- a/headless/lib/browser/headless_web_contents_impl.cc
+++ b/headless/lib/browser/headless_web_contents_impl.cc
@@ -192,9 +192,11 @@ HeadlessWebContentsImpl::HeadlessWebContentsImpl(
#endif
web_contents_->SetDelegate(web_contents_delegate_.get());
render_process_host_->AddObserver(this);
+ agent_host_->AddObserver(this);
}
HeadlessWebContentsImpl::~HeadlessWebContentsImpl() {
+ agent_host_->RemoveObserver(this);
if (render_process_host_)
render_process_host_->RemoveObserver(this);
}
@@ -277,6 +279,20 @@ void HeadlessWebContentsImpl::RemoveObserver(Observer* observer) {
observer_map_.erase(it);
}
+void HeadlessWebContentsImpl::DevToolsAgentHostAttached(
+ content::DevToolsAgentHost* agent_host) {
+ for (const auto& pair : observer_map_) {
+ pair.second->observer()->DevToolsClientAttached();
+ }
+}
+
+void HeadlessWebContentsImpl::DevToolsAgentHostDetached(
+ content::DevToolsAgentHost* agent_host) {
+ for (const auto& pair : observer_map_) {
+ pair.second->observer()->DevToolsClientDetached();
+ }
+}
+
void HeadlessWebContentsImpl::RenderProcessExited(
content::RenderProcessHost* host,
base::TerminationStatus status,
« no previous file with comments | « headless/lib/browser/headless_web_contents_impl.h ('k') | headless/lib/headless_devtools_client_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698