| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_FILEAPI_FILE_SYSTEM_CALLBACK_DISPATCHER_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_CALLBACK_DISPATCHER_H_ |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_CALLBACK_DISPATCHER_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_CALLBACK_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/file_util_proxy.h" | 10 #include "base/file_util_proxy.h" |
| 11 | 11 |
| 12 namespace fileapi { | 12 namespace fileapi { |
| 13 | 13 |
| 14 // This class mirrors the callbacks in | 14 // This class mirrors the callbacks in |
| 15 // third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallbacks.h, | 15 // third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallbacks.h, |
| 16 // but uses chromium types. | 16 // but uses chromium types. |
| 17 class FileSystemCallbackDispatcher { | 17 class FileSystemCallbackDispatcher { |
| 18 public: | 18 public: |
| 19 virtual ~FileSystemCallbackDispatcher() {} | 19 virtual ~FileSystemCallbackDispatcher() {} |
| 20 | 20 |
| 21 // Callback for various operations that don't require return values. | 21 // Callback for various operations that don't require return values. |
| 22 virtual void DidSucceed() = 0; | 22 virtual void DidSucceed() = 0; |
| 23 | 23 |
| 24 // Callback to report information for a file. | 24 // Callback to report information for a file. |
| 25 virtual void DidReadMetadata(const base::PlatformFileInfo& file_info) = 0; | 25 virtual void DidReadMetadata( |
| 26 const base::PlatformFileInfo& file_info, |
| 27 const FilePath& platform_path) = 0; |
| 26 | 28 |
| 27 // Callback to report the contents of a directory. If the contents of | 29 // Callback to report the contents of a directory. If the contents of |
| 28 // the given directory are reported in one batch, then |entries| will have | 30 // the given directory are reported in one batch, then |entries| will have |
| 29 // the list of all files/directories in the given directory, |has_more| will | 31 // the list of all files/directories in the given directory, |has_more| will |
| 30 // be false, and this callback will be called only once. If the contents of | 32 // be false, and this callback will be called only once. If the contents of |
| 31 // the given directory are reported in multiple chunks, then this callback | 33 // the given directory are reported in multiple chunks, then this callback |
| 32 // will be called multiple times, |entries| will have only a subset of | 34 // will be called multiple times, |entries| will have only a subset of |
| 33 // all contents (the subsets reported in any two calls are disjoint), and | 35 // all contents (the subsets reported in any two calls are disjoint), and |
| 34 // |has_more| will be true, except for the last chunk. | 36 // |has_more| will be true, except for the last chunk. |
| 35 virtual void DidReadDirectory( | 37 virtual void DidReadDirectory( |
| 36 const std::vector<base::FileUtilProxy::Entry>& entries, | 38 const std::vector<base::FileUtilProxy::Entry>& entries, |
| 37 bool has_more) = 0; | 39 bool has_more) = 0; |
| 38 | 40 |
| 39 // Callback for opening a file system. Called with a name and root path for | 41 // Callback for opening a file system. Called with a name and root path for |
| 40 // the FileSystem when the request is accepted. Used by WebFileSystem API. | 42 // the FileSystem when the request is accepted. Used by WebFileSystem API. |
| 41 virtual void DidOpenFileSystem(const std::string& name, | 43 virtual void DidOpenFileSystem(const std::string& name, |
| 42 const FilePath& root_path) = 0; | 44 const FilePath& root_path) = 0; |
| 43 | 45 |
| 44 // Called with an error code when a requested operation has failed. | 46 // Called with an error code when a requested operation has failed. |
| 45 virtual void DidFail(base::PlatformFileError error_code) = 0; | 47 virtual void DidFail(base::PlatformFileError error_code) = 0; |
| 46 | 48 |
| 47 // Callback for FileWriter's write() call. | 49 // Callback for FileWriter's write() call. |
| 48 virtual void DidWrite(int64 bytes, bool complete) = 0; | 50 virtual void DidWrite(int64 bytes, bool complete) = 0; |
| 49 }; | 51 }; |
| 50 | 52 |
| 51 } // namespace fileapi | 53 } // namespace fileapi |
| 52 | 54 |
| 53 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CALLBACK_DISPATCHER_H_ | 55 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CALLBACK_DISPATCHER_H_ |
| OLD | NEW |