Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_CALLBACK_DISPATCHER_H_ | |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_CALLBACK_DISPATCHER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/files/file_util_proxy.h" | |
| 12 #include "base/platform_file.h" | |
| 13 #include "base/process.h" | |
| 14 #include "webkit/quota/quota_types.h" | |
| 15 #include "webkit/storage/webkit_storage_export.h" | |
| 16 | |
| 17 class GURL; | |
| 18 | |
| 19 namespace fileapi { | |
| 20 | |
| 21 // This class mirrors the callbacks in | |
| 22 // third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallbacks.h, | |
| 23 // but uses chromium types. | |
|
michaeln
2013/05/14 22:18:58
The code looks correct and all but I don't really
kinuko
2013/05/15 13:58:03
In the new patch one callback in Blink/WebKit is a
| |
| 24 class WEBKIT_STORAGE_EXPORT FileSystemCallbackDispatcher { | |
| 25 public: | |
| 26 virtual ~FileSystemCallbackDispatcher(); | |
| 27 | |
| 28 // Callback for various operations that don't require return values. | |
| 29 virtual void DidSucceed() = 0; | |
| 30 | |
| 31 // Callback to report information for a file. | |
| 32 virtual void DidReadMetadata( | |
| 33 const base::PlatformFileInfo& file_info, | |
| 34 const base::FilePath& platform_path) = 0; | |
| 35 | |
| 36 // Callback to report information for a file and its actual file path. | |
| 37 virtual void DidCreateSnapshotFile( | |
| 38 const base::PlatformFileInfo& file_info, | |
| 39 const base::FilePath& platform_path) = 0; | |
| 40 | |
| 41 // Callback to report the contents of a directory. If the contents of | |
| 42 // the given directory are reported in one batch, then |entries| will have | |
| 43 // the list of all files/directories in the given directory, |has_more| will | |
| 44 // be false, and this callback will be called only once. If the contents of | |
| 45 // the given directory are reported in multiple chunks, then this callback | |
| 46 // will be called multiple times, |entries| will have only a subset of | |
| 47 // all contents (the subsets reported in any two calls are disjoint), and | |
| 48 // |has_more| will be true, except for the last chunk. | |
| 49 virtual void DidReadDirectory( | |
| 50 const std::vector<base::FileUtilProxy::Entry>& entries, | |
| 51 bool has_more) = 0; | |
| 52 | |
| 53 // Callback for opening a file system. Called with a name and root path for | |
| 54 // the FileSystem when the request is accepted. Used by WebFileSystem API. | |
| 55 virtual void DidOpenFileSystem(const std::string& name, | |
| 56 const GURL& root) = 0; | |
| 57 | |
| 58 // Called with an error code when a requested operation has failed. | |
| 59 virtual void DidFail(base::PlatformFileError error_code) = 0; | |
| 60 | |
| 61 // Callback for FileWriter's write() call. | |
| 62 virtual void DidWrite(int64 bytes, bool complete) = 0; | |
| 63 | |
| 64 // Callback for OpenFile. This isn't in WebFileSystemCallbacks, as it's just | |
| 65 // for Pepper. | |
| 66 // The method will be responsible for closing |file|. | |
| 67 virtual void DidOpenFile(base::PlatformFile file, | |
| 68 int file_open_id, | |
| 69 quota::QuotaLimitType quota_policy); | |
| 70 }; | |
| 71 | |
| 72 } // namespace fileapi | |
| 73 | |
| 74 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CALLBACK_DISPATCHER_H_ | |
| OLD | NEW |