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