| Index: content/shell/browser/shell_devtools_delegate.cc
|
| diff --git a/content/shell/browser/shell_devtools_delegate.cc b/content/shell/browser/shell_devtools_delegate.cc
|
| index 0f4214f1d42367d51e1edefa89f2d1dd82234b57..89983cbaa3744aa22b6c5fa6ed5365bf7e1dfcde 100644
|
| --- a/content/shell/browser/shell_devtools_delegate.cc
|
| +++ b/content/shell/browser/shell_devtools_delegate.cc
|
| @@ -43,6 +43,7 @@ const char kFrontEndURL[] =
|
| "http://chrome-devtools-frontend.appspot.com/serve_rev/%s/devtools.html";
|
| #endif
|
| const char kTargetTypePage[] = "page";
|
| +const char kTargetTypeOther[] = "other";
|
|
|
| net::StreamListenSocketFactory* CreateSocketFactory() {
|
| const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
| @@ -76,7 +77,7 @@ net::StreamListenSocketFactory* CreateSocketFactory() {
|
|
|
| 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(); }
|
| @@ -100,22 +101,27 @@ class Target : public content::DevToolsTarget {
|
| private:
|
| scoped_refptr<DevToolsAgentHost> agent_host_;
|
| std::string id_;
|
| + std::string type_;
|
| std::string title_;
|
| GURL url_;
|
| GURL favicon_url_;
|
| base::TimeTicks last_activity_time_;
|
| };
|
|
|
| -Target::Target(WebContents* web_contents) {
|
| - agent_host_ = DevToolsAgentHost::GetOrCreateFor(web_contents);
|
| - id_ = agent_host_->GetId();
|
| - title_ = base::UTF16ToUTF8(web_contents->GetTitle());
|
| - url_ = web_contents->GetURL();
|
| - content::NavigationController& controller = web_contents->GetController();
|
| - content::NavigationEntry* entry = controller.GetActiveEntry();
|
| - if (entry != NULL && entry->GetURL().is_valid())
|
| - favicon_url_ = entry->GetFavicon().url;
|
| - 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()) {
|
| + title_ = base::UTF16ToUTF8(web_contents->GetTitle());
|
| + content::NavigationController& controller = web_contents->GetController();
|
| + content::NavigationEntry* entry = controller.GetActiveEntry();
|
| + if (entry != NULL && entry->GetURL().is_valid())
|
| + favicon_url_ = entry->GetFavicon().url;
|
| + last_activity_time_ = web_contents->GetLastActiveTime();
|
| + type_ = kTargetTypePage;
|
| + }
|
| }
|
|
|
| bool Target::Activate() const {
|
| @@ -189,16 +195,16 @@ ShellDevToolsDelegate::CreateNewTarget(const GURL& url) {
|
| NULL,
|
| MSG_ROUTING_NONE,
|
| gfx::Size());
|
| - return scoped_ptr<DevToolsTarget>(new Target(shell->web_contents()));
|
| + return scoped_ptr<DevToolsTarget>(
|
| + new Target(DevToolsAgentHost::GetOrCreateFor(shell->web_contents())));
|
| }
|
|
|
| void ShellDevToolsDelegate::EnumerateTargets(TargetCallback callback) {
|
| TargetList targets;
|
| - std::vector<WebContents*> wc_list =
|
| - content::DevToolsAgentHost::GetInspectableWebContents();
|
| - for (std::vector<WebContents*>::iterator it = wc_list.begin();
|
| - it != wc_list.end();
|
| - ++it) {
|
| + content::DevToolsAgentHost::List agents =
|
| + content::DevToolsAgentHost::GetOrCreateAll();
|
| + for (content::DevToolsAgentHost::List::iterator it = agents.begin();
|
| + it != agents.end(); ++it) {
|
| targets.push_back(new Target(*it));
|
| }
|
| callback.Run(targets);
|
|
|