void DOMFileSystemBase::getDirectory(const EntryBase* entry, const String& path, const FileSystemFlags& flags, EntryCallback* successCallback, ErrorCallbackBase* errorCallback, SynchronousType synchronousType) { if (!fileSystem()) { reportError(errorCallback, FileError::kAbortErr); return; } String absolutePath; if (!pathToAbsolutePath(m_type, entry, path, absolutePath)) { reportError(errorCallback, FileError::kInvalidModificationErr); return; } std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create( successCallback, errorCallback, m_context, this, absolutePath, true)); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); if (flags.createFlag()) fileSystem()->createDirectory(createFileSystemURL(absolutePath), flags.exclusive(), std::move(callbacks)); else fileSystem()->directoryExists(createFileSystemURL(absolutePath), std::move(callbacks)); }
bool DOMFileSystemBase::getDirectory(const EntryBase* entry, const String& path, PassRefPtr<WebKitFlags> flags, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) { String absolutePath; if (!pathToAbsolutePath(m_asyncFileSystem->type(), entry, path, absolutePath)) return false; OwnPtr<EntryCallbacks> callbacks = EntryCallbacks::create(successCallback, errorCallback, this, absolutePath, true); if (flags && flags->isCreate()) m_asyncFileSystem->createDirectory(absolutePath, flags->isExclusive(), callbacks.release()); else m_asyncFileSystem->directoryExists(absolutePath, callbacks.release()); return true; }
bool DOMFileSystemBase::getFile(const EntryBase* entry, const String& path, const FileSystemFlags& flags, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) { String absolutePath; if (!pathToAbsolutePath(m_type, entry, path, absolutePath)) return false; OwnPtr<EntryCallbacks> callbacks = EntryCallbacks::create(successCallback, errorCallback, this, absolutePath, false); if (flags.create) m_asyncFileSystem->createFile(createFileSystemURL(absolutePath), flags.exclusive, callbacks.release()); else m_asyncFileSystem->fileExists(createFileSystemURL(absolutePath), callbacks.release()); return true; }
bool DOMFileSystemBase::getDirectory(const EntryBase* base, const String& path, PassRefPtr<Flags> flags, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) { String absolutePath; if (!pathToAbsolutePath(base, path, absolutePath)) return false; String platformPath = m_asyncFileSystem->virtualToPlatformPath(absolutePath); OwnPtr<EntryCallbacks> callbacks = EntryCallbacks::create(successCallback, errorCallback, this, absolutePath, true); if (flags && flags->isCreate()) m_asyncFileSystem->createDirectory(platformPath, flags->isExclusive(), callbacks.release()); else m_asyncFileSystem->directoryExists(platformPath, callbacks.release()); return true; }
void DOMFileSystemBase::getFile(const EntryBase* entry, const String& path, const FileSystemFlags& flags, EntryCallback* successCallback, ErrorCallback* errorCallback, SynchronousType synchronousType) { if (!fileSystem()) { reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); return; } String absolutePath; if (!pathToAbsolutePath(m_type, entry, path, absolutePath)) { reportError(errorCallback, FileError::create(FileError::INVALID_MODIFICATION_ERR)); return; } std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, this, absolutePath, false)); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); if (flags.createFlag()) fileSystem()->createFile(createFileSystemURL(absolutePath), flags.exclusive(), std::move(callbacks)); else fileSystem()->fileExists(createFileSystemURL(absolutePath), std::move(callbacks)); }