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

Unified Diff: chrome/browser/extensions/extension_process_manager.cc

Issue 23618036: Merge NOTIFICATION_RENDER_VIEW_HOST_CHANGED into NOTIFICATION_WEB_CONTENTS_SWAPPED. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 2 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/shell_window.cc ('k') | chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_process_manager.cc
diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc
index d3163c7d5f08b005b11f7dcf3d014bcc530799c1..b86df25e4bf5a66caad6e1824bb24a6b534ab020 100644
--- a/chrome/browser/extensions/extension_process_manager.cc
+++ b/chrome/browser/extensions/extension_process_manager.cc
@@ -163,7 +163,7 @@ ExtensionProcessManager::ExtensionProcessManager(Profile* profile)
content::Source<Profile>(profile));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
content::Source<Profile>(profile));
- registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_SWAPPED,
+ registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
content::NotificationService::AllSources());
registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED,
content::NotificationService::AllSources());
@@ -350,7 +350,7 @@ std::set<RenderViewHost*>
}
const Extension* ExtensionProcessManager::GetExtensionForRenderViewHost(
- content::RenderViewHost* render_view_host) {
+ RenderViewHost* render_view_host) {
if (!render_view_host->GetSiteInstance())
return NULL;
@@ -640,28 +640,26 @@ void ExtensionProcessManager::Observe(
break;
}
- case content::NOTIFICATION_WEB_CONTENTS_SWAPPED: {
+ case content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED: {
// We get this notification both for new WebContents and when one
// has its RenderViewHost replaced (e.g. when a user does a cross-site
// navigation away from an extension URL). For the replaced case, we must
// unregister the old RVH so it doesn't count as an active view that would
// keep the event page alive.
- content::WebContents* contents =
- content::Source<content::WebContents>(source).ptr();
+ WebContents* contents = content::Source<WebContents>(source).ptr();
if (contents->GetBrowserContext() != GetProfile())
break;
- content::RenderViewHost* old_render_view_host =
- content::Details<content::RenderViewHost>(details).ptr();
- if (old_render_view_host)
- UnregisterRenderViewHost(old_render_view_host);
- RegisterRenderViewHost(contents->GetRenderViewHost());
+ typedef std::pair<RenderViewHost*, RenderViewHost*> RVHPair;
+ RVHPair* switched_details = content::Details<RVHPair>(details).ptr();
+ if (switched_details->first)
+ UnregisterRenderViewHost(switched_details->first);
+ RegisterRenderViewHost(switched_details->second);
break;
}
case content::NOTIFICATION_WEB_CONTENTS_CONNECTED: {
- content::WebContents* contents =
- content::Source<content::WebContents>(source).ptr();
+ WebContents* contents = content::Source<WebContents>(source).ptr();
if (contents->GetBrowserContext() != GetProfile())
break;
const Extension* extension = GetExtensionForRenderViewHost(
@@ -693,7 +691,7 @@ void ExtensionProcessManager::Observe(
void ExtensionProcessManager::OnDevToolsStateChanged(
content::DevToolsAgentHost* agent_host, bool attached) {
- content::RenderViewHost* rvh = agent_host->GetRenderViewHost();
+ RenderViewHost* rvh = agent_host->GetRenderViewHost();
// Ignore unrelated notifications.
if (!rvh ||
rvh->GetSiteInstance()->GetProcess()->GetBrowserContext() != GetProfile())
« no previous file with comments | « apps/shell_window.cc ('k') | chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698