Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: chrome/browser/android/dev_tools_server.cc

Issue 442303002: DevTools: migrate DevTools APIs to use WebContents instead of RenderViewHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for landing Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « apps/app_window_registry.cc ('k') | chrome/browser/apps/app_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « apps/app_window_registry.cc ('k') | chrome/browser/apps/app_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698