| 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 #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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/files/file_util_proxy.h" | |
| 12 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
| 13 #include "base/process.h" | 12 #include "base/process.h" |
| 13 #include "webkit/fileapi/file_system_operation.h" |
| 14 #include "webkit/quota/quota_types.h" | 14 #include "webkit/quota/quota_types.h" |
| 15 #include "webkit/storage/webkit_storage_export.h" | 15 #include "webkit/storage/webkit_storage_export.h" |
| 16 | 16 |
| 17 class GURL; | 17 class GURL; |
| 18 | 18 |
| 19 namespace fileapi { | 19 namespace fileapi { |
| 20 | 20 |
| 21 // This class mirrors the callbacks in | 21 // This class mirrors the callbacks in |
| 22 // third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallbacks.h, | 22 // third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallbacks.h, |
| 23 // but uses chromium types. | 23 // but uses chromium types. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 // Callback to report the contents of a directory. If the contents of | 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 | 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 | 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 | 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 | 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 | 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 | 47 // all contents (the subsets reported in any two calls are disjoint), and |
| 48 // |has_more| will be true, except for the last chunk. | 48 // |has_more| will be true, except for the last chunk. |
| 49 virtual void DidReadDirectory( | 49 virtual void DidReadDirectory( |
| 50 const std::vector<base::FileUtilProxy::Entry>& entries, | 50 const std::vector<FileSystemOperation::Entry>& entries, |
| 51 bool has_more) = 0; | 51 bool has_more) = 0; |
| 52 | 52 |
| 53 // Callback for opening a file system. Called with a name and root path for | 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. | 54 // the FileSystem when the request is accepted. Used by WebFileSystem API. |
| 55 virtual void DidOpenFileSystem(const std::string& name, | 55 virtual void DidOpenFileSystem(const std::string& name, |
| 56 const GURL& root) = 0; | 56 const GURL& root) = 0; |
| 57 | 57 |
| 58 // Called with an error code when a requested operation has failed. | 58 // Called with an error code when a requested operation has failed. |
| 59 virtual void DidFail(base::PlatformFileError error_code) = 0; | 59 virtual void DidFail(base::PlatformFileError error_code) = 0; |
| 60 | 60 |
| 61 // Callback for FileWriter's write() call. | 61 // Callback for FileWriter's write() call. |
| 62 virtual void DidWrite(int64 bytes, bool complete) = 0; | 62 virtual void DidWrite(int64 bytes, bool complete) = 0; |
| 63 | 63 |
| 64 // Callback for OpenFile. This isn't in WebFileSystemCallbacks, as it's just | 64 // Callback for OpenFile. This isn't in WebFileSystemCallbacks, as it's just |
| 65 // for Pepper. | 65 // for Pepper. |
| 66 // The method will be responsible for closing |file|. | 66 // The method will be responsible for closing |file|. |
| 67 virtual void DidOpenFile(base::PlatformFile file, | 67 virtual void DidOpenFile(base::PlatformFile file, |
| 68 int file_open_id, | 68 int file_open_id, |
| 69 quota::QuotaLimitType quota_policy); | 69 quota::QuotaLimitType quota_policy); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace fileapi | 72 } // namespace fileapi |
| 73 | 73 |
| 74 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CALLBACK_DISPATCHER_H_ | 74 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CALLBACK_DISPATCHER_H_ |
| OLD | NEW |