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

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

Issue 2843773002: HeadlessWebContents Observers for devtools clients attaching/detatching (Closed)
Patch Set: 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
« no previous file with comments | « headless/lib/browser/headless_web_contents_impl.h ('k') | headless/public/headless_web_contents.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..94a7442fdee46dfbe1e34742e587826aa89ec87f 100644
--- a/headless/lib/browser/headless_web_contents_impl.cc
+++ b/headless/lib/browser/headless_web_contents_impl.cc
@@ -192,9 +192,12 @@ HeadlessWebContentsImpl::HeadlessWebContentsImpl(
#endif
web_contents_->SetDelegate(web_contents_delegate_.get());
render_process_host_->AddObserver(this);
+ agent_host_->AddObserver(this);
}
HeadlessWebContentsImpl::~HeadlessWebContentsImpl() {
+ if (agent_host_)
Sami 2017/04/25 18:31:12 agent_host_ should always be non-null, right?
alex clarke (OOO till 29th) 2017/04/26 08:11:07 Done.
+ agent_host_->RemoveObserver(this);
if (render_process_host_)
render_process_host_->RemoveObserver(this);
}
@@ -277,6 +280,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()->DevToolsClientDettached();
Sami 2017/04/25 18:31:12 typo: Detached
alex clarke (OOO till 29th) 2017/04/26 08:11:07 Done.
+ }
+}
+
void HeadlessWebContentsImpl::RenderProcessExited(
content::RenderProcessHost* host,
base::TerminationStatus status,
« no previous file with comments | « headless/lib/browser/headless_web_contents_impl.h ('k') | headless/public/headless_web_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698