| Index: android_webview/native/aw_dev_tools_server.cc
|
| diff --git a/android_webview/native/aw_dev_tools_server.cc b/android_webview/native/aw_dev_tools_server.cc
|
| index 90b72d18a441113b584515e13742b6c541463475..6ff801b3d096d9bcdcbd40321a5c92308c7f5740 100644
|
| --- a/android_webview/native/aw_dev_tools_server.cc
|
| +++ b/android_webview/native/aw_dev_tools_server.cc
|
| @@ -32,12 +32,13 @@ const char kFrontEndURL[] =
|
| const char kSocketNameFormat[] = "webview_devtools_remote_%d";
|
|
|
| const char kTargetTypePage[] = "page";
|
| +const char kTargetTypeOther[] = "other";
|
|
|
| std::string GetViewDescription(WebContents* web_contents);
|
|
|
| class Target : public content::DevToolsTarget {
|
| public:
|
| - explicit Target(WebContents* web_contents);
|
| + explicit Target(scoped_refptr<DevToolsAgentHost> agent_host);
|
|
|
| virtual std::string GetId() const OVERRIDE { return id_; }
|
| virtual std::string GetParentId() const OVERRIDE { return std::string(); }
|
| @@ -61,20 +62,24 @@ class Target : public content::DevToolsTarget {
|
| private:
|
| scoped_refptr<DevToolsAgentHost> agent_host_;
|
| std::string id_;
|
| + std::string type_;
|
| std::string title_;
|
| std::string description_;
|
| GURL url_;
|
| base::TimeTicks last_activity_time_;
|
| };
|
|
|
| -Target::Target(WebContents* web_contents) {
|
| - agent_host_ =
|
| - DevToolsAgentHost::GetOrCreateFor(web_contents);
|
| - id_ = agent_host_->GetId();
|
| - description_ = GetViewDescription(web_contents);
|
| - title_ = base::UTF16ToUTF8(web_contents->GetTitle());
|
| - url_ = web_contents->GetURL();
|
| - last_activity_time_ = web_contents->GetLastActiveTime();
|
| +Target::Target(scoped_refptr<DevToolsAgentHost> agent_host)
|
| + : agent_host_(agent_host),
|
| + id_(agent_host_->GetId()),
|
| + type_(kTargetTypeOther),
|
| + url_(agent_host_->GetURL()) {
|
| + if (WebContents* web_contents = agent_host->GetWebContents()) {
|
| + description_ = GetViewDescription(web_contents);
|
| + title_ = base::UTF16ToUTF8(web_contents->GetTitle());
|
| + last_activity_time_ = web_contents->GetLastActiveTime();
|
| + type_ = kTargetTypePage;
|
| + }
|
| }
|
|
|
| // Delegate implementation for the devtools http handler for WebView. A new
|
| @@ -106,10 +111,9 @@ class AwDevToolsServerDelegate : public content::DevToolsHttpHandlerDelegate {
|
|
|
| virtual void EnumerateTargets(TargetCallback callback) OVERRIDE {
|
| TargetList targets;
|
| - std::vector<WebContents*> wc_list =
|
| - DevToolsAgentHost::GetInspectableWebContents();
|
| - for (std::vector<WebContents*>::iterator it = wc_list.begin();
|
| - it != wc_list.end(); ++it) {
|
| + DevToolsAgentHost::List agents = DevToolsAgentHost::GetOrCreateAll();
|
| + for (DevToolsAgentHost::List::iterator it = agents.begin();
|
| + it != agents.end(); ++it) {
|
| targets.push_back(new Target(*it));
|
| }
|
| callback.Run(targets);
|
|
|