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

Unified Diff: chrome/browser/ui/browser_navigator.cc

Issue 6312199: Prevent unused normal SiteInstances from being used for extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Set SiteInstance's site earlier. Created 9 years, 10 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 | « chrome/browser/tab_contents/render_view_host_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_navigator.cc
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
index bcd40cf505c3ece2701b3780f4700163af16d227..979938af6b714bd2b782564e8241595df02003d2 100644
--- a/chrome/browser/ui/browser_navigator.cc
+++ b/chrome/browser/ui/browser_navigator.cc
@@ -21,9 +21,17 @@
namespace {
-// Returns the SiteInstance for |source_contents| if it represents the same
-// website as |url|, or NULL otherwise. |source_contents| cannot be NULL.
-SiteInstance* GetSiteInstance(TabContents* source_contents, const GURL& url) {
+// Returns an appropriate SiteInstance for WebUI URLs, or the SiteInstance for
+// |source_contents| if it represents the same website as |url|. Returns NULL
+// otherwise.
+SiteInstance* GetSiteInstance(TabContents* source_contents, Profile* profile,
+ const GURL& url) {
+ // If url is a WebUI or extension, we need to be sure to use the right type
+ // of renderer process up front. Otherwise, we create a normal SiteInstance
+ // as part of creating the tab.
+ if (WebUIFactory::UseWebUIForURL(profile, url))
+ return SiteInstance::CreateSiteInstanceForURL(profile, url);
+
if (!source_contents)
return NULL;
@@ -390,13 +398,15 @@ void Navigate(NavigateParams* params) {
// If no target TabContents was specified, we need to construct one if we are
// supposed to target a new tab; unless it's a singleton that already exists.
if (!params->target_contents && singleton_index < 0) {
+ GURL url = params->url.is_empty() ? params->browser->GetHomePage()
+ : params->url;
if (params->disposition != CURRENT_TAB) {
TabContents* source_contents = params->source_contents ?
params->source_contents->tab_contents() : NULL;
params->target_contents =
Browser::TabContentsFactory(
params->browser->profile(),
- GetSiteInstance(source_contents, params->url),
+ GetSiteInstance(source_contents, params->browser->profile(), url),
MSG_ROUTING_NONE,
source_contents,
NULL);
@@ -425,8 +435,6 @@ void Navigate(NavigateParams* params) {
}
// Perform the actual navigation.
- GURL url = params->url.is_empty() ? params->browser->GetHomePage()
- : params->url;
params->target_contents->controller().LoadURL(url, params->referrer,
params->transition);
} else {
« no previous file with comments | « chrome/browser/tab_contents/render_view_host_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698