OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/child_process_security_policy.h" | 5 #include "chrome/browser/child_process_security_policy.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/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 DISALLOW_COPY_AND_ASSIGN(SecurityState); | 101 DISALLOW_COPY_AND_ASSIGN(SecurityState); |
102 }; | 102 }; |
103 | 103 |
104 ChildProcessSecurityPolicy::ChildProcessSecurityPolicy() { | 104 ChildProcessSecurityPolicy::ChildProcessSecurityPolicy() { |
105 // We know about these schemes and believe them to be safe. | 105 // We know about these schemes and believe them to be safe. |
106 RegisterWebSafeScheme(chrome::kHttpScheme); | 106 RegisterWebSafeScheme(chrome::kHttpScheme); |
107 RegisterWebSafeScheme(chrome::kHttpsScheme); | 107 RegisterWebSafeScheme(chrome::kHttpsScheme); |
108 RegisterWebSafeScheme(chrome::kFtpScheme); | 108 RegisterWebSafeScheme(chrome::kFtpScheme); |
109 RegisterWebSafeScheme(chrome::kDataScheme); | 109 RegisterWebSafeScheme(chrome::kDataScheme); |
110 RegisterWebSafeScheme("feed"); | 110 RegisterWebSafeScheme("feed"); |
111 RegisterWebSafeScheme("chrome-extension"); | 111 RegisterWebSafeScheme(chrome::kExtensionScheme); |
112 | 112 |
113 // We know about the following psuedo schemes and treat them specially. | 113 // We know about the following psuedo schemes and treat them specially. |
114 RegisterPseudoScheme(chrome::kAboutScheme); | 114 RegisterPseudoScheme(chrome::kAboutScheme); |
115 RegisterPseudoScheme(chrome::kJavaScriptScheme); | 115 RegisterPseudoScheme(chrome::kJavaScriptScheme); |
116 RegisterPseudoScheme(chrome::kViewSourceScheme); | 116 RegisterPseudoScheme(chrome::kViewSourceScheme); |
117 RegisterPseudoScheme(chrome::kPrintScheme); | 117 RegisterPseudoScheme(chrome::kPrintScheme); |
118 } | 118 } |
119 | 119 |
120 ChildProcessSecurityPolicy::~ChildProcessSecurityPolicy() { | 120 ChildProcessSecurityPolicy::~ChildProcessSecurityPolicy() { |
121 web_safe_schemes_.clear(); | 121 web_safe_schemes_.clear(); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 370 |
371 bool ChildProcessSecurityPolicy::CanReadRawCookies(int renderer_id) { | 371 bool ChildProcessSecurityPolicy::CanReadRawCookies(int renderer_id) { |
372 AutoLock lock(lock_); | 372 AutoLock lock(lock_); |
373 | 373 |
374 SecurityStateMap::iterator state = security_state_.find(renderer_id); | 374 SecurityStateMap::iterator state = security_state_.find(renderer_id); |
375 if (state == security_state_.end()) | 375 if (state == security_state_.end()) |
376 return false; | 376 return false; |
377 | 377 |
378 return state->second->can_read_raw_cookies(); | 378 return state->second->can_read_raw_cookies(); |
379 } | 379 } |
OLD | NEW |