| 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 15 matching lines...) Expand all Loading... |
| 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 #include "config.h" | 31 #include "config.h" |
| 32 #include "modules/filesystem/DOMFileSystemBase.h" | 32 #include "modules/filesystem/DOMFileSystemBase.h" |
| 33 | 33 |
| 34 #include "core/dom/ExecutionContext.h" | 34 #include "core/dom/ExecutionContext.h" |
| 35 #include "core/fileapi/FileError.h" | 35 #include "core/fileapi/FileError.h" |
| 36 #include "core/html/VoidCallback.h" | |
| 37 #include "modules/filesystem/DOMFilePath.h" | 36 #include "modules/filesystem/DOMFilePath.h" |
| 38 #include "modules/filesystem/DirectoryEntry.h" | 37 #include "modules/filesystem/DirectoryEntry.h" |
| 39 #include "modules/filesystem/DirectoryReaderBase.h" | 38 #include "modules/filesystem/DirectoryReaderBase.h" |
| 40 #include "modules/filesystem/EntriesCallback.h" | 39 #include "modules/filesystem/EntriesCallback.h" |
| 41 #include "modules/filesystem/Entry.h" | 40 #include "modules/filesystem/Entry.h" |
| 42 #include "modules/filesystem/EntryBase.h" | 41 #include "modules/filesystem/EntryBase.h" |
| 43 #include "modules/filesystem/EntryCallback.h" | 42 #include "modules/filesystem/EntryCallback.h" |
| 44 #include "modules/filesystem/ErrorCallback.h" | 43 #include "modules/filesystem/ErrorCallback.h" |
| 45 #include "modules/filesystem/FileSystemCallbacks.h" | 44 #include "modules/filesystem/FileSystemCallbacks.h" |
| 45 #include "modules/filesystem/FileSystemVoidCallback.h" |
| 46 #include "modules/filesystem/MetadataCallback.h" | 46 #include "modules/filesystem/MetadataCallback.h" |
| 47 #include "platform/weborigin/SecurityOrigin.h" | 47 #include "platform/weborigin/SecurityOrigin.h" |
| 48 #include "public/platform/Platform.h" | 48 #include "public/platform/Platform.h" |
| 49 #include "public/platform/WebFileSystem.h" | 49 #include "public/platform/WebFileSystem.h" |
| 50 #include "public/platform/WebFileSystemCallbacks.h" | 50 #include "public/platform/WebFileSystemCallbacks.h" |
| 51 #include "wtf/OwnPtr.h" | 51 #include "wtf/OwnPtr.h" |
| 52 #include "wtf/text/StringBuilder.h" | 52 #include "wtf/text/StringBuilder.h" |
| 53 | 53 |
| 54 namespace WebCore { | 54 namespace WebCore { |
| 55 | 55 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 reportError(errorCallback, FileError::create(FileError::INVALID_MODIFICA
TION_ERR)); | 242 reportError(errorCallback, FileError::create(FileError::INVALID_MODIFICA
TION_ERR)); |
| 243 return; | 243 return; |
| 244 } | 244 } |
| 245 | 245 |
| 246 OwnPtr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCal
lback, errorCallback, parent->filesystem(), destinationPath, source->isDirectory
())); | 246 OwnPtr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCal
lback, errorCallback, parent->filesystem(), destinationPath, source->isDirectory
())); |
| 247 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); | 247 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); |
| 248 | 248 |
| 249 fileSystem()->copy(createFileSystemURL(source), parent->filesystem()->create
FileSystemURL(destinationPath), callbacks.release()); | 249 fileSystem()->copy(createFileSystemURL(source), parent->filesystem()->create
FileSystemURL(destinationPath), callbacks.release()); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void DOMFileSystemBase::remove(const EntryBase* entry, PassRefPtr<VoidCallback>
successCallback, PassRefPtr<ErrorCallback> errorCallback, SynchronousType synchr
onousType) | 252 void DOMFileSystemBase::remove(const EntryBase* entry, PassRefPtr<FileSystemVoid
Callback> successCallback, PassRefPtr<ErrorCallback> errorCallback, SynchronousT
ype synchronousType) |
| 253 { | 253 { |
| 254 ASSERT(entry); | 254 ASSERT(entry); |
| 255 // We don't allow calling remove() on the root directory. | 255 // We don't allow calling remove() on the root directory. |
| 256 if (entry->fullPath() == String(DOMFilePath::root)) { | 256 if (entry->fullPath() == String(DOMFilePath::root)) { |
| 257 reportError(errorCallback, FileError::create(FileError::INVALID_MODIFICA
TION_ERR)); | 257 reportError(errorCallback, FileError::create(FileError::INVALID_MODIFICA
TION_ERR)); |
| 258 return; | 258 return; |
| 259 } | 259 } |
| 260 | 260 |
| 261 OwnPtr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(successCall
back, errorCallback, this)); | 261 OwnPtr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(successCall
back, errorCallback, this)); |
| 262 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); | 262 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); |
| 263 | 263 |
| 264 fileSystem()->remove(createFileSystemURL(entry), callbacks.release()); | 264 fileSystem()->remove(createFileSystemURL(entry), callbacks.release()); |
| 265 } | 265 } |
| 266 | 266 |
| 267 void DOMFileSystemBase::removeRecursively(const EntryBase* entry, PassRefPtr<Voi
dCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, Synchronous
Type synchronousType) | 267 void DOMFileSystemBase::removeRecursively(const EntryBase* entry, PassRefPtr<Fil
eSystemVoidCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, S
ynchronousType synchronousType) |
| 268 { | 268 { |
| 269 ASSERT(entry && entry->isDirectory()); | 269 ASSERT(entry && entry->isDirectory()); |
| 270 // We don't allow calling remove() on the root directory. | 270 // We don't allow calling remove() on the root directory. |
| 271 if (entry->fullPath() == String(DOMFilePath::root)) { | 271 if (entry->fullPath() == String(DOMFilePath::root)) { |
| 272 reportError(errorCallback, FileError::create(FileError::INVALID_MODIFICA
TION_ERR)); | 272 reportError(errorCallback, FileError::create(FileError::INVALID_MODIFICA
TION_ERR)); |
| 273 return; | 273 return; |
| 274 } | 274 } |
| 275 | 275 |
| 276 OwnPtr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(successCall
back, errorCallback, this)); | 276 OwnPtr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(successCall
back, errorCallback, this)); |
| 277 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); | 277 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 ASSERT(DOMFilePath::isAbsolute(path)); | 325 ASSERT(DOMFilePath::isAbsolute(path)); |
| 326 | 326 |
| 327 OwnPtr<AsyncFileSystemCallbacks> callbacks(EntriesCallbacks::create(successC
allback, errorCallback, reader, path)); | 327 OwnPtr<AsyncFileSystemCallbacks> callbacks(EntriesCallbacks::create(successC
allback, errorCallback, reader, path)); |
| 328 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); | 328 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); |
| 329 | 329 |
| 330 fileSystem()->readDirectory(createFileSystemURL(path), callbacks.release()); | 330 fileSystem()->readDirectory(createFileSystemURL(path), callbacks.release()); |
| 331 return true; | 331 return true; |
| 332 } | 332 } |
| 333 | 333 |
| 334 } // namespace WebCore | 334 } // namespace WebCore |
| OLD | NEW |