| 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/isolated_file_system_backend.h" | 5 #include "webkit/browser/fileapi/isolated_file_system_backend.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 const GURL& origin_url, | 61 const GURL& origin_url, |
| 62 FileSystemType type, | 62 FileSystemType type, |
| 63 OpenFileSystemMode mode, | 63 OpenFileSystemMode mode, |
| 64 const OpenFileSystemCallback& callback) { | 64 const OpenFileSystemCallback& callback) { |
| 65 // We never allow opening a new isolated FileSystem via usual OpenFileSystem. | 65 // We never allow opening a new isolated FileSystem via usual OpenFileSystem. |
| 66 base::MessageLoopProxy::current()->PostTask( | 66 base::MessageLoopProxy::current()->PostTask( |
| 67 FROM_HERE, | 67 FROM_HERE, |
| 68 base::Bind(callback, | 68 base::Bind(callback, |
| 69 GetFileSystemRootURI(origin_url, type), | 69 GetFileSystemRootURI(origin_url, type), |
| 70 GetFileSystemName(origin_url, type), | 70 GetFileSystemName(origin_url, type), |
| 71 base::PLATFORM_FILE_ERROR_SECURITY)); | 71 base::File::FILE_ERROR_SECURITY)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 AsyncFileUtil* IsolatedFileSystemBackend::GetAsyncFileUtil( | 74 AsyncFileUtil* IsolatedFileSystemBackend::GetAsyncFileUtil( |
| 75 FileSystemType type) { | 75 FileSystemType type) { |
| 76 switch (type) { | 76 switch (type) { |
| 77 case kFileSystemTypeNativeLocal: | 77 case kFileSystemTypeNativeLocal: |
| 78 return isolated_file_util_.get(); | 78 return isolated_file_util_.get(); |
| 79 case kFileSystemTypeDragged: | 79 case kFileSystemTypeDragged: |
| 80 return dragged_file_util_.get(); | 80 return dragged_file_util_.get(); |
| 81 case kFileSystemTypeForTransientFile: | 81 case kFileSystemTypeForTransientFile: |
| 82 return transient_file_util_.get(); | 82 return transient_file_util_.get(); |
| 83 default: | 83 default: |
| 84 NOTREACHED(); | 84 NOTREACHED(); |
| 85 } | 85 } |
| 86 return NULL; | 86 return NULL; |
| 87 } | 87 } |
| 88 | 88 |
| 89 CopyOrMoveFileValidatorFactory* | 89 CopyOrMoveFileValidatorFactory* |
| 90 IsolatedFileSystemBackend::GetCopyOrMoveFileValidatorFactory( | 90 IsolatedFileSystemBackend::GetCopyOrMoveFileValidatorFactory( |
| 91 FileSystemType type, base::PlatformFileError* error_code) { | 91 FileSystemType type, base::File::Error* error_code) { |
| 92 DCHECK(error_code); | 92 DCHECK(error_code); |
| 93 *error_code = base::PLATFORM_FILE_OK; | 93 *error_code = base::File::FILE_OK; |
| 94 return NULL; | 94 return NULL; |
| 95 } | 95 } |
| 96 | 96 |
| 97 FileSystemOperation* IsolatedFileSystemBackend::CreateFileSystemOperation( | 97 FileSystemOperation* IsolatedFileSystemBackend::CreateFileSystemOperation( |
| 98 const FileSystemURL& url, | 98 const FileSystemURL& url, |
| 99 FileSystemContext* context, | 99 FileSystemContext* context, |
| 100 base::PlatformFileError* error_code) const { | 100 base::File::Error* error_code) const { |
| 101 return FileSystemOperation::Create( | 101 return FileSystemOperation::Create( |
| 102 url, context, make_scoped_ptr(new FileSystemOperationContext(context))); | 102 url, context, make_scoped_ptr(new FileSystemOperationContext(context))); |
| 103 } | 103 } |
| 104 | 104 |
| 105 scoped_ptr<webkit_blob::FileStreamReader> | 105 scoped_ptr<webkit_blob::FileStreamReader> |
| 106 IsolatedFileSystemBackend::CreateFileStreamReader( | 106 IsolatedFileSystemBackend::CreateFileStreamReader( |
| 107 const FileSystemURL& url, | 107 const FileSystemURL& url, |
| 108 int64 offset, | 108 int64 offset, |
| 109 const base::Time& expected_modification_time, | 109 const base::Time& expected_modification_time, |
| 110 FileSystemContext* context) const { | 110 FileSystemContext* context) const { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 121 return scoped_ptr<FileStreamWriter>(FileStreamWriter::CreateForLocalFile( | 121 return scoped_ptr<FileStreamWriter>(FileStreamWriter::CreateForLocalFile( |
| 122 context->default_file_task_runner(), url.path(), offset)); | 122 context->default_file_task_runner(), url.path(), offset)); |
| 123 } | 123 } |
| 124 | 124 |
| 125 FileSystemQuotaUtil* IsolatedFileSystemBackend::GetQuotaUtil() { | 125 FileSystemQuotaUtil* IsolatedFileSystemBackend::GetQuotaUtil() { |
| 126 // No quota support. | 126 // No quota support. |
| 127 return NULL; | 127 return NULL; |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace fileapi | 130 } // namespace fileapi |
| OLD | NEW |