Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/child_process_security_policy_impl.h" | 5 #include "content/browser/child_process_security_policy_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 if (it != file_permissions_.end()) | 207 if (it != file_permissions_.end()) |
| 208 return (it->second & permissions) == permissions; | 208 return (it->second & permissions) == permissions; |
| 209 } | 209 } |
| 210 last_path = current_path; | 210 last_path = current_path; |
| 211 current_path = current_path.DirName(); | 211 current_path = current_path.DirName(); |
| 212 } | 212 } |
| 213 | 213 |
| 214 return false; | 214 return false; |
| 215 } | 215 } |
| 216 | 216 |
| 217 bool CanLoadPage(const GURL& gurl) { | |
| 218 if (origin_lock_.is_empty()) | |
| 219 return true; | |
| 220 | |
| 221 // TODO(creis): We must pass the valid browser_context to convert hosted | |
| 222 // apps URLs. Currently, hosted apps cannot be loaded in this mode. | |
| 223 // See http://crbug.com/160576. | |
| 224 GURL site_gurl = SiteInstanceImpl::GetSiteForURL(NULL, gurl); | |
| 225 return origin_lock_ == site_gurl; | |
| 226 } | |
| 227 | |
| 228 bool CanAccessCookiesForOrigin(const GURL& gurl) { | 217 bool CanAccessCookiesForOrigin(const GURL& gurl) { |
| 229 if (origin_lock_.is_empty()) | 218 if (origin_lock_.is_empty()) |
| 230 return true; | 219 return true; |
| 231 // TODO(creis): We must pass the valid browser_context to convert hosted | 220 // TODO(creis): We must pass the valid browser_context to convert hosted |
| 232 // apps URLs. Currently, hosted apps cannot set cookies in this mode. | 221 // apps URLs. Currently, hosted apps cannot set cookies in this mode. |
| 233 // See http://crbug.com/160576. | 222 // See http://crbug.com/160576. |
| 234 GURL site_gurl = SiteInstanceImpl::GetSiteForURL(NULL, gurl); | 223 GURL site_gurl = SiteInstanceImpl::GetSiteForURL(NULL, gurl); |
| 235 return origin_lock_ == site_gurl; | 224 return origin_lock_ == site_gurl; |
| 236 } | 225 } |
| 237 | 226 |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 void ChildProcessSecurityPolicyImpl::RevokeReadRawCookies(int child_id) { | 543 void ChildProcessSecurityPolicyImpl::RevokeReadRawCookies(int child_id) { |
| 555 base::AutoLock lock(lock_); | 544 base::AutoLock lock(lock_); |
| 556 | 545 |
| 557 SecurityStateMap::iterator state = security_state_.find(child_id); | 546 SecurityStateMap::iterator state = security_state_.find(child_id); |
| 558 if (state == security_state_.end()) | 547 if (state == security_state_.end()) |
| 559 return; | 548 return; |
| 560 | 549 |
| 561 state->second->RevokeReadRawCookies(); | 550 state->second->RevokeReadRawCookies(); |
| 562 } | 551 } |
| 563 | 552 |
| 564 bool ChildProcessSecurityPolicyImpl::CanLoadPage(int child_id, | 553 bool ChildProcessSecurityPolicyImpl::CanLoadPage(int child_id, |
|
Charlie Reis
2015/07/16 21:28:51
Also remove this one.
ncarter (slow)
2015/07/16 23:14:39
Done.
| |
| 565 const GURL& url, | 554 const GURL& url, |
| 566 ResourceType resource_type) { | 555 ResourceType resource_type) { |
| 567 // If --site-per-process flag is passed, we should enforce | 556 // If --site-per-process flag is passed, we should enforce |
| 568 // stronger security restrictions on page navigation. | 557 // stronger security restrictions on page navigation. |
| 569 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 558 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 570 switches::kSitePerProcess) && | 559 switches::kSitePerProcess) && |
| 571 IsResourceTypeFrame(resource_type)) { | 560 IsResourceTypeFrame(resource_type)) { |
| 572 // TODO(nasko): Do the proper check for site-per-process, once | 561 // TODO(nasko): Do the proper check for site-per-process, once |
| 573 // out-of-process iframes is ready to go. | 562 // out-of-process iframes is ready to go. |
| 574 return true; | 563 return true; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 847 base::AutoLock lock(lock_); | 836 base::AutoLock lock(lock_); |
| 848 | 837 |
| 849 SecurityStateMap::iterator state = security_state_.find(child_id); | 838 SecurityStateMap::iterator state = security_state_.find(child_id); |
| 850 if (state == security_state_.end()) | 839 if (state == security_state_.end()) |
| 851 return false; | 840 return false; |
| 852 | 841 |
| 853 return state->second->can_send_midi_sysex(); | 842 return state->second->can_send_midi_sysex(); |
| 854 } | 843 } |
| 855 | 844 |
| 856 } // namespace content | 845 } // namespace content |
| OLD | NEW |