| 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 <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 return result; | 780 return result; |
| 781 } | 781 } |
| 782 | 782 |
| 783 bool ChildProcessSecurityPolicyImpl::HasPermissionsForFileSystemFile( | 783 bool ChildProcessSecurityPolicyImpl::HasPermissionsForFileSystemFile( |
| 784 int child_id, | 784 int child_id, |
| 785 const storage::FileSystemURL& url, | 785 const storage::FileSystemURL& url, |
| 786 int permissions) { | 786 int permissions) { |
| 787 if (!url.is_valid()) | 787 if (!url.is_valid()) |
| 788 return false; | 788 return false; |
| 789 | 789 |
| 790 // If |url.origin()| is not committable in this process, then this page |
| 791 // should not be able to place content in that origin via the filesystem |
| 792 // API either. |
| 793 if (!CanCommitURL(child_id, url.origin())) { |
| 794 UMA_HISTOGRAM_BOOLEAN("FileSystem.OriginFailedCanCommitURL", true); |
| 795 return false; |
| 796 } |
| 797 |
| 790 if (url.path().ReferencesParent()) | 798 if (url.path().ReferencesParent()) |
| 791 return false; | 799 return false; |
| 792 | 800 |
| 793 // Any write access is disallowed on the root path. | 801 // Any write access is disallowed on the root path. |
| 794 if (storage::VirtualPath::IsRootPath(url.path()) && | 802 if (storage::VirtualPath::IsRootPath(url.path()) && |
| 795 (permissions & ~READ_FILE_GRANT)) { | 803 (permissions & ~READ_FILE_GRANT)) { |
| 796 return false; | 804 return false; |
| 797 } | 805 } |
| 798 | 806 |
| 799 if (url.mount_type() == storage::kFileSystemTypeIsolated) { | 807 if (url.mount_type() == storage::kFileSystemTypeIsolated) { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 base::AutoLock lock(lock_); | 962 base::AutoLock lock(lock_); |
| 955 | 963 |
| 956 SecurityStateMap::iterator state = security_state_.find(child_id); | 964 SecurityStateMap::iterator state = security_state_.find(child_id); |
| 957 if (state == security_state_.end()) | 965 if (state == security_state_.end()) |
| 958 return false; | 966 return false; |
| 959 | 967 |
| 960 return state->second->can_send_midi_sysex(); | 968 return state->second->can_send_midi_sysex(); |
| 961 } | 969 } |
| 962 | 970 |
| 963 } // namespace content | 971 } // namespace content |
| OLD | NEW |