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

Side by Side Diff: content/browser/site_instance.cc

Issue 9251017: Merge 117744 - Don't swap processes for javascript: URLs. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/963/src/
Patch Set: Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/site_instance_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/site_instance.h" 5 #include "content/browser/site_instance.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/browser/browsing_instance.h" 8 #include "content/browser/browsing_instance.h"
9 #include "content/browser/child_process_security_policy.h" 9 #include "content/browser/child_process_security_policy.h"
10 #include "content/browser/renderer_host/render_process_host_impl.h" 10 #include "content/browser/renderer_host/render_process_host_impl.h"
11 #include "content/browser/webui/web_ui_factory.h" 11 #include "content/browser/webui/web_ui_factory.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 SiteInstance* SiteInstance::GetRelatedSiteInstance(const GURL& url) { 124 SiteInstance* SiteInstance::GetRelatedSiteInstance(const GURL& url) {
125 return browsing_instance_->GetSiteInstanceForURL(url); 125 return browsing_instance_->GetSiteInstanceForURL(url);
126 } 126 }
127 127
128 bool SiteInstance::HasWrongProcessForURL(const GURL& url) const { 128 bool SiteInstance::HasWrongProcessForURL(const GURL& url) const {
129 // Having no process isn't a problem, since we'll assign it correctly. 129 // Having no process isn't a problem, since we'll assign it correctly.
130 if (!HasProcess()) 130 if (!HasProcess())
131 return false; 131 return false;
132 132
133 // If the URL to navigate to can be associated with any site instance,
134 // we want to keep it in the same process.
135 if (IsURLSameAsAnySiteInstance(url))
136 return false;
137
133 // If the site URL is an extension (e.g., for hosted apps) but the 138 // If the site URL is an extension (e.g., for hosted apps) but the
134 // process is not (or vice versa), make sure we notice and fix it. 139 // process is not (or vice versa), make sure we notice and fix it.
135 GURL site_url = GetSiteForURL(browsing_instance_->browser_context(), url); 140 GURL site_url = GetSiteForURL(browsing_instance_->browser_context(), url);
136 content::ContentBrowserClient* browser = 141 content::ContentBrowserClient* browser =
137 content::GetContentClient()->browser(); 142 content::GetContentClient()->browser();
138 return !browser->IsSuitableHost(process_, site_url); 143 return !browser->IsSuitableHost(process_, site_url);
139 } 144 }
140 145
141 /*static*/ 146 /*static*/
142 SiteInstance* SiteInstance::CreateSiteInstance( 147 SiteInstance* SiteInstance::CreateSiteInstance(
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 242
238 void SiteInstance::LockToOrigin() { 243 void SiteInstance::LockToOrigin() {
239 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 244 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
240 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation)) { 245 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation)) {
241 ChildProcessSecurityPolicy* policy = 246 ChildProcessSecurityPolicy* policy =
242 ChildProcessSecurityPolicy::GetInstance(); 247 ChildProcessSecurityPolicy::GetInstance();
243 policy->LockToOrigin(process_->GetID(), site_); 248 policy->LockToOrigin(process_->GetID(), site_);
244 } 249 }
245 } 250 }
246 251
OLDNEW
« no previous file with comments | « no previous file | content/browser/site_instance_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698