Chromium Code Reviews| Index: content/browser/child_process_security_policy_impl.cc |
| diff --git a/content/browser/child_process_security_policy_impl.cc b/content/browser/child_process_security_policy_impl.cc |
| index e86ccaede0d8cf29f508d71c6a58dbe80844c1c2..a6bb5e5579d85a4a82d3dd120c4afaa6af45e758 100644 |
| --- a/content/browser/child_process_security_policy_impl.cc |
| +++ b/content/browser/child_process_security_policy_impl.cc |
| @@ -167,6 +167,16 @@ class ChildProcessSecurityPolicyImpl::SecurityState { |
| return false; |
| } |
| + bool CanLoadPage(const GURL& gurl){ |
| + if (origin_lock_.is_empty()) |
| + return true; |
| + // TODO(creis): We must pass the valid browser_context to convert hosted |
| + // apps URLs. Currently, hosted apps cannot set cookies in this mode. |
|
Charlie Reis
2012/11/29 22:00:54
nit: s/set cookies/be loaded/
irobert
2012/12/01 00:02:48
Done.
|
| + // See http://crbug.com/160576. |
| + GURL site_gurl = SiteInstanceImpl::GetSiteForURL(NULL, gurl); |
| + return origin_lock_ == site_gurl; |
| + } |
| + |
| bool CanAccessCookiesForOrigin(const GURL& gurl) { |
| if (origin_lock_.is_empty()) |
| return true; |
| @@ -487,6 +497,25 @@ void ChildProcessSecurityPolicyImpl::RevokeReadRawCookies(int child_id) { |
| state->second->RevokeReadRawCookies(); |
| } |
| +bool ChildProcessSecurityPolicyImpl::CanLoadPage( |
| + int child_id, const GURL& url, ResourceType::Type resource_type) { |
|
Charlie Reis
2012/11/29 22:00:54
Style nit: Each argument should be on its own line
irobert
2012/12/01 00:02:48
Done.
|
| + // If --site-per-process flag is passed, we should enforce |
| + // stronger security restrictions on page navigation. |
| + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess) && |
| + ResourceType::IsFrame(resource_type)) { |
| + // TODO(irobert): This will break some WebUI page such as |
|
Charlie Reis
2012/11/29 22:00:54
nit: s/will break/currently breaks/
irobert
2012/12/01 00:02:48
Done.
|
| + // "chrome://extensions/" (belongs to site chrome://chrome/) which |
| + // will load an iframe for the page "chrome://uber-frame/" |
| + // (belongs to site chrome://uber-frame/) |
|
Charlie Reis
2012/11/29 22:00:54
nit: End with period.
irobert
2012/12/01 00:02:48
Done.
|
| + base::AutoLock lock(lock_); |
| + SecurityStateMap::iterator state = security_state_.find(child_id); |
| + if (state == security_state_.end()) |
| + return false; |
| + return state->second->CanLoadPage(url); |
| + } |
| + return true; |
| +} |
| + |
| bool ChildProcessSecurityPolicyImpl::CanRequestURL( |
| int child_id, const GURL& url) { |
| if (!url.is_valid()) |