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/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 delete security_state_[child_id]; | 216 delete security_state_[child_id]; |
| 217 security_state_.erase(child_id); | 217 security_state_.erase(child_id); |
| 218 worker_map_.erase(child_id); | 218 worker_map_.erase(child_id); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void ChildProcessSecurityPolicyImpl::RegisterWebSafeScheme( | 221 void ChildProcessSecurityPolicyImpl::RegisterWebSafeScheme( |
| 222 const std::string& scheme) { | 222 const std::string& scheme) { |
| 223 base::AutoLock lock(lock_); | 223 base::AutoLock lock(lock_); |
| 224 DCHECK(web_safe_schemes_.count(scheme) == 0) << "Add schemes at most once."; | 224 DCHECK(web_safe_schemes_.count(scheme) == 0) << "Add schemes at most once."; |
| 225 DCHECK(pseudo_schemes_.count(scheme) == 0) << "Web-safe implies not pseudo."; | 225 DCHECK(pseudo_schemes_.count(scheme) == 0) << "Web-safe implies not pseudo."; |
| 226 | 226 LOG(ERROR) << "scheme == " << scheme; |
|
Tom Sepez
2012/04/11 20:31:16
Remove Debugging. No need to rev this file.
Peng
2012/04/11 21:40:13
Done.
| |
| 227 web_safe_schemes_.insert(scheme); | 227 web_safe_schemes_.insert(scheme); |
| 228 } | 228 } |
| 229 | 229 |
| 230 bool ChildProcessSecurityPolicyImpl::IsWebSafeScheme( | 230 bool ChildProcessSecurityPolicyImpl::IsWebSafeScheme( |
| 231 const std::string& scheme) { | 231 const std::string& scheme) { |
| 232 base::AutoLock lock(lock_); | 232 base::AutoLock lock(lock_); |
| 233 | 233 |
| 234 return (web_safe_schemes_.find(scheme) != web_safe_schemes_.end()); | 234 return (web_safe_schemes_.find(scheme) != web_safe_schemes_.end()); |
| 235 } | 235 } |
| 236 | 236 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 517 | 517 |
| 518 void ChildProcessSecurityPolicyImpl::LockToOrigin(int child_id, | 518 void ChildProcessSecurityPolicyImpl::LockToOrigin(int child_id, |
| 519 const GURL& gurl) { | 519 const GURL& gurl) { |
| 520 // "gurl" can be currently empty in some cases, such as file://blah. | 520 // "gurl" can be currently empty in some cases, such as file://blah. |
| 521 DCHECK(SiteInstanceImpl::GetSiteForURL(NULL, gurl) == gurl); | 521 DCHECK(SiteInstanceImpl::GetSiteForURL(NULL, gurl) == gurl); |
| 522 base::AutoLock lock(lock_); | 522 base::AutoLock lock(lock_); |
| 523 SecurityStateMap::iterator state = security_state_.find(child_id); | 523 SecurityStateMap::iterator state = security_state_.find(child_id); |
| 524 DCHECK(state != security_state_.end()); | 524 DCHECK(state != security_state_.end()); |
| 525 state->second->LockToOrigin(gurl); | 525 state->second->LockToOrigin(gurl); |
| 526 } | 526 } |
| OLD | NEW |