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

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

Issue 9221017: Hide BrowsingInstance from all but SiteInstance, as intended by design. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. 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 | « content/browser/site_instance.h ('k') | 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) 2012 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"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 if (IsURLSameAsAnySiteInstance(url)) 134 if (IsURLSameAsAnySiteInstance(url))
135 return false; 135 return false;
136 136
137 // If the site URL is an extension (e.g., for hosted apps or WebUI) but the 137 // If the site URL is an extension (e.g., for hosted apps or WebUI) but the
138 // process is not (or vice versa), make sure we notice and fix it. 138 // process is not (or vice versa), make sure we notice and fix it.
139 GURL site_url = GetSiteForURL(browsing_instance_->browser_context(), url); 139 GURL site_url = GetSiteForURL(browsing_instance_->browser_context(), url);
140 return !RenderProcessHostImpl::IsSuitableHost( 140 return !RenderProcessHostImpl::IsSuitableHost(
141 process_, browsing_instance_->browser_context(), site_url); 141 process_, browsing_instance_->browser_context(), site_url);
142 } 142 }
143 143
144 content::BrowserContext* SiteInstance::GetBrowserContext() const {
145 return browsing_instance_->browser_context();
146 }
147
144 /*static*/ 148 /*static*/
145 SiteInstance* SiteInstance::CreateSiteInstance( 149 SiteInstance* SiteInstance::CreateSiteInstance(
146 content::BrowserContext* browser_context) { 150 content::BrowserContext* browser_context) {
147 return new SiteInstance(new BrowsingInstance(browser_context)); 151 return new SiteInstance(new BrowsingInstance(browser_context));
148 } 152 }
149 153
150 /*static*/ 154 /*static*/
151 SiteInstance* SiteInstance::CreateSiteInstanceForURL( 155 SiteInstance* SiteInstance::CreateSiteInstanceForURL(
152 content::BrowserContext* browser_context, const GURL& url) { 156 content::BrowserContext* browser_context, const GURL& url) {
153 // This BrowsingInstance may be deleted if it returns an existing 157 // This BrowsingInstance may be deleted if it returns an existing
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 244
241 void SiteInstance::LockToOrigin() { 245 void SiteInstance::LockToOrigin() {
242 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 246 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
243 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation)) { 247 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation)) {
244 ChildProcessSecurityPolicy* policy = 248 ChildProcessSecurityPolicy* policy =
245 ChildProcessSecurityPolicy::GetInstance(); 249 ChildProcessSecurityPolicy::GetInstance();
246 policy->LockToOrigin(process_->GetID(), site_); 250 policy->LockToOrigin(process_->GetID(), site_);
247 } 251 }
248 } 252 }
249 253
OLDNEW
« no previous file with comments | « content/browser/site_instance.h ('k') | content/browser/site_instance_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698