OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebFileSystemCallbacks_h | 31 #ifndef WebFileSystemCallbacks_h |
32 #define WebFileSystemCallbacks_h | 32 #define WebFileSystemCallbacks_h |
33 | 33 |
| 34 #include "WebCommon.h" |
34 #include "WebFileError.h" | 35 #include "WebFileError.h" |
35 #include "WebFileSystemEntry.h" | 36 #include "WebFileSystemEntry.h" |
| 37 #include "WebPrivatePtr.h" |
36 #include "WebVector.h" | 38 #include "WebVector.h" |
37 | 39 |
| 40 namespace WebCore { |
| 41 class AsyncFileSystemCallbacks; |
| 42 } |
| 43 namespace WTF { template <typename T> class PassOwnPtr; } |
| 44 |
38 namespace WebKit { | 45 namespace WebKit { |
39 | 46 |
40 struct WebFileInfo; | 47 struct WebFileInfo; |
41 class WebFileWriter; | 48 class WebFileWriter; |
42 class WebString; | 49 class WebString; |
43 class WebURL; | 50 class WebURL; |
| 51 class WebFileSystemCallbacksPrivate; |
44 | 52 |
45 class WebFileSystemCallbacks { | 53 class WebFileSystemCallbacks { |
46 public: | 54 public: |
| 55 ~WebFileSystemCallbacks() { reset(); } |
| 56 WebFileSystemCallbacks() { } |
| 57 WebFileSystemCallbacks(const WebFileSystemCallbacks& c) { assign(c); } |
| 58 WebFileSystemCallbacks& operator=(const WebFileSystemCallbacks& c) |
| 59 { |
| 60 assign(c); |
| 61 return *this; |
| 62 } |
| 63 |
| 64 WEBKIT_EXPORT void reset(); |
| 65 WEBKIT_EXPORT void assign(const WebFileSystemCallbacks&); |
| 66 |
| 67 #if WEBKIT_IMPLEMENTATION |
| 68 WebFileSystemCallbacks(const WTF::PassOwnPtr<WebCore::AsyncFileSystemCallbac
ks>&); |
| 69 #endif |
| 70 |
47 // Callback for WebFileSystem's various operations that don't require | 71 // Callback for WebFileSystem's various operations that don't require |
48 // return values. | 72 // return values. |
49 virtual void didSucceed() = 0; | 73 WEBKIT_EXPORT void didSucceed(); |
50 | 74 |
51 // Callback for WebFileSystem::readMetadata. Called with the file metadata | 75 // Callback for WebFileSystem::readMetadata. Called with the file metadata |
52 // for the requested path. | 76 // for the requested path. |
53 virtual void didReadMetadata(const WebFileInfo&) = 0; | 77 WEBKIT_EXPORT void didReadMetadata(const WebFileInfo&); |
54 | 78 |
55 // Callback for WebFileSystem::createSnapshot. The metadata also includes th
e | 79 // Callback for WebFileSystem::createSnapshot. The metadata also includes th
e |
56 // platform file path. | 80 // platform file path. |
57 virtual void didCreateSnapshotFile(const WebFileInfo&) { WEBKIT_ASSERT_NOT_R
EACHED(); } | 81 WEBKIT_EXPORT void didCreateSnapshotFile(const WebFileInfo&); |
58 | 82 |
59 // Callback for WebFileSystem::readDirectory. Called with a vector of | 83 // Callback for WebFileSystem::readDirectory. Called with a vector of |
60 // file entries in the requested directory. This callback might be called | 84 // file entries in the requested directory. This callback might be called |
61 // multiple times if the directory has many entries. |hasMore| must be | 85 // multiple times if the directory has many entries. |hasMore| must be |
62 // true when there are more entries. | 86 // true when there are more entries. |
63 virtual void didReadDirectory(const WebVector<WebFileSystemEntry>&, bool has
More) = 0; | 87 WEBKIT_EXPORT void didReadDirectory(const WebVector<WebFileSystemEntry>&, bo
ol hasMore); |
64 | 88 |
65 // Callback for WebFileSystem::openFileSystem. Called with a name and | 89 // Callback for WebFileSystem::openFileSystem. Called with a name and |
66 // root URL for the FileSystem when the request is accepted. | 90 // root URL for the FileSystem when the request is accepted. |
67 virtual void didOpenFileSystem(const WebString& name, const WebURL& rootURL)
= 0; | 91 WEBKIT_EXPORT void didOpenFileSystem(const WebString& name, const WebURL& ro
otURL); |
68 | 92 |
69 // Callback for WebFileSystem::createFileWriter. Called with an instance | 93 // Callback for WebFileSystem::createFileWriter. Called with an instance |
70 // of WebFileWriter and the target file length. The writer's ownership | 94 // of WebFileWriter and the target file length. The writer's ownership |
71 // is transferred to the callback. | 95 // is transferred to the callback. |
72 virtual void didCreateFileWriter(WebFileWriter* writer, long long length) {
WEBKIT_ASSERT_NOT_REACHED(); } | 96 WEBKIT_EXPORT void didCreateFileWriter(WebFileWriter*, long long length); |
73 | 97 |
74 // Called with an error code when a requested operation hasn't been | 98 // Called with an error code when a requested operation hasn't been |
75 // completed. | 99 // completed. |
76 virtual void didFail(WebFileError) = 0; | 100 WEBKIT_EXPORT void didFail(WebFileError); |
77 | 101 |
78 // Returns true if the caller expects to be blocked until the request | 102 // Returns true if the caller expects to be blocked until the request |
79 // is fullfilled. | 103 // is fullfilled. |
80 virtual bool shouldBlockUntilCompletion() const = 0; | 104 WEBKIT_EXPORT bool shouldBlockUntilCompletion() const; |
81 | 105 |
82 protected: | 106 private: |
83 virtual ~WebFileSystemCallbacks() { } | 107 WebPrivatePtr<WebFileSystemCallbacksPrivate> m_private; |
84 }; | 108 }; |
85 | 109 |
86 } // namespace WebKit | 110 } // namespace WebKit |
87 | 111 |
88 #endif | 112 #endif |
OLD | NEW |