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

Unified Diff: content/browser/devtools/protocol/target_handler.cc

Issue 2956423003: [DevTools] Provide Target.targetInfoChanged notification (Closed)
Patch Set: Created 3 years, 6 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: content/browser/devtools/protocol/target_handler.cc
diff --git a/content/browser/devtools/protocol/target_handler.cc b/content/browser/devtools/protocol/target_handler.cc
index dd1b8b8b67493134a9e17ee0a817c202e9bfc311..2cbdaffc5b454e2a2de8c5db7eff17084b33ad32 100644
--- a/content/browser/devtools/protocol/target_handler.cc
+++ b/content/browser/devtools/protocol/target_handler.cc
@@ -89,6 +89,7 @@ std::unique_ptr<Target::TargetInfo> CreateInfo(DevToolsAgentHost* host) {
.SetTitle(host->GetTitle())
.SetUrl(host->GetURL().spec())
.SetType(host->GetType())
+ .SetAttached(host->IsAttached())
.Build();
}
@@ -213,8 +214,13 @@ void TargetHandler::TargetCreatedInternal(DevToolsAgentHost* host) {
reported_hosts_[host->GetId()] = host;
}
-void TargetHandler::TargetDestroyedInternal(
- DevToolsAgentHost* host) {
+void TargetHandler::TargetInfoChangedInternal(DevToolsAgentHost* host) {
+ if (reported_hosts_.find(host->GetId()) == reported_hosts_.end())
+ return;
+ frontend_->TargetInfoChanged(CreateInfo(host));
+}
+
+void TargetHandler::TargetDestroyedInternal(DevToolsAgentHost* host) {
auto it = reported_hosts_.find(host->GetId());
if (it == reported_hosts_.end())
return;
@@ -419,8 +425,6 @@ bool TargetHandler::ShouldForceDevToolsAgentHostCreation() {
}
void TargetHandler::DevToolsAgentHostCreated(DevToolsAgentHost* agent_host) {
- if (agent_host->GetType() == "node" && agent_host->IsAttached())
- return;
// If we start discovering late, all existing agent hosts will be reported,
// but we could have already attached to some.
TargetCreatedInternal(agent_host);
@@ -432,19 +436,11 @@ void TargetHandler::DevToolsAgentHostDestroyed(DevToolsAgentHost* agent_host) {
}
void TargetHandler::DevToolsAgentHostAttached(DevToolsAgentHost* host) {
- if (host->GetType() == "node" &&
- reported_hosts_.find(host->GetId()) != reported_hosts_.end() &&
- attached_hosts_.find(host->GetId()) == attached_hosts_.end()) {
- TargetDestroyedInternal(host);
- }
+ TargetInfoChangedInternal(host);
}
void TargetHandler::DevToolsAgentHostDetached(DevToolsAgentHost* host) {
- if (host->GetType() == "node" &&
- reported_hosts_.find(host->GetId()) == reported_hosts_.end() &&
- attached_hosts_.find(host->GetId()) == attached_hosts_.end()) {
- TargetCreatedInternal(host);
- }
+ TargetInfoChangedInternal(host);
}
// -------- ServiceWorkerDevToolsManager::Observer ----------

Powered by Google App Engine
This is Rietveld 408576698