| 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/browser/fileapi/sandbox_file_system_backend.h" | 5 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 const GURL& origin_url, | 64 const GURL& origin_url, |
| 65 fileapi::FileSystemType type, | 65 fileapi::FileSystemType type, |
| 66 OpenFileSystemMode mode, | 66 OpenFileSystemMode mode, |
| 67 const OpenFileSystemCallback& callback) { | 67 const OpenFileSystemCallback& callback) { |
| 68 DCHECK(CanHandleType(type)); | 68 DCHECK(CanHandleType(type)); |
| 69 DCHECK(delegate_); | 69 DCHECK(delegate_); |
| 70 if (delegate_->file_system_options().is_incognito() && | 70 if (delegate_->file_system_options().is_incognito() && |
| 71 !(type == kFileSystemTypeTemporary && | 71 !(type == kFileSystemTypeTemporary && |
| 72 enable_temporary_file_system_in_incognito_)) { | 72 enable_temporary_file_system_in_incognito_)) { |
| 73 // TODO(kinuko): return an isolated temporary directory. | 73 // TODO(kinuko): return an isolated temporary directory. |
| 74 callback.Run(GURL(), std::string(), base::PLATFORM_FILE_ERROR_SECURITY); | 74 callback.Run(GURL(), std::string(), base::File::FILE_ERROR_SECURITY); |
| 75 return; | 75 return; |
| 76 } | 76 } |
| 77 | 77 |
| 78 delegate_->OpenFileSystem( | 78 delegate_->OpenFileSystem( |
| 79 origin_url, type, mode, callback, | 79 origin_url, type, mode, callback, |
| 80 GetFileSystemRootURI(origin_url, type)); | 80 GetFileSystemRootURI(origin_url, type)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 AsyncFileUtil* SandboxFileSystemBackend::GetAsyncFileUtil( | 83 AsyncFileUtil* SandboxFileSystemBackend::GetAsyncFileUtil( |
| 84 FileSystemType type) { | 84 FileSystemType type) { |
| 85 DCHECK(delegate_); | 85 DCHECK(delegate_); |
| 86 return delegate_->file_util(); | 86 return delegate_->file_util(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 CopyOrMoveFileValidatorFactory* | 89 CopyOrMoveFileValidatorFactory* |
| 90 SandboxFileSystemBackend::GetCopyOrMoveFileValidatorFactory( | 90 SandboxFileSystemBackend::GetCopyOrMoveFileValidatorFactory( |
| 91 FileSystemType type, | 91 FileSystemType type, |
| 92 base::PlatformFileError* error_code) { | 92 base::File::Error* error_code) { |
| 93 DCHECK(error_code); | 93 DCHECK(error_code); |
| 94 *error_code = base::PLATFORM_FILE_OK; | 94 *error_code = base::File::FILE_OK; |
| 95 return NULL; | 95 return NULL; |
| 96 } | 96 } |
| 97 | 97 |
| 98 FileSystemOperation* SandboxFileSystemBackend::CreateFileSystemOperation( | 98 FileSystemOperation* SandboxFileSystemBackend::CreateFileSystemOperation( |
| 99 const FileSystemURL& url, | 99 const FileSystemURL& url, |
| 100 FileSystemContext* context, | 100 FileSystemContext* context, |
| 101 base::PlatformFileError* error_code) const { | 101 base::File::Error* error_code) const { |
| 102 DCHECK(CanHandleType(url.type())); | 102 DCHECK(CanHandleType(url.type())); |
| 103 DCHECK(error_code); | 103 DCHECK(error_code); |
| 104 | 104 |
| 105 DCHECK(delegate_); | 105 DCHECK(delegate_); |
| 106 scoped_ptr<FileSystemOperationContext> operation_context = | 106 scoped_ptr<FileSystemOperationContext> operation_context = |
| 107 delegate_->CreateFileSystemOperationContext(url, context, error_code); | 107 delegate_->CreateFileSystemOperationContext(url, context, error_code); |
| 108 if (!operation_context) | 108 if (!operation_context) |
| 109 return NULL; | 109 return NULL; |
| 110 | 110 |
| 111 SpecialStoragePolicy* policy = delegate_->special_storage_policy(); | 111 SpecialStoragePolicy* policy = delegate_->special_storage_policy(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 return delegate_; | 143 return delegate_; |
| 144 } | 144 } |
| 145 | 145 |
| 146 SandboxFileSystemBackendDelegate::OriginEnumerator* | 146 SandboxFileSystemBackendDelegate::OriginEnumerator* |
| 147 SandboxFileSystemBackend::CreateOriginEnumerator() { | 147 SandboxFileSystemBackend::CreateOriginEnumerator() { |
| 148 DCHECK(delegate_); | 148 DCHECK(delegate_); |
| 149 return delegate_->CreateOriginEnumerator(); | 149 return delegate_->CreateOriginEnumerator(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace fileapi | 152 } // namespace fileapi |
| OLD | NEW |