OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/fileapi/file_system_path_manager.h" | 5 #include "webkit/fileapi/file_system_path_manager.h" |
6 | 6 |
7 #include "base/rand_util.h" | 7 #include "base/rand_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_callback_factory.h" | 9 #include "base/memory/scoped_callback_factory.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // want to let the underlying FileSystemFileUtil implementation do this part, | 135 // want to let the underlying FileSystemFileUtil implementation do this part, |
136 // since they won't all need it. | 136 // since they won't all need it. |
137 local_path = local_path.NormalizeWindowsPathSeparators(); | 137 local_path = local_path.NormalizeWindowsPathSeparators(); |
138 #endif | 138 #endif |
139 | 139 |
140 // Check if file access to this type of file system is allowed | 140 // Check if file access to this type of file system is allowed |
141 // for this origin. | 141 // for this origin. |
142 switch (local_type) { | 142 switch (local_type) { |
143 case kFileSystemTypeTemporary: | 143 case kFileSystemTypeTemporary: |
144 case kFileSystemTypePersistent: | 144 case kFileSystemTypePersistent: |
145 if (!sandbox_provider_->IsAccessAllowed(local_url)) | 145 if (!sandbox_provider_->IsAccessAllowed(local_url, local_path)) |
146 return false; | 146 return false; |
147 break; | 147 break; |
148 case kFileSystemTypeLocal: | 148 case kFileSystemTypeLocal: |
149 if (!local_provider_.get() || | 149 if (!local_provider_.get() || |
150 !local_provider_->IsAccessAllowed(local_url)) { | 150 !local_provider_->IsAccessAllowed(local_url, local_path)) { |
151 return false; | 151 return false; |
152 } | 152 } |
153 break; | 153 break; |
154 case kFileSystemTypeUnknown: | 154 case kFileSystemTypeUnknown: |
155 default: | 155 default: |
156 NOTREACHED(); | 156 NOTREACHED(); |
157 return false; | 157 return false; |
158 } | 158 } |
159 // Any paths that include parent references are considered invalid. | 159 // Any paths that include parent references are considered invalid. |
160 // These should have been taken care of in CrackFileSystemURL. | 160 // These should have been taken care of in CrackFileSystemURL. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 return true; | 211 return true; |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 } // namespace fileapi | 215 } // namespace fileapi |
216 | 216 |
217 COMPILE_ASSERT(int(WebFileSystem::TypeTemporary) == \ | 217 COMPILE_ASSERT(int(WebFileSystem::TypeTemporary) == \ |
218 int(fileapi::kFileSystemTypeTemporary), mismatching_enums); | 218 int(fileapi::kFileSystemTypeTemporary), mismatching_enums); |
219 COMPILE_ASSERT(int(WebFileSystem::TypePersistent) == \ | 219 COMPILE_ASSERT(int(WebFileSystem::TypePersistent) == \ |
220 int(fileapi::kFileSystemTypePersistent), mismatching_enums); | 220 int(fileapi::kFileSystemTypePersistent), mismatching_enums); |
OLD | NEW |