Experimental push messaging api reference docs.
[chromium-blink-merge.git] / webkit / fileapi / file_system_callback_dispatcher.h
blobb9a70b0cbec477a7ebb35fd4a577b916a9390c42
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.
5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_CALLBACK_DISPATCHER_H_
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_CALLBACK_DISPATCHER_H_
8 #include <string>
9 #include <vector>
11 #include "base/file_util_proxy.h"
12 #include "base/platform_file.h"
13 #include "base/process.h"
14 #include "webkit/fileapi/fileapi_export.h"
16 class GURL;
18 namespace fileapi {
20 // This class mirrors the callbacks in
21 // third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallbacks.h,
22 // but uses chromium types.
23 class FILEAPI_EXPORT FileSystemCallbackDispatcher {
24 public:
25 virtual ~FileSystemCallbackDispatcher();
27 // Callback for various operations that don't require return values.
28 virtual void DidSucceed() = 0;
30 // Callback to report information for a file.
31 virtual void DidReadMetadata(
32 const base::PlatformFileInfo& file_info,
33 const FilePath& platform_path) = 0;
35 // Callback to report the contents of a directory. If the contents of
36 // the given directory are reported in one batch, then |entries| will have
37 // the list of all files/directories in the given directory, |has_more| will
38 // be false, and this callback will be called only once. If the contents of
39 // the given directory are reported in multiple chunks, then this callback
40 // will be called multiple times, |entries| will have only a subset of
41 // all contents (the subsets reported in any two calls are disjoint), and
42 // |has_more| will be true, except for the last chunk.
43 virtual void DidReadDirectory(
44 const std::vector<base::FileUtilProxy::Entry>& entries,
45 bool has_more) = 0;
47 // Callback for opening a file system. Called with a name and root path for
48 // the FileSystem when the request is accepted. Used by WebFileSystem API.
49 virtual void DidOpenFileSystem(const std::string& name,
50 const GURL& root) = 0;
52 // Called with an error code when a requested operation has failed.
53 virtual void DidFail(base::PlatformFileError error_code) = 0;
55 // Callback for FileWriter's write() call.
56 virtual void DidWrite(int64 bytes, bool complete) = 0;
58 // Callback for OpenFile. This isn't in WebFileSystemCallbacks, as it's just
59 // for Pepper.
60 // The method will be responsible for closing |file|.
61 virtual void DidOpenFile(
62 base::PlatformFile file);
65 } // namespace fileapi
67 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CALLBACK_DISPATCHER_H_