Index: android_webview/browser/aw_dev_tools_discovery_provider.cc |
diff --git a/android_webview/browser/aw_dev_tools_discovery_provider.cc b/android_webview/browser/aw_dev_tools_discovery_provider.cc |
index 82b746c7633bfb3c3f117891feb5c89d9de766a3..96cab3f708f4ec4ff91f9fbbbaaa709768264032 100644 |
--- a/android_webview/browser/aw_dev_tools_discovery_provider.cc |
+++ b/android_webview/browser/aw_dev_tools_discovery_provider.cc |
@@ -40,6 +40,25 @@ |
return json; |
} |
+class TargetDescriptor : public devtools_discovery::BasicTargetDescriptor { |
+ public: |
+ explicit TargetDescriptor(scoped_refptr<DevToolsAgentHost> agent_host); |
+ |
+ // devtools_discovery::BasicTargetDescriptor overrides. |
+ std::string GetDescription() const override { return description_; } |
+ |
+ private: |
+ std::string description_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TargetDescriptor); |
+}; |
+ |
+TargetDescriptor::TargetDescriptor(scoped_refptr<DevToolsAgentHost> agent_host) |
+ : BasicTargetDescriptor(agent_host) { |
+ if (WebContents* web_contents = agent_host->GetWebContents()) |
+ description_ = GetViewDescription(web_contents); |
+} |
+ |
} // namespace |
namespace android_webview { |
@@ -63,11 +82,8 @@ |
DevToolsAgentHost::List agent_hosts = DevToolsAgentHost::GetOrCreateAll(); |
devtools_discovery::DevToolsTargetDescriptor::List result; |
result.reserve(agent_hosts.size()); |
- for (auto& agent_host : agent_hosts) { |
- agent_host->SetDescriptionOverride( |
- GetViewDescription(agent_host->GetWebContents())); |
- result.push_back(new devtools_discovery::BasicTargetDescriptor(agent_host)); |
- } |
+ for (const auto& agent_host : agent_hosts) |
+ result.push_back(new TargetDescriptor(agent_host)); |
return result; |
} |