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 <algorithm> | |
| 7 #include <utility> | 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 14 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 16 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 359 web_safe_schemes_.insert(scheme); | 360 web_safe_schemes_.insert(scheme); |
| 360 } | 361 } |
| 361 | 362 |
| 362 bool ChildProcessSecurityPolicyImpl::IsWebSafeScheme( | 363 bool ChildProcessSecurityPolicyImpl::IsWebSafeScheme( |
| 363 const std::string& scheme) { | 364 const std::string& scheme) { |
| 364 base::AutoLock lock(lock_); | 365 base::AutoLock lock(lock_); |
| 365 | 366 |
| 366 return ContainsKey(web_safe_schemes_, scheme); | 367 return ContainsKey(web_safe_schemes_, scheme); |
| 367 } | 368 } |
| 368 | 369 |
| 370 bool ChildProcessSecurityPolicyImpl::CanReadAllFiles( | |
|
Charlie Reis
2016/06/17 07:07:39
Nit: This is in the wrong section of the file. Th
Łukasz Anforowicz
2016/06/17 16:21:09
Done.
| |
| 371 int child_id, | |
| 372 const std::vector<base::FilePath>& files) { | |
| 373 return std::all_of(files.begin(), files.end(), | |
| 374 [this, child_id](const base::FilePath& file) { | |
| 375 return CanReadFile(child_id, file); | |
| 376 }); | |
| 377 } | |
| 378 | |
| 369 void ChildProcessSecurityPolicyImpl::RegisterPseudoScheme( | 379 void ChildProcessSecurityPolicyImpl::RegisterPseudoScheme( |
| 370 const std::string& scheme) { | 380 const std::string& scheme) { |
| 371 base::AutoLock lock(lock_); | 381 base::AutoLock lock(lock_); |
| 372 DCHECK_EQ(0U, pseudo_schemes_.count(scheme)) << "Add schemes at most once."; | 382 DCHECK_EQ(0U, pseudo_schemes_.count(scheme)) << "Add schemes at most once."; |
| 373 DCHECK_EQ(0U, web_safe_schemes_.count(scheme)) | 383 DCHECK_EQ(0U, web_safe_schemes_.count(scheme)) |
| 374 << "Pseudo implies not web-safe."; | 384 << "Pseudo implies not web-safe."; |
| 375 | 385 |
| 376 pseudo_schemes_.insert(scheme); | 386 pseudo_schemes_.insert(scheme); |
| 377 } | 387 } |
| 378 | 388 |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 848 base::AutoLock lock(lock_); | 858 base::AutoLock lock(lock_); |
| 849 | 859 |
| 850 SecurityStateMap::iterator state = security_state_.find(child_id); | 860 SecurityStateMap::iterator state = security_state_.find(child_id); |
| 851 if (state == security_state_.end()) | 861 if (state == security_state_.end()) |
| 852 return false; | 862 return false; |
| 853 | 863 |
| 854 return state->second->can_send_midi_sysex(); | 864 return state->second->can_send_midi_sysex(); |
| 855 } | 865 } |
| 856 | 866 |
| 857 } // namespace content | 867 } // namespace content |
| OLD | NEW |