| 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 "webkit/fileapi/sandbox_mount_point_provider.h" | 5 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 } | 248 } |
| 249 | 249 |
| 250 return false; | 250 return false; |
| 251 } | 251 } |
| 252 | 252 |
| 253 FileSystemFileUtil* SandboxMountPointProvider::GetFileUtil( | 253 FileSystemFileUtil* SandboxMountPointProvider::GetFileUtil( |
| 254 FileSystemType type) { | 254 FileSystemType type) { |
| 255 return sandbox_file_util_.get(); | 255 return sandbox_file_util_.get(); |
| 256 } | 256 } |
| 257 | 257 |
| 258 FilePath SandboxMountPointProvider::GetPathForPermissionsCheck( | 258 FilePermissionPolicy SandboxMountPointProvider::GetPermissionPolicy( |
| 259 const FilePath& virtual_path) const { | 259 const FileSystemURL& url, int permissions) const { |
| 260 // Sandbox provider shouldn't directly grant permissions for its | 260 // Access to the sandbox directory (and only to the directory) should be |
| 261 // data directory. | 261 // always allowed. |
| 262 return FilePath(); | 262 CHECK(CanHandleType(url.type())); |
| 263 CHECK(!url.path().ReferencesParent()); |
| 264 return FILE_PERMISSION_ALWAYS_ALLOW; |
| 263 } | 265 } |
| 264 | 266 |
| 265 FileSystemOperation* SandboxMountPointProvider::CreateFileSystemOperation( | 267 FileSystemOperation* SandboxMountPointProvider::CreateFileSystemOperation( |
| 266 const FileSystemURL& url, | 268 const FileSystemURL& url, |
| 267 FileSystemContext* context, | 269 FileSystemContext* context, |
| 268 base::PlatformFileError* error_code) const { | 270 base::PlatformFileError* error_code) const { |
| 269 scoped_ptr<FileSystemOperationContext> operation_context( | 271 scoped_ptr<FileSystemOperationContext> operation_context( |
| 270 new FileSystemOperationContext(context)); | 272 new FileSystemOperationContext(context)); |
| 271 | 273 |
| 272 // Copy the observer lists (assuming we only have small number of observers). | 274 // Copy the observer lists (assuming we only have small number of observers). |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 i < file_system_options_.additional_allowed_schemes().size(); | 570 i < file_system_options_.additional_allowed_schemes().size(); |
| 569 ++i) { | 571 ++i) { |
| 570 if (url.SchemeIs( | 572 if (url.SchemeIs( |
| 571 file_system_options_.additional_allowed_schemes()[i].c_str())) | 573 file_system_options_.additional_allowed_schemes()[i].c_str())) |
| 572 return true; | 574 return true; |
| 573 } | 575 } |
| 574 return false; | 576 return false; |
| 575 } | 577 } |
| 576 | 578 |
| 577 } // namespace fileapi | 579 } // namespace fileapi |
| OLD | NEW |