| Index: chrome/browser/android/dev_tools_server.cc
|
| diff --git a/chrome/browser/android/dev_tools_server.cc b/chrome/browser/android/dev_tools_server.cc
|
| index acdb6b589d5bd7225c51eeb82d05122367aeb6f8..040f11b8cbd40ce1392a8ec53f9c8c62a8a14b29 100644
|
| --- a/chrome/browser/android/dev_tools_server.cc
|
| +++ b/chrome/browser/android/dev_tools_server.cc
|
| @@ -159,8 +159,7 @@ class TabTarget : public TargetBase {
|
| if (!web_contents)
|
| return NULL;
|
| }
|
| - RenderViewHost* rvh = web_contents->GetRenderViewHost();
|
| - return rvh ? DevToolsAgentHost::GetOrCreateFor(rvh) : NULL;
|
| + return DevToolsAgentHost::GetOrCreateFor(web_contents);
|
| }
|
|
|
| virtual bool Activate() const OVERRIDE {
|
| @@ -215,8 +214,7 @@ class NonTabTarget : public TargetBase {
|
| public:
|
| explicit NonTabTarget(WebContents* web_contents)
|
| : TargetBase(web_contents),
|
| - agent_host_(DevToolsAgentHost::GetOrCreateFor(
|
| - web_contents->GetRenderViewHost())) {
|
| + agent_host_(DevToolsAgentHost::GetOrCreateFor(web_contents)) {
|
| }
|
|
|
| // content::DevToolsTarget implementation:
|
| @@ -242,10 +240,7 @@ class NonTabTarget : public TargetBase {
|
| }
|
|
|
| virtual bool Activate() const OVERRIDE {
|
| - 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);
|
| @@ -253,10 +248,10 @@ class NonTabTarget : public TargetBase {
|
| }
|
|
|
| virtual bool Close() const OVERRIDE {
|
| - 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;
|
| }
|
|
|
| @@ -346,16 +341,14 @@ class DevToolsServerDelegate : public content::DevToolsHttpHandlerDelegate {
|
| }
|
|
|
| // Add targets for WebContents not associated with any tabs.
|
| - std::vector<RenderViewHost*> rvh_list =
|
| - 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)
|
| - continue;
|
| - if (tab_web_contents.find(web_contents) != tab_web_contents.end())
|
| + std::vector<WebContents*> wc_list =
|
| + DevToolsAgentHost::GetInspectableWebContents();
|
| + for (std::vector<WebContents*>::iterator it = wc_list.begin();
|
| + it != wc_list.end();
|
| + ++it) {
|
| + if (tab_web_contents.find(*it) != tab_web_contents.end())
|
| continue;
|
| - targets.push_back(new NonTabTarget(web_contents));
|
| + targets.push_back(new NonTabTarget(*it));
|
| }
|
|
|
| callback.Run(targets);
|
|
|