| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/id_map.h" | 11 #include "base/id_map.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "webkit/browser/fileapi/file_system_operation.h" | 14 #include "webkit/browser/fileapi/file_system_operation.h" |
| 15 #include "webkit/browser/fileapi/file_system_url.h" | 15 #include "webkit/browser/fileapi/file_system_url.h" |
| 16 #include "webkit/storage/webkit_storage_export.h" | 16 #include "webkit/browser/webkit_storage_browser_export.h" |
| 17 | 17 |
| 18 namespace fileapi { | 18 namespace fileapi { |
| 19 | 19 |
| 20 class FileSystemURL; | 20 class FileSystemURL; |
| 21 class FileSystemContext; | 21 class FileSystemContext; |
| 22 | 22 |
| 23 // A central interface for running FileSystem API operations. | 23 // A central interface for running FileSystem API operations. |
| 24 // All operation methods take callback and returns OperationID, which is | 24 // All operation methods take callback and returns OperationID, which is |
| 25 // an integer value which can be used for cancelling an operation. | 25 // an integer value which can be used for cancelling an operation. |
| 26 // All operation methods return kErrorOperationID if running (posting) an | 26 // All operation methods return kErrorOperationID if running (posting) an |
| 27 // operation fails, in addition to dispatching the callback with an error | 27 // operation fails, in addition to dispatching the callback with an error |
| 28 // code (therefore in most cases the caller does not need to check the | 28 // code (therefore in most cases the caller does not need to check the |
| 29 // returned operation ID). | 29 // returned operation ID). |
| 30 // | 30 // |
| 31 // Some operations (e.g. CopyInForeignFile, RemoveFile, RemoveDirectory, | 31 // Some operations (e.g. CopyInForeignFile, RemoveFile, RemoveDirectory, |
| 32 // CopyFileLocal, MoveFileLocal and SyncGetPlatformPath) are only supported | 32 // CopyFileLocal, MoveFileLocal and SyncGetPlatformPath) are only supported |
| 33 // by filesystems which implement LocalFileSystemOperation. | 33 // by filesystems which implement LocalFileSystemOperation. |
| 34 // If they are called on other filesystems | 34 // If they are called on other filesystems |
| 35 // base::PLATFORM_FILE_ERROR_INVALID_OPERATION is returned via callback. | 35 // base::PLATFORM_FILE_ERROR_INVALID_OPERATION is returned via callback. |
| 36 class WEBKIT_STORAGE_EXPORT FileSystemOperationRunner | 36 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner |
| 37 : public base::SupportsWeakPtr<FileSystemOperationRunner> { | 37 : public base::SupportsWeakPtr<FileSystemOperationRunner> { |
| 38 public: | 38 public: |
| 39 typedef FileSystemOperation::GetMetadataCallback GetMetadataCallback; | 39 typedef FileSystemOperation::GetMetadataCallback GetMetadataCallback; |
| 40 typedef FileSystemOperation::ReadDirectoryCallback ReadDirectoryCallback; | 40 typedef FileSystemOperation::ReadDirectoryCallback ReadDirectoryCallback; |
| 41 typedef FileSystemOperation::SnapshotFileCallback SnapshotFileCallback; | 41 typedef FileSystemOperation::SnapshotFileCallback SnapshotFileCallback; |
| 42 typedef FileSystemOperation::StatusCallback StatusCallback; | 42 typedef FileSystemOperation::StatusCallback StatusCallback; |
| 43 typedef FileSystemOperation::WriteCallback WriteCallback; | 43 typedef FileSystemOperation::WriteCallback WriteCallback; |
| 44 typedef FileSystemOperation::OpenFileCallback OpenFileCallback; | 44 typedef FileSystemOperation::OpenFileCallback OpenFileCallback; |
| 45 | 45 |
| 46 typedef int OperationID; | 46 typedef int OperationID; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 // we can notify observers when we're done. | 285 // we can notify observers when we're done. |
| 286 typedef std::map<OperationID, FileSystemURLSet> OperationToURLSet; | 286 typedef std::map<OperationID, FileSystemURLSet> OperationToURLSet; |
| 287 OperationToURLSet write_target_urls_; | 287 OperationToURLSet write_target_urls_; |
| 288 | 288 |
| 289 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunner); | 289 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunner); |
| 290 }; | 290 }; |
| 291 | 291 |
| 292 } // namespace fileapi | 292 } // namespace fileapi |
| 293 | 293 |
| 294 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ | 294 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ |
| OLD | NEW |