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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebFileSystem_h | 31 #ifndef WebFileSystem_h |
32 #define WebFileSystem_h | 32 #define WebFileSystem_h |
33 | 33 |
34 #include "WebCommon.h" | 34 #include "WebCommon.h" |
35 #include "WebFileSystemCallbacks.h" | 35 #include "WebFileSystemCallbacks.h" |
36 #include "WebFileSystemType.h" | 36 #include "WebFileSystemType.h" |
37 #include "WebURL.h" | 37 #include "WebURL.h" |
38 | 38 |
| 39 // FIXME: Remove this #define. |
| 40 #define READ_DIRECTORY_RETURNS_INT |
| 41 |
39 namespace blink { | 42 namespace blink { |
40 | 43 |
41 class WebFileWriter; | 44 class WebFileWriter; |
42 class WebFileWriterClient; | 45 class WebFileWriterClient; |
43 | 46 |
44 class WebFileSystem { | 47 class WebFileSystem { |
45 public: | 48 public: |
46 enum Type { | 49 enum Type { |
47 TypeTemporary, | 50 TypeTemporary, |
48 TypePersistent, | 51 TypePersistent, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // Checks if a file exists at a given |path|. | 129 // Checks if a file exists at a given |path|. |
127 // WebFileSystemCallbacks::didSucceed() must be called when the operation is
completed successfully. | 130 // WebFileSystemCallbacks::didSucceed() must be called when the operation is
completed successfully. |
128 // WebFileSystemCallbacks::didFail() must be called otherwise. | 131 // WebFileSystemCallbacks::didFail() must be called otherwise. |
129 virtual void fileExists(const WebURL& path, WebFileSystemCallbacks) { BLINK_
ASSERT_NOT_REACHED(); } | 132 virtual void fileExists(const WebURL& path, WebFileSystemCallbacks) { BLINK_
ASSERT_NOT_REACHED(); } |
130 | 133 |
131 // Checks if a directory exists at a given |path|. | 134 // Checks if a directory exists at a given |path|. |
132 // WebFileSystemCallbacks::didSucceed() must be called when the operation is
completed successfully. | 135 // WebFileSystemCallbacks::didSucceed() must be called when the operation is
completed successfully. |
133 // WebFileSystemCallbacks::didFail() must be called otherwise. | 136 // WebFileSystemCallbacks::didFail() must be called otherwise. |
134 virtual void directoryExists(const WebURL& path, WebFileSystemCallbacks) { B
LINK_ASSERT_NOT_REACHED(); } | 137 virtual void directoryExists(const WebURL& path, WebFileSystemCallbacks) { B
LINK_ASSERT_NOT_REACHED(); } |
135 | 138 |
136 // Reads directory entries of a given directory at |path|. | 139 // Reads directory entries of a given directory at |path| and returns a call
backs ID which can be used to wait for additional results. |
137 // WebFileSystemCallbacks::didReadDirectory() must be called when the operat
ion is completed successfully. | 140 // WebFileSystemCallbacks::didReadDirectory() must be called when the operat
ion is completed successfully. |
138 // WebFileSystemCallbacks::didFail() must be called otherwise. | 141 // WebFileSystemCallbacks::didFail() must be called otherwise. |
139 virtual void readDirectory(const WebURL& path, WebFileSystemCallbacks) { BLI
NK_ASSERT_NOT_REACHED(); } | 142 virtual int readDirectory(const WebURL& path, WebFileSystemCallbacks) { BLIN
K_ASSERT_NOT_REACHED(); return 0; } |
140 | 143 |
141 // Creates a WebFileWriter that can be used to write to the given file. | 144 // Creates a WebFileWriter that can be used to write to the given file. |
142 // WebFileSystemCallbacks::didCreateFileWriter() must be called with the cre
ated WebFileWriter when the operation is completed successfully. | 145 // WebFileSystemCallbacks::didCreateFileWriter() must be called with the cre
ated WebFileWriter when the operation is completed successfully. |
143 // WebFileSystemCallbacks::didFail() must be called otherwise. | 146 // WebFileSystemCallbacks::didFail() must be called otherwise. |
144 virtual void createFileWriter(const WebURL& path, WebFileWriterClient*, WebF
ileSystemCallbacks) { BLINK_ASSERT_NOT_REACHED(); } | 147 virtual void createFileWriter(const WebURL& path, WebFileWriterClient*, WebF
ileSystemCallbacks) { BLINK_ASSERT_NOT_REACHED(); } |
145 | 148 |
146 // Creates a snapshot file for a given file specified by |path|. It returns
the metadata of the created snapshot file. | 149 // Creates a snapshot file for a given file specified by |path|. It returns
the metadata of the created snapshot file. |
147 // The returned metadata should include a local platform path to the snapsho
t image. | 150 // The returned metadata should include a local platform path to the snapsho
t image. |
148 // In local filesystem cases the backend may simply return the metadata of t
he file itself (as well as readMetadata does), while in | 151 // In local filesystem cases the backend may simply return the metadata of t
he file itself (as well as readMetadata does), while in |
149 // remote filesystem case the backend may download the file into a temporary
snapshot file and return the metadata of the temporary file. | 152 // remote filesystem case the backend may download the file into a temporary
snapshot file and return the metadata of the temporary file. |
150 // The returned metadata is used to create a File object for the |path|. | 153 // The returned metadata is used to create a File object for the |path|. |
151 // The snapshot file is supposed to be deleted when the last reference to a
WebCore::File referring to it's path is dropped. | 154 // The snapshot file is supposed to be deleted when the last reference to a
WebCore::File referring to it's path is dropped. |
152 // WebFileSystemCallbacks::didCreateSnapshotFile() with the metadata of the
snapshot file must be called when the operation is completed successfully. | 155 // WebFileSystemCallbacks::didCreateSnapshotFile() with the metadata of the
snapshot file must be called when the operation is completed successfully. |
153 // WebFileSystemCallbacks::didFail() must be called otherwise. | 156 // WebFileSystemCallbacks::didFail() must be called otherwise. |
154 virtual void createSnapshotFileAndReadMetadata(const WebURL& path, WebFileSy
stemCallbacks) { BLINK_ASSERT_NOT_REACHED(); } | 157 virtual void createSnapshotFileAndReadMetadata(const WebURL& path, WebFileSy
stemCallbacks) { BLINK_ASSERT_NOT_REACHED(); } |
155 | 158 |
| 159 // Waits for additional results returned for the method call and returns tru
e if possible. |
| 160 // Returns false if there is no running method call corresponding for the gi
ven ID. |
| 161 // |callbacksId| must be the value returned by the original method call. |
| 162 virtual bool waitForAdditionalResult(int callbacksId) { BLINK_ASSERT_NOT_REA
CHED(); return false; } |
| 163 |
156 protected: | 164 protected: |
157 virtual ~WebFileSystem() { } | 165 virtual ~WebFileSystem() { } |
158 }; | 166 }; |
159 | 167 |
160 } // namespace blink | 168 } // namespace blink |
161 | 169 |
162 #endif | 170 #endif |
OLD | NEW |