| 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 | |
| 798 if (url.path().ReferencesParent()) | 790 if (url.path().ReferencesParent()) |
| 799 return false; | 791 return false; |
| 800 | 792 |
| 801 // Any write access is disallowed on the root path. | 793 // Any write access is disallowed on the root path. |
| 802 if (storage::VirtualPath::IsRootPath(url.path()) && | 794 if (storage::VirtualPath::IsRootPath(url.path()) && |
| 803 (permissions & ~READ_FILE_GRANT)) { | 795 (permissions & ~READ_FILE_GRANT)) { |
| 804 return false; | 796 return false; |
| 805 } | 797 } |
| 806 | 798 |
| 807 if (url.mount_type() == storage::kFileSystemTypeIsolated) { | 799 if (url.mount_type() == storage::kFileSystemTypeIsolated) { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 base::AutoLock lock(lock_); | 954 base::AutoLock lock(lock_); |
| 963 | 955 |
| 964 SecurityStateMap::iterator state = security_state_.find(child_id); | 956 SecurityStateMap::iterator state = security_state_.find(child_id); |
| 965 if (state == security_state_.end()) | 957 if (state == security_state_.end()) |
| 966 return false; | 958 return false; |
| 967 | 959 |
| 968 return state->second->can_send_midi_sysex(); | 960 return state->second->can_send_midi_sysex(); |
| 969 } | 961 } |
| 970 | 962 |
| 971 } // namespace content | 963 } // namespace content |
| OLD | NEW |