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

Unified Diff: chrome/browser/renderer_host/chrome_render_view_host_observer.cc

Issue 10113005: Remove EPM:all_hosts_ and use all_extension_views_ instead. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: interactive_ui_tests Created 8 years, 8 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
Index: chrome/browser/renderer_host/chrome_render_view_host_observer.cc
diff --git a/chrome/browser/renderer_host/chrome_render_view_host_observer.cc b/chrome/browser/renderer_host/chrome_render_view_host_observer.cc
index a0642846fef1e6e0e5d1d8bf8f96cd065342618b..4380ca28f38be0e107ad0c9e0852ebf884aff326 100644
--- a/chrome/browser/renderer_host/chrome_render_view_host_observer.cc
+++ b/chrome/browser/renderer_host/chrome_render_view_host_observer.cc
@@ -19,6 +19,8 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_view_host_delegate.h"
#include "content/public/browser/site_instance.h"
+#include "content/public/browser/web_contents.h"
+#include "content/browser/web_contents/web_contents_impl.h"
benwells 2012/04/19 11:34:02 This causes a build error due to an illegal depend
using content::ChildProcessSecurityPolicy;
using content::RenderViewHost;
@@ -85,7 +87,9 @@ void ChromeRenderViewHostObserver::InitRenderViewHostForExtensions() {
CHECK(process_manager);
// TODO(creis): Use this to replace SetInstalledAppForRenderer.
- process_manager->RegisterRenderViewHost(render_view_host(), extension);
+ content::WebContents* contents = GetWebContents(render_view_host());
+ if (contents)
+ process_manager->RegisterWebContents(contents, extension);
if (extension->is_app()) {
// Record which, if any, installed app is associated with this process.
@@ -169,10 +173,26 @@ const Extension* ChromeRenderViewHostObserver::GetExtension() {
void ChromeRenderViewHostObserver::RemoveRenderViewHostForExtensions(
RenderViewHost* rvh) {
+ content::WebContents* contents = GetWebContents(rvh);
+ if (!contents)
+ return;
+
ExtensionProcessManager* process_manager =
profile_->GetExtensionProcessManager();
if (process_manager)
- process_manager->UnregisterRenderViewHost(rvh);
+ process_manager->UnregisterWebContents(contents);
Charlie Reis 2012/04/19 21:42:10 I don't think this will get called if you navigate
+}
+
+content::WebContents* ChromeRenderViewHostObserver::GetWebContents(
+ RenderViewHost* rvh) {
+ // TODO(benwells): Remove this hack. Instead registration should
+ // be made by the view owning the WebContents (e.g. ShellWindow),
+ // or we go back to registering RenderViewHosts and expose their
+ // is_loading field.
+ content::ViewType view_type = rvh->GetDelegate()->GetRenderViewType();
+ if (view_type == content::VIEW_TYPE_WEB_CONTENTS)
+ return static_cast<WebContentsImpl*>(rvh->GetDelegate());
benwells 2012/04/19 11:34:02 How should I do this correctly? If I use reinterp
Matt Perry 2012/04/19 20:53:19 You're having trouble here because you're trying t
+ return NULL;
}
void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() {

Powered by Google App Engine
This is Rietveld 408576698