DevTools: migrate DevTools APIs to use WebContents instead of RenderViewHost.
[email protected], [email protected]
TBR=extensions) for simple RVH -> WebContents migration call sites., kalman (apps, mnaganov (android_webview)
NOTRY=true
Review URL: https://codereview.chromium.org/442303002
Cr-Commit-Position: refs/heads/master@{#288297}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288297 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc
index 4e02a8d..aaf3b9411 100644
--- a/chrome/browser/extensions/api/debugger/debugger_api.cc
+++ b/chrome/browser/extensions/api/debugger/debugger_api.cc
@@ -162,7 +162,7 @@
// Creates an extension dev tools infobar and delegate and adds the infobar to
// the InfoBarService associated with |rvh|. Returns the infobar if it was
// successfully added.
- static infobars::InfoBar* Create(RenderViewHost* rvh,
+ static infobars::InfoBar* Create(WebContents* web_contents,
const std::string& client_name);
void set_client_host(ExtensionDevToolsClientHost* client_host) {
@@ -190,12 +190,8 @@
// static
infobars::InfoBar* ExtensionDevToolsInfoBarDelegate::Create(
- RenderViewHost* rvh,
+ WebContents* web_contents,
const std::string& client_name) {
- if (!rvh)
- return NULL;
-
- WebContents* web_contents = WebContents::FromRenderViewHost(rvh);
if (!web_contents)
return NULL;
@@ -345,10 +341,10 @@
static_cast<ExtensionDevToolsInfoBarDelegate*>(
infobar_->delegate())->set_client_host(this);
registrar_.Add(
- this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED,
- content::Source<InfoBarService>(InfoBarService::FromWebContents(
- WebContents::FromRenderViewHost(
- agent_host_->GetRenderViewHost()))));
+ this,
+ chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED,
+ content::Source<InfoBarService>(
+ InfoBarService::FromWebContents(agent_host_->GetWebContents())));
}
}
@@ -360,8 +356,8 @@
if (infobar_) {
static_cast<ExtensionDevToolsInfoBarDelegate*>(
infobar_->delegate())->set_client_host(NULL);
- InfoBarService* infobar_service = InfoBarService::FromWebContents(
- WebContents::FromRenderViewHost(agent_host_->GetRenderViewHost()));
+ InfoBarService* infobar_service =
+ InfoBarService::FromWebContents(agent_host_->GetWebContents());
infobar_service->RemoveInfoBar(infobar_);
}
AttachedClientHosts::GetInstance()->Remove(this);
@@ -535,8 +531,8 @@
&error_)) {
return false;
}
- agent_host_ = DevToolsAgentHost::GetOrCreateFor(
- extension_host->render_view_host());
+ agent_host_ =
+ DevToolsAgentHost::GetOrCreateFor(extension_host->host_contents());
}
} else if (debuggee_.target_id) {
agent_host_ = DevToolsAgentHost::GetForId(*debuggee_.target_id);
@@ -602,7 +598,7 @@
// Do not attach to the target if for any reason the infobar cannot be shown
// for this WebContents instance.
infobar = ExtensionDevToolsInfoBarDelegate::Create(
- agent_host_->GetRenderViewHost(), extension()->name());
+ agent_host_->GetWebContents(), extension()->name());
if (!infobar) {
error_ = ErrorUtils::FormatErrorMessage(
keys::kSilentDebuggingRequired,