| 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 2768f8b7e60189e6fdc3181c1436a6beee8c31b4..0f4214f1d42367d51e1edefa89f2d1dd82234b57 100644
|
| --- a/content/shell/browser/shell_devtools_delegate.cc
|
| +++ b/content/shell/browser/shell_devtools_delegate.cc
|
| @@ -107,8 +107,7 @@ class Target : public content::DevToolsTarget {
|
| };
|
|
|
| Target::Target(WebContents* web_contents) {
|
| - agent_host_ =
|
| - DevToolsAgentHost::GetOrCreateFor(web_contents->GetRenderViewHost());
|
| + agent_host_ = DevToolsAgentHost::GetOrCreateFor(web_contents);
|
| id_ = agent_host_->GetId();
|
| title_ = base::UTF16ToUTF8(web_contents->GetTitle());
|
| url_ = web_contents->GetURL();
|
| @@ -120,10 +119,7 @@ Target::Target(WebContents* web_contents) {
|
| }
|
|
|
| bool Target::Activate() const {
|
| - RenderViewHost* rvh = agent_host_->GetRenderViewHost();
|
| - if (!rvh)
|
| - return false;
|
| - WebContents* web_contents = WebContents::FromRenderViewHost(rvh);
|
| + WebContents* web_contents = agent_host_->GetWebContents();
|
| if (!web_contents)
|
| return false;
|
| web_contents->GetDelegate()->ActivateContents(web_contents);
|
| @@ -131,10 +127,10 @@ bool Target::Activate() const {
|
| }
|
|
|
| bool Target::Close() const {
|
| - RenderViewHost* rvh = agent_host_->GetRenderViewHost();
|
| - if (!rvh)
|
| + WebContents* web_contents = agent_host_->GetWebContents();
|
| + if (!web_contents)
|
| return false;
|
| - rvh->ClosePage();
|
| + web_contents->GetRenderViewHost()->ClosePage();
|
| return true;
|
| }
|
|
|
| @@ -198,13 +194,12 @@ ShellDevToolsDelegate::CreateNewTarget(const GURL& url) {
|
|
|
| void ShellDevToolsDelegate::EnumerateTargets(TargetCallback callback) {
|
| TargetList targets;
|
| - std::vector<RenderViewHost*> rvh_list =
|
| - content::DevToolsAgentHost::GetValidRenderViewHosts();
|
| - for (std::vector<RenderViewHost*>::iterator it = rvh_list.begin();
|
| - it != rvh_list.end(); ++it) {
|
| - WebContents* web_contents = WebContents::FromRenderViewHost(*it);
|
| - if (web_contents)
|
| - targets.push_back(new Target(web_contents));
|
| + std::vector<WebContents*> wc_list =
|
| + content::DevToolsAgentHost::GetInspectableWebContents();
|
| + for (std::vector<WebContents*>::iterator it = wc_list.begin();
|
| + it != wc_list.end();
|
| + ++it) {
|
| + targets.push_back(new Target(*it));
|
| }
|
| callback.Run(targets);
|
| }
|
|
|