| 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/isolated_mount_point_provider.h" | 5 #include "webkit/fileapi/isolated_mount_point_provider.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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
| 13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
| 14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
| 15 #include "webkit/blob/local_file_stream_reader.h" | 15 #include "webkit/blob/local_file_stream_reader.h" |
| 16 #include "webkit/fileapi/async_file_util_adapter.h" | 16 #include "webkit/fileapi/async_file_util_adapter.h" |
| 17 #include "webkit/fileapi/copy_or_move_file_validator.h" | 17 #include "webkit/fileapi/copy_or_move_file_validator.h" |
| 18 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 18 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
| 19 #include "webkit/fileapi/file_system_context.h" | 19 #include "webkit/fileapi/file_system_context.h" |
| 20 #include "webkit/fileapi/file_system_file_stream_reader.h" | 20 #include "webkit/fileapi/file_system_file_stream_reader.h" |
| 21 #include "webkit/fileapi/file_system_operation_context.h" | 21 #include "webkit/fileapi/file_system_operation_context.h" |
| 22 #include "webkit/fileapi/file_system_task_runners.h" | 22 #include "webkit/fileapi/file_system_task_runners.h" |
| 23 #include "webkit/fileapi/file_system_types.h" | 23 #include "webkit/fileapi/file_system_types.h" |
| 24 #include "webkit/fileapi/file_system_util.h" | 24 #include "webkit/fileapi/file_system_util.h" |
| 25 #include "webkit/fileapi/isolated_context.h" | 25 #include "webkit/fileapi/isolated_context.h" |
| 26 #include "webkit/fileapi/isolated_file_util.h" | 26 #include "webkit/fileapi/isolated_file_util.h" |
| 27 #include "webkit/fileapi/local_file_stream_writer.h" | 27 #include "webkit/fileapi/local_file_stream_writer.h" |
| 28 #include "webkit/fileapi/local_file_system_operation.h" | 28 #include "webkit/fileapi/local_file_system_operation.h" |
| 29 #include "webkit/fileapi/native_file_util.h" | 29 #include "webkit/fileapi/native_file_util.h" |
| 30 #include "webkit/fileapi/transient_file_util.h" |
| 30 | 31 |
| 31 namespace fileapi { | 32 namespace fileapi { |
| 32 | 33 |
| 33 IsolatedMountPointProvider::IsolatedMountPointProvider() | 34 IsolatedMountPointProvider::IsolatedMountPointProvider() |
| 34 : isolated_file_util_(new AsyncFileUtilAdapter(new IsolatedFileUtil())), | 35 : isolated_file_util_(new AsyncFileUtilAdapter(new IsolatedFileUtil())), |
| 35 dragged_file_util_(new AsyncFileUtilAdapter(new DraggedFileUtil())) { | 36 dragged_file_util_(new AsyncFileUtilAdapter(new DraggedFileUtil())), |
| 37 transient_file_util_(new AsyncFileUtilAdapter(new TransientFileUtil())) { |
| 36 } | 38 } |
| 37 | 39 |
| 38 IsolatedMountPointProvider::~IsolatedMountPointProvider() { | 40 IsolatedMountPointProvider::~IsolatedMountPointProvider() { |
| 39 } | 41 } |
| 40 | 42 |
| 41 bool IsolatedMountPointProvider::CanHandleType(FileSystemType type) const { | 43 bool IsolatedMountPointProvider::CanHandleType(FileSystemType type) const { |
| 42 switch (type) { | 44 switch (type) { |
| 43 case kFileSystemTypeIsolated: | 45 case kFileSystemTypeIsolated: |
| 44 case kFileSystemTypeDragged: | 46 case kFileSystemTypeDragged: |
| 47 case kFileSystemTypeForTransientFile: |
| 45 return true; | 48 return true; |
| 46 #if !defined(OS_CHROMEOS) | 49 #if !defined(OS_CHROMEOS) |
| 47 case kFileSystemTypeNativeLocal: | 50 case kFileSystemTypeNativeLocal: |
| 48 case kFileSystemTypeNativeForPlatformApp: | 51 case kFileSystemTypeNativeForPlatformApp: |
| 49 return true; | 52 return true; |
| 50 #endif | 53 #endif |
| 51 default: | 54 default: |
| 52 return false; | 55 return false; |
| 53 } | 56 } |
| 54 } | 57 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 72 return base::FilePath(); | 75 return base::FilePath(); |
| 73 } | 76 } |
| 74 | 77 |
| 75 FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil( | 78 FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil( |
| 76 FileSystemType type) { | 79 FileSystemType type) { |
| 77 switch (type) { | 80 switch (type) { |
| 78 case kFileSystemTypeNativeLocal: | 81 case kFileSystemTypeNativeLocal: |
| 79 return isolated_file_util_->sync_file_util(); | 82 return isolated_file_util_->sync_file_util(); |
| 80 case kFileSystemTypeDragged: | 83 case kFileSystemTypeDragged: |
| 81 return dragged_file_util_->sync_file_util(); | 84 return dragged_file_util_->sync_file_util(); |
| 85 case kFileSystemTypeForTransientFile: |
| 86 return transient_file_util_->sync_file_util(); |
| 82 default: | 87 default: |
| 83 NOTREACHED(); | 88 NOTREACHED(); |
| 84 } | 89 } |
| 85 return NULL; | 90 return NULL; |
| 86 } | 91 } |
| 87 | 92 |
| 88 AsyncFileUtil* IsolatedMountPointProvider::GetAsyncFileUtil( | 93 AsyncFileUtil* IsolatedMountPointProvider::GetAsyncFileUtil( |
| 89 FileSystemType type) { | 94 FileSystemType type) { |
| 90 switch (type) { | 95 switch (type) { |
| 91 case kFileSystemTypeNativeLocal: | 96 case kFileSystemTypeNativeLocal: |
| 92 return isolated_file_util_.get(); | 97 return isolated_file_util_.get(); |
| 93 case kFileSystemTypeDragged: | 98 case kFileSystemTypeDragged: |
| 94 return dragged_file_util_.get(); | 99 return dragged_file_util_.get(); |
| 100 case kFileSystemTypeForTransientFile: |
| 101 return transient_file_util_.get(); |
| 95 default: | 102 default: |
| 96 NOTREACHED(); | 103 NOTREACHED(); |
| 97 } | 104 } |
| 98 return NULL; | 105 return NULL; |
| 99 } | 106 } |
| 100 | 107 |
| 101 CopyOrMoveFileValidatorFactory* | 108 CopyOrMoveFileValidatorFactory* |
| 102 IsolatedMountPointProvider::GetCopyOrMoveFileValidatorFactory( | 109 IsolatedMountPointProvider::GetCopyOrMoveFileValidatorFactory( |
| 103 FileSystemType type, base::PlatformFileError* error_code) { | 110 FileSystemType type, base::PlatformFileError* error_code) { |
| 104 DCHECK(error_code); | 111 DCHECK(error_code); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 void IsolatedMountPointProvider::DeleteFileSystem( | 167 void IsolatedMountPointProvider::DeleteFileSystem( |
| 161 const GURL& origin_url, | 168 const GURL& origin_url, |
| 162 FileSystemType type, | 169 FileSystemType type, |
| 163 FileSystemContext* context, | 170 FileSystemContext* context, |
| 164 const DeleteFileSystemCallback& callback) { | 171 const DeleteFileSystemCallback& callback) { |
| 165 NOTREACHED(); | 172 NOTREACHED(); |
| 166 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 173 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); |
| 167 } | 174 } |
| 168 | 175 |
| 169 } // namespace fileapi | 176 } // namespace fileapi |
| OLD | NEW |