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

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

Issue 13979002: Add support for split PSL list distinctions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed chrome_frame compilation issue Created 7 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 unified diff | Download patch | Annotate | Revision Log
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_impl.h" 5 #include "content/browser/site_instance_impl.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_impl.h" 9 #include "content/browser/child_process_security_policy_impl.h"
10 #include "content/browser/renderer_host/render_process_host_impl.h" 10 #include "content/browser/renderer_host/render_process_host_impl.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 return true; 258 return true;
259 259
260 // If either URL is invalid, they aren't part of the same site. 260 // If either URL is invalid, they aren't part of the same site.
261 if (!url1.is_valid() || !url2.is_valid()) 261 if (!url1.is_valid() || !url2.is_valid())
262 return false; 262 return false;
263 263
264 // If the schemes differ, they aren't part of the same site. 264 // If the schemes differ, they aren't part of the same site.
265 if (url1.scheme() != url2.scheme()) 265 if (url1.scheme() != url2.scheme())
266 return false; 266 return false;
267 267
268 return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2); 268 return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2,
269 net::RCDS::EXCLUDE_PRIVATE_REGISTRIES);
269 } 270 }
270 271
271 /*static*/ 272 /*static*/
272 GURL SiteInstance::GetSiteForURL(BrowserContext* browser_context, 273 GURL SiteInstance::GetSiteForURL(BrowserContext* browser_context,
273 const GURL& real_url) { 274 const GURL& real_url) {
274 // TODO(fsamuel, creis): For some reason appID is not recognized as a host. 275 // TODO(fsamuel, creis): For some reason appID is not recognized as a host.
275 if (real_url.SchemeIs(chrome::kGuestScheme)) 276 if (real_url.SchemeIs(chrome::kGuestScheme))
276 return real_url; 277 return real_url;
277 278
278 GURL url = SiteInstanceImpl::GetEffectiveURL(browser_context, real_url); 279 GURL url = SiteInstanceImpl::GetEffectiveURL(browser_context, real_url);
(...skipping 12 matching lines...) Expand all
291 292
292 // Remove port, if any. 293 // Remove port, if any.
293 if (site.has_port()) { 294 if (site.has_port()) {
294 GURL::Replacements rep; 295 GURL::Replacements rep;
295 rep.ClearPort(); 296 rep.ClearPort();
296 site = site.ReplaceComponents(rep); 297 site = site.ReplaceComponents(rep);
297 } 298 }
298 299
299 // If this URL has a registered domain, we only want to remember that part. 300 // If this URL has a registered domain, we only want to remember that part.
300 std::string domain = 301 std::string domain =
301 net::RegistryControlledDomainService::GetDomainAndRegistry(url); 302 net::RegistryControlledDomainService::GetDomainAndRegistry(url,
303 net::RCDS::EXCLUDE_PRIVATE_REGISTRIES);
302 if (!domain.empty()) { 304 if (!domain.empty()) {
303 GURL::Replacements rep; 305 GURL::Replacements rep;
304 rep.SetHostStr(domain); 306 rep.SetHostStr(domain);
305 site = site.ReplaceComponents(rep); 307 site = site.ReplaceComponents(rep);
306 } 308 }
307 } 309 }
308 return site; 310 return site;
309 } 311 }
310 312
311 /*static*/ 313 /*static*/
(...skipping 18 matching lines...) Expand all
330 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 332 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
331 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || 333 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) ||
332 command_line.HasSwitch(switches::kSitePerProcess)) { 334 command_line.HasSwitch(switches::kSitePerProcess)) {
333 ChildProcessSecurityPolicyImpl* policy = 335 ChildProcessSecurityPolicyImpl* policy =
334 ChildProcessSecurityPolicyImpl::GetInstance(); 336 ChildProcessSecurityPolicyImpl::GetInstance();
335 policy->LockToOrigin(process_->GetID(), site_); 337 policy->LockToOrigin(process_->GetID(), site_);
336 } 338 }
337 } 339 }
338 340
339 } // namespace content 341 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698