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 #if WEBKIT_IMPLEMENTATION | |
abarth-chromium
2013/08/30 16:18:25
You don;t need to wrap these forward declarations
kinuko
2013/09/03 09:32:49
Done.
| |
41 namespace WebCore { | |
42 class AsyncFileSystemCallbacks; | |
43 } | |
44 namespace WTF { template <typename T> class PassOwnPtr; } | |
45 #endif | |
46 | |
38 namespace WebKit { | 47 namespace WebKit { |
39 | 48 |
40 struct WebFileInfo; | 49 struct WebFileInfo; |
41 class WebFileWriter; | 50 class WebFileWriter; |
42 class WebString; | 51 class WebString; |
43 class WebURL; | 52 class WebURL; |
53 class WebFileSystemCallbacksPrivate; | |
44 | 54 |
45 class WebFileSystemCallbacks { | 55 class WebFileSystemCallbacks { |
46 public: | 56 public: |
57 ~WebFileSystemCallbacks() { reset(); } | |
58 WebFileSystemCallbacks() { } | |
59 WebFileSystemCallbacks(const WebFileSystemCallbacks& c) { assign(c); } | |
60 WebFileSystemCallbacks& operator=(const WebFileSystemCallbacks& c) | |
61 { | |
62 assign(c); | |
63 return *this; | |
64 } | |
65 | |
66 WEBKIT_EXPORT void reset(); | |
67 WEBKIT_EXPORT void assign(const WebFileSystemCallbacks&); | |
68 | |
69 #if WEBKIT_IMPLEMENTATION | |
70 WebFileSystemCallbacks(const WTF::PassOwnPtr<WebCore::AsyncFileSystemCallbac ks>&); | |
71 #endif | |
72 | |
47 // Callback for WebFileSystem's various operations that don't require | 73 // Callback for WebFileSystem's various operations that don't require |
48 // return values. | 74 // return values. |
49 virtual void didSucceed() = 0; | 75 WEBKIT_EXPORT void didSucceed(); |
50 | 76 |
51 // Callback for WebFileSystem::readMetadata. Called with the file metadata | 77 // Callback for WebFileSystem::readMetadata. Called with the file metadata |
52 // for the requested path. | 78 // for the requested path. |
53 virtual void didReadMetadata(const WebFileInfo&) = 0; | 79 WEBKIT_EXPORT void didReadMetadata(const WebFileInfo&); |
54 | 80 |
55 // Callback for WebFileSystem::createSnapshot. The metadata also includes th e | 81 // Callback for WebFileSystem::createSnapshot. The metadata also includes th e |
56 // platform file path. | 82 // platform file path. |
57 virtual void didCreateSnapshotFile(const WebFileInfo&) { WEBKIT_ASSERT_NOT_R EACHED(); } | 83 WEBKIT_EXPORT void didCreateSnapshotFile(const WebFileInfo&); |
58 | 84 |
59 // Callback for WebFileSystem::readDirectory. Called with a vector of | 85 // Callback for WebFileSystem::readDirectory. Called with a vector of |
60 // file entries in the requested directory. This callback might be called | 86 // file entries in the requested directory. This callback might be called |
61 // multiple times if the directory has many entries. |hasMore| must be | 87 // multiple times if the directory has many entries. |hasMore| must be |
62 // true when there are more entries. | 88 // true when there are more entries. |
63 virtual void didReadDirectory(const WebVector<WebFileSystemEntry>&, bool has More) = 0; | 89 WEBKIT_EXPORT void didReadDirectory(const WebVector<WebFileSystemEntry>&, bo ol hasMore); |
64 | 90 |
65 // Callback for WebFileSystem::openFileSystem. Called with a name and | 91 // Callback for WebFileSystem::openFileSystem. Called with a name and |
66 // root URL for the FileSystem when the request is accepted. | 92 // root URL for the FileSystem when the request is accepted. |
67 virtual void didOpenFileSystem(const WebString& name, const WebURL& rootURL) = 0; | 93 WEBKIT_EXPORT void didOpenFileSystem(const WebString& name, const WebURL& ro otURL); |
68 | 94 |
69 // Callback for WebFileSystem::createFileWriter. Called with an instance | 95 // Callback for WebFileSystem::createFileWriter. Called with an instance |
70 // of WebFileWriter and the target file length. The writer's ownership | 96 // of WebFileWriter and the target file length. The writer's ownership |
71 // is transferred to the callback. | 97 // is transferred to the callback. |
72 virtual void didCreateFileWriter(WebFileWriter* writer, long long length) { WEBKIT_ASSERT_NOT_REACHED(); } | 98 WEBKIT_EXPORT void didCreateFileWriter(WebFileWriter*, long long length); |
73 | 99 |
74 // Called with an error code when a requested operation hasn't been | 100 // Called with an error code when a requested operation hasn't been |
75 // completed. | 101 // completed. |
76 virtual void didFail(WebFileError) = 0; | 102 WEBKIT_EXPORT void didFail(WebFileError); |
77 | 103 |
78 // Returns true if the caller expects to be blocked until the request | 104 // Returns true if the caller expects to be blocked until the request |
79 // is fullfilled. | 105 // is fullfilled. |
80 virtual bool shouldBlockUntilCompletion() const = 0; | 106 WEBKIT_EXPORT bool shouldBlockUntilCompletion() const; |
81 | 107 |
82 protected: | 108 private: |
83 virtual ~WebFileSystemCallbacks() { } | 109 WebPrivatePtr<WebFileSystemCallbacksPrivate> m_private; |
84 }; | 110 }; |
85 | 111 |
86 } // namespace WebKit | 112 } // namespace WebKit |
87 | 113 |
88 #endif | 114 #endif |
OLD | NEW |