diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-07 11:21:11 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-07 11:21:11 +0200 |
| commit | 2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch) | |
| tree | 988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebCore/fileapi | |
| parent | dd91e772430dc294e3bf478c119ef8d43c0a3358 (diff) | |
| download | qtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz | |
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebCore/fileapi')
93 files changed, 54 insertions, 6491 deletions
diff --git a/Source/WebCore/fileapi/AsyncFileWriter.h b/Source/WebCore/fileapi/AsyncFileWriter.h deleted file mode 100644 index d6a28d5eb..000000000 --- a/Source/WebCore/fileapi/AsyncFileWriter.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef AsyncFileWriter_h -#define AsyncFileWriter_h - -#if ENABLE(FILE_SYSTEM) - -#include "PlatformString.h" -#include <wtf/RefCounted.h> - -namespace WebCore { - -class Blob; - -class AsyncFileWriter { -public: - virtual ~AsyncFileWriter() {} - - virtual void write(long long position, Blob* data) = 0; - virtual void truncate(long long length) = 0; - virtual void abort() = 0; - virtual bool waitForOperationToComplete() // Needed for FileWriterSync only. - { - return false; - } -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // AsyncFileWriter_h - diff --git a/Source/WebCore/fileapi/AsyncFileWriterClient.h b/Source/WebCore/fileapi/AsyncFileWriterClient.h deleted file mode 100644 index 929f523fc..000000000 --- a/Source/WebCore/fileapi/AsyncFileWriterClient.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef AsyncFileWriterClient_h -#define AsyncFileWriterClient_h - -#if ENABLE(FILE_SYSTEM) - -#include "FileError.h" - -namespace WebCore { - -class AsyncFileWriterClient { -public: - virtual ~AsyncFileWriterClient() {} - - virtual void didWrite(long long bytes, bool complete) = 0; - virtual void didTruncate() = 0; - virtual void didFail(FileError::ErrorCode) = 0; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // AsyncFileWriterClient_h diff --git a/Source/WebCore/fileapi/Blob.cpp b/Source/WebCore/fileapi/Blob.cpp index 3b33cd66d..197a2618f 100644 --- a/Source/WebCore/fileapi/Blob.cpp +++ b/Source/WebCore/fileapi/Blob.cpp @@ -37,6 +37,16 @@ namespace WebCore { +Blob::Blob() + : m_size(0) +{ + OwnPtr<BlobData> blobData = BlobData::create(); + + // Create a new internal URL and register it with the provided blob data. + m_internalURL = BlobURL::createInternalURL(); + ThreadableBlobRegistry::registerBlobURL(m_internalURL, blobData.release()); +} + Blob::Blob(PassOwnPtr<BlobData> blobData, long long size) : m_type(blobData->contentType()) , m_size(size) diff --git a/Source/WebCore/fileapi/Blob.h b/Source/WebCore/fileapi/Blob.h index bca939823..f5f1852f8 100644 --- a/Source/WebCore/fileapi/Blob.h +++ b/Source/WebCore/fileapi/Blob.h @@ -43,6 +43,11 @@ namespace WebCore { class Blob : public RefCounted<Blob> { public: + static PassRefPtr<Blob> create() + { + return adoptRef(new Blob); + } + static PassRefPtr<Blob> create(PassOwnPtr<BlobData> blobData, long long size) { return adoptRef(new Blob(blobData, size)); @@ -67,6 +72,7 @@ public: #endif protected: + Blob(); Blob(PassOwnPtr<BlobData>, long long size); // For deserialization. diff --git a/Source/WebCore/fileapi/Blob.idl b/Source/WebCore/fileapi/Blob.idl index 29c5141d2..6b7e59d22 100644 --- a/Source/WebCore/fileapi/Blob.idl +++ b/Source/WebCore/fileapi/Blob.idl @@ -33,7 +33,9 @@ module html { interface [ JSGenerateIsReachable=Impl, CustomToJSObject, - JSNoStaticTables + JSNoStaticTables, + CustomConstructor, + ConstructorParameters=2 ] Blob { readonly attribute unsigned long long size; readonly attribute DOMString type; diff --git a/Source/WebCore/fileapi/DOMFilePath.cpp b/Source/WebCore/fileapi/DOMFilePath.cpp deleted file mode 100644 index 90412469d..000000000 --- a/Source/WebCore/fileapi/DOMFilePath.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "DOMFilePath.h" - -#if ENABLE(FILE_SYSTEM) - -#include "RegularExpression.h" -#include <wtf/Vector.h> -#include <wtf/text/CString.h> - -namespace WebCore { - -const char DOMFilePath::separator = '/'; -const char DOMFilePath::root[] = "/"; - -String DOMFilePath::append(const String& base, const String& components) -{ - return ensureDirectoryPath(base) + components; -} - -String DOMFilePath::ensureDirectoryPath(const String& path) -{ - if (!DOMFilePath::endsWithSeparator(path)) { - String newPath = path; - newPath.append(DOMFilePath::separator); - return newPath; - } - return path; -} - -String DOMFilePath::getName(const String& path) -{ - int index = path.reverseFind(DOMFilePath::separator); - if (index != -1) - return path.substring(index + 1); - return path; -} - -String DOMFilePath::getDirectory(const String& path) -{ - int index = path.reverseFind(DOMFilePath::separator); - if (index == 0) - return DOMFilePath::root; - if (index != -1) - return path.substring(0, index); - return "."; -} - -bool DOMFilePath::isParentOf(const String& parent, const String& mayBeChild) -{ - ASSERT(DOMFilePath::isAbsolute(parent)); - ASSERT(DOMFilePath::isAbsolute(mayBeChild)); - if (parent == DOMFilePath::root && mayBeChild != DOMFilePath::root) - return true; - if (parent.length() >= mayBeChild.length() || !mayBeChild.startsWith(parent, false)) - return false; - if (mayBeChild[parent.length()] != DOMFilePath::separator) - return false; - return true; -} - -String DOMFilePath::removeExtraParentReferences(const String& path) -{ - ASSERT(DOMFilePath::isAbsolute(path)); - Vector<String> components; - Vector<String> canonicalized; - path.split(DOMFilePath::separator, components); - for (size_t i = 0; i < components.size(); ++i) { - if (components[i] == ".") - continue; - if (components[i] == "..") { - if (canonicalized.size() > 0) - canonicalized.removeLast(); - continue; - } - canonicalized.append(components[i]); - } - if (canonicalized.isEmpty()) - return DOMFilePath::root; - String result; - for (size_t i = 0; i < canonicalized.size(); ++i) { - result.append(DOMFilePath::separator); - result.append(canonicalized[i]); - } - return result; -} - -bool DOMFilePath::isValidPath(const String& path) -{ - if (path.isEmpty() || path == DOMFilePath::root) - return true; - - // Embedded NULs are not allowed. - if (path.find(static_cast<UChar>(0)) != WTF::notFound) - return false; - - // While not [yet] restricted by the spec, '\\' complicates implementation for Chromium. - if (path.find('\\') != WTF::notFound) - return false; - - // This method is only called on fully-evaluated absolute paths. Any sign of ".." or "." is likely an attempt to break out of the sandbox. - Vector<String> components; - path.split(DOMFilePath::separator, components); - for (size_t i = 0; i < components.size(); ++i) { - if (components[i] == ".") - return false; - if (components[i] == "..") - return false; - } - return true; -} - -bool DOMFilePath::isValidName(const String& name) -{ - if (name.isEmpty()) - return true; - // '/' is not allowed in name. - if (name.contains('/')) - return false; - return isValidPath(name); -} - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/DOMFilePath.h b/Source/WebCore/fileapi/DOMFilePath.h deleted file mode 100644 index 2f2bb2338..000000000 --- a/Source/WebCore/fileapi/DOMFilePath.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DOMFilePath_h -#define DOMFilePath_h - -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -// DOMFileSystem path utilities. All methods in this class are static. -class DOMFilePath { -public: - static const char separator; - static const char root[]; - - // Returns the name part from the given path. - static String getName(const String& path); - - // Returns the parent directory path of the given path. - static String getDirectory(const String& path); - - // Checks if a given path is a parent of mayBeChild. This method assumes given paths are absolute and do not have extra references to a parent (i.e. "../"). - static bool isParentOf(const String& path, const String& mayBeChild); - - // Appends the separator at the end of the path if it's not there already. - static String ensureDirectoryPath(const String& path); - - // Returns a new path by appending a separator and the supplied path component to the path. - static String append(const String& path, const String& component); - - static bool isAbsolute(const String& path) - { - return path.startsWith(DOMFilePath::root); - } - - static bool endsWithSeparator(const String& path) - { - return path[path.length() - 1] == DOMFilePath::separator; - } - - // Evaluates all "../" and "./" segments. Note that "/../" expands to "/", so you can't ever refer to anything above the root directory. - static String removeExtraParentReferences(const String& path); - - // Checks if the given path follows the FileSystem API naming restrictions. - static bool isValidPath(const String& path); - - // Checks if the given name follows the FileSystem API naming restrictions. - static bool isValidName(const String& name); - -private: - DOMFilePath() { } -}; - -} // namespace WebCore - -#endif // DOMFilePath_h diff --git a/Source/WebCore/fileapi/DOMFileSystem.cpp b/Source/WebCore/fileapi/DOMFileSystem.cpp deleted file mode 100644 index b178f0c64..000000000 --- a/Source/WebCore/fileapi/DOMFileSystem.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "DOMFileSystem.h" - -#if ENABLE(FILE_SYSTEM) - -#include "AsyncFileSystem.h" -#include "DOMFilePath.h" -#include "DirectoryEntry.h" -#include "ErrorCallback.h" -#include "File.h" -#include "FileCallback.h" -#include "FileEntry.h" -#include "FileMetadata.h" -#include "FileSystemCallbacks.h" -#include "FileWriter.h" -#include "FileWriterBaseCallback.h" -#include "FileWriterCallback.h" -#include "InspectorFileSystemInstrumentation.h" -#include "MetadataCallback.h" -#include "ScriptExecutionContext.h" -#include <wtf/OwnPtr.h> - -namespace WebCore { - -// static -PassRefPtr<DOMFileSystem> DOMFileSystem::create(ScriptExecutionContext* context, const String& name, PassOwnPtr<AsyncFileSystem> asyncFileSystem) -{ - RefPtr<DOMFileSystem> fileSystem(adoptRef(new DOMFileSystem(context, name, asyncFileSystem))); - fileSystem->suspendIfNeeded(); - InspectorInstrumentation::didOpenFileSystem(fileSystem.get()); - return fileSystem.release(); -} - -DOMFileSystem::DOMFileSystem(ScriptExecutionContext* context, const String& name, PassOwnPtr<AsyncFileSystem> asyncFileSystem) - : DOMFileSystemBase(context, name, asyncFileSystem) - , ActiveDOMObject(context, this) -{ -} - -PassRefPtr<DirectoryEntry> DOMFileSystem::root() -{ - return DirectoryEntry::create(this, DOMFilePath::root); -} - -void DOMFileSystem::stop() -{ - m_asyncFileSystem->stop(); -} - -bool DOMFileSystem::hasPendingActivity() const -{ - return m_asyncFileSystem->hasPendingActivity(); -} - -void DOMFileSystem::contextDestroyed() -{ - m_asyncFileSystem->stop(); - ActiveDOMObject::contextDestroyed(); -} - -namespace { - -class ConvertToFileWriterCallback : public FileWriterBaseCallback { -public: - static PassRefPtr<ConvertToFileWriterCallback> create(PassRefPtr<FileWriterCallback> callback) - { - return adoptRef(new ConvertToFileWriterCallback(callback)); - } - - bool handleEvent(FileWriterBase* fileWriterBase) - { - return m_callback->handleEvent(static_cast<FileWriter*>(fileWriterBase)); - } -private: - ConvertToFileWriterCallback(PassRefPtr<FileWriterCallback> callback) - : m_callback(callback) - { - } - RefPtr<FileWriterCallback> m_callback; -}; - -} - -void DOMFileSystem::createWriter(const FileEntry* fileEntry, PassRefPtr<FileWriterCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - ASSERT(fileEntry); - - RefPtr<FileWriter> fileWriter = FileWriter::create(scriptExecutionContext()); - RefPtr<FileWriterBaseCallback> conversionCallback = ConvertToFileWriterCallback::create(successCallback); - OwnPtr<FileWriterBaseCallbacks> callbacks = FileWriterBaseCallbacks::create(fileWriter, conversionCallback, errorCallback); - m_asyncFileSystem->createWriter(fileWriter.get(), fileEntry->fullPath(), callbacks.release()); -} - -namespace { - -class GetPathCallback : public FileSystemCallbacksBase { -public: - static PassOwnPtr<GetPathCallback> create(PassRefPtr<DOMFileSystem> filesystem, const String& name, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) - { - return adoptPtr(new GetPathCallback(filesystem, name, successCallback, errorCallback)); - } - - virtual void didReadMetadata(const FileMetadata& metadata) - { - ASSERT(!metadata.platformPath.isEmpty()); - m_filesystem->scheduleCallback(m_successCallback.release(), File::createWithName(metadata.platformPath, m_name)); - } - -private: - GetPathCallback(PassRefPtr<DOMFileSystem> filesystem, const String& name, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) - : FileSystemCallbacksBase(errorCallback) - , m_filesystem(filesystem) - , m_name(name) - , m_successCallback(successCallback) - { - } - - RefPtr<DOMFileSystem> m_filesystem; - String m_name; - RefPtr<FileCallback> m_successCallback; -}; - -} // namespace - -void DOMFileSystem::createFile(const FileEntry* fileEntry, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - m_asyncFileSystem->createSnapshotFileAndReadMetadata(fileEntry->fullPath(), GetPathCallback::create(this, fileEntry->name(), successCallback, errorCallback)); -} - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/DOMFileSystem.h b/Source/WebCore/fileapi/DOMFileSystem.h deleted file mode 100644 index 74fa9ac18..000000000 --- a/Source/WebCore/fileapi/DOMFileSystem.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DOMFileSystem_h -#define DOMFileSystem_h - -#if ENABLE(FILE_SYSTEM) - -#include "ActiveDOMObject.h" -#include "DOMFileSystemBase.h" -#include "ScriptExecutionContext.h" - -namespace WebCore { - -class DirectoryEntry; -class File; -class FileCallback; -class FileEntry; -class FileWriterCallback; - -class DOMFileSystem : public DOMFileSystemBase, public ActiveDOMObject { -public: - static PassRefPtr<DOMFileSystem> create(ScriptExecutionContext*, const String& name, PassOwnPtr<AsyncFileSystem>); - - PassRefPtr<DirectoryEntry> root(); - - // ActiveDOMObject methods. - virtual void stop(); - virtual bool hasPendingActivity() const; - virtual void contextDestroyed(); - - void createWriter(const FileEntry*, PassRefPtr<FileWriterCallback>, PassRefPtr<ErrorCallback>); - void createFile(const FileEntry*, PassRefPtr<FileCallback>, PassRefPtr<ErrorCallback>); - - // Schedule a callback. This should not cross threads (should be called on the same context thread). - // FIXME: move this to a more generic place. - template <typename CB, typename CBArg> - static void scheduleCallback(ScriptExecutionContext*, PassRefPtr<CB>, PassRefPtr<CBArg>); - - template <typename CB, typename CBArg> - void scheduleCallback(PassRefPtr<CB> callback, PassRefPtr<CBArg> callbackArg) - { - scheduleCallback(scriptExecutionContext(), callback, callbackArg); - } - -private: - DOMFileSystem(ScriptExecutionContext*, const String& name, PassOwnPtr<AsyncFileSystem>); - - // A helper template to schedule a callback task. - template <typename CB, typename CBArg> - class DispatchCallbackTask : public ScriptExecutionContext::Task { - public: - DispatchCallbackTask(PassRefPtr<CB> callback, PassRefPtr<CBArg> arg) - : m_callback(callback) - , m_callbackArg(arg) - { - } - - virtual void performTask(ScriptExecutionContext*) - { - m_callback->handleEvent(m_callbackArg.get()); - } - - private: - RefPtr<CB> m_callback; - RefPtr<CBArg> m_callbackArg; - }; -}; - -template <typename CB, typename CBArg> -void DOMFileSystem::scheduleCallback(ScriptExecutionContext* scriptExecutionContext, PassRefPtr<CB> callback, PassRefPtr<CBArg> arg) -{ - ASSERT(scriptExecutionContext->isContextThread()); - if (callback) - scriptExecutionContext->postTask(adoptPtr(new DispatchCallbackTask<CB, CBArg>(callback, arg))); -} - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // DOMFileSystem_h diff --git a/Source/WebCore/fileapi/DOMFileSystem.idl b/Source/WebCore/fileapi/DOMFileSystem.idl deleted file mode 100644 index 2e98fbf93..000000000 --- a/Source/WebCore/fileapi/DOMFileSystem.idl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * Copyright (C) 2011 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - ActiveDOMObject, - JSNoStaticTables - ] DOMFileSystem { - readonly attribute DOMString name; - readonly attribute DirectoryEntry root; - }; -} diff --git a/Source/WebCore/fileapi/DOMFileSystemBase.cpp b/Source/WebCore/fileapi/DOMFileSystemBase.cpp deleted file mode 100644 index 2135f2bbc..000000000 --- a/Source/WebCore/fileapi/DOMFileSystemBase.cpp +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "DOMFileSystemBase.h" - -#if ENABLE(FILE_SYSTEM) - -#include "DOMFilePath.h" -#include "DirectoryEntry.h" -#include "DirectoryReaderBase.h" -#include "EntriesCallback.h" -#include "EntryArray.h" -#include "EntryBase.h" -#include "EntryCallback.h" -#include "ErrorCallback.h" -#include "FileError.h" -#include "FileSystemCallbacks.h" -#include "MetadataCallback.h" -#include "ScriptExecutionContext.h" -#include "VoidCallback.h" -#include <wtf/OwnPtr.h> - -namespace WebCore { - -DOMFileSystemBase::DOMFileSystemBase(ScriptExecutionContext* context, const String& name, PassOwnPtr<AsyncFileSystem> asyncFileSystem) - : m_context(context) - , m_name(name) - , m_asyncFileSystem(asyncFileSystem) -{ -} - -DOMFileSystemBase::~DOMFileSystemBase() -{ -} - -SecurityOrigin* DOMFileSystemBase::securityOrigin() const -{ - return m_context->securityOrigin(); -} - -bool DOMFileSystemBase::getMetadata(const EntryBase* entry, PassRefPtr<MetadataCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - m_asyncFileSystem->readMetadata(entry->fullPath(), MetadataCallbacks::create(successCallback, errorCallback)); - return true; -} - -static bool verifyAndGetDestinationPathForCopyOrMove(const EntryBase* source, EntryBase* parent, const String& newName, String& destinationPath) -{ - ASSERT(source); - - if (!parent || !parent->isDirectory()) - return false; - - if (!newName.isEmpty() && !DOMFilePath::isValidName(newName)) - return false; - - // It is an error to try to copy or move an entry inside itself at any depth if it is a directory. - if (source->isDirectory() && DOMFilePath::isParentOf(source->fullPath(), parent->fullPath())) - return false; - - // It is an error to copy or move an entry into its parent if a name different from its current one isn't provided. - if ((newName.isEmpty() || source->name() == newName) && DOMFilePath::getDirectory(source->fullPath()) == parent->fullPath()) - return false; - - destinationPath = parent->fullPath(); - if (!newName.isEmpty()) - destinationPath = DOMFilePath::append(destinationPath, newName); - else - destinationPath = DOMFilePath::append(destinationPath, source->name()); - - return true; -} - -static bool pathToAbsolutePath(AsyncFileSystem::Type type, const EntryBase* base, String path, String& absolutePath) -{ - ASSERT(base); - - if (!DOMFilePath::isAbsolute(path)) - path = DOMFilePath::append(base->fullPath(), path); - absolutePath = DOMFilePath::removeExtraParentReferences(path); - - if ((type == AsyncFileSystem::Temporary || type == AsyncFileSystem::Persistent) && !DOMFilePath::isValidPath(absolutePath)) - return false; - return true; -} - -bool DOMFileSystemBase::move(const EntryBase* source, EntryBase* parent, const String& newName, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - String destinationPath; - if (!verifyAndGetDestinationPathForCopyOrMove(source, parent, newName, destinationPath)) - return false; - - m_asyncFileSystem->move(source->fullPath(), destinationPath, EntryCallbacks::create(successCallback, errorCallback, this, destinationPath, source->isDirectory())); - return true; -} - -bool DOMFileSystemBase::copy(const EntryBase* source, EntryBase* parent, const String& newName, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - String destinationPath; - if (!verifyAndGetDestinationPathForCopyOrMove(source, parent, newName, destinationPath)) - return false; - - m_asyncFileSystem->copy(source->fullPath(), destinationPath, EntryCallbacks::create(successCallback, errorCallback, this, destinationPath, source->isDirectory())); - return true; -} - -bool DOMFileSystemBase::remove(const EntryBase* entry, PassRefPtr<VoidCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - ASSERT(entry); - // We don't allow calling remove() on the root directory. - if (entry->fullPath() == String(DOMFilePath::root)) - return false; - m_asyncFileSystem->remove(entry->fullPath(), VoidCallbacks::create(successCallback, errorCallback)); - return true; -} - -bool DOMFileSystemBase::removeRecursively(const EntryBase* entry, PassRefPtr<VoidCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - ASSERT(entry && entry->isDirectory()); - // We don't allow calling remove() on the root directory. - if (entry->fullPath() == String(DOMFilePath::root)) - return false; - m_asyncFileSystem->removeRecursively(entry->fullPath(), VoidCallbacks::create(successCallback, errorCallback)); - return true; -} - -bool DOMFileSystemBase::getParent(const EntryBase* entry, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - ASSERT(entry); - String path = DOMFilePath::getDirectory(entry->fullPath()); - - m_asyncFileSystem->directoryExists(path, EntryCallbacks::create(successCallback, errorCallback, this, path, true)); - return true; -} - -bool DOMFileSystemBase::getFile(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, false); - if (flags && flags->isCreate()) - m_asyncFileSystem->createFile(absolutePath, flags->isExclusive(), callbacks.release()); - else - m_asyncFileSystem->fileExists(absolutePath, callbacks.release()); - return true; -} - -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::readDirectory(PassRefPtr<DirectoryReaderBase> reader, const String& path, PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - ASSERT(DOMFilePath::isAbsolute(path)); - m_asyncFileSystem->readDirectory(path, EntriesCallbacks::create(successCallback, errorCallback, reader, path)); - return true; -} - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/DOMFileSystemBase.h b/Source/WebCore/fileapi/DOMFileSystemBase.h deleted file mode 100644 index 18ae8d76b..000000000 --- a/Source/WebCore/fileapi/DOMFileSystemBase.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DOMFileSystemBase_h -#define DOMFileSystemBase_h - -#if ENABLE(FILE_SYSTEM) - -#include "AsyncFileSystem.h" -#include "WebKitFlags.h" -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class DirectoryEntry; -class DirectoryReaderBase; -class EntriesCallback; -class EntryBase; -class EntryCallback; -class ErrorCallback; -class KURL; -class MetadataCallback; -class ScriptExecutionContext; -class SecurityOrigin; -class VoidCallback; - -// A common base class for DOMFileSystem and DOMFileSystemSync. -class DOMFileSystemBase : public RefCounted<DOMFileSystemBase> { -public: - static PassRefPtr<DOMFileSystemBase> create(ScriptExecutionContext* context, const String& name, PassOwnPtr<AsyncFileSystem> asyncFileSystem) - { - return adoptRef(new DOMFileSystemBase(context, name, asyncFileSystem)); - } - virtual ~DOMFileSystemBase(); - - const String& name() const { return m_name; } - AsyncFileSystem* asyncFileSystem() const { return m_asyncFileSystem.get(); } - SecurityOrigin* securityOrigin() const; - - // Actual FileSystem API implementations. All the validity checks on virtual paths are done at this level. - // They return false for immediate errors that don't involve lower AsyncFileSystem layer (e.g. for name validation errors). Otherwise they return true (but later may call back with an runtime error). - bool getMetadata(const EntryBase*, PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>); - bool move(const EntryBase* source, EntryBase* parent, const String& name, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>); - bool copy(const EntryBase* source, EntryBase* parent, const String& name, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>); - bool remove(const EntryBase*, PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>); - bool removeRecursively(const EntryBase*, PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>); - bool getParent(const EntryBase*, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>); - bool getFile(const EntryBase*, const String& path, PassRefPtr<WebKitFlags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>); - bool getDirectory(const EntryBase*, const String& path, PassRefPtr<WebKitFlags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>); - bool readDirectory(PassRefPtr<DirectoryReaderBase>, const String& path, PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>); - -protected: - DOMFileSystemBase(ScriptExecutionContext*, const String& name, PassOwnPtr<AsyncFileSystem>); - friend class DOMFileSystemSync; - - ScriptExecutionContext* m_context; - String m_name; - mutable OwnPtr<AsyncFileSystem> m_asyncFileSystem; -}; - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) - -#endif // DOMFileSystemBase_h diff --git a/Source/WebCore/fileapi/DOMFileSystemSync.cpp b/Source/WebCore/fileapi/DOMFileSystemSync.cpp deleted file mode 100644 index 8b772bb33..000000000 --- a/Source/WebCore/fileapi/DOMFileSystemSync.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "DOMFileSystemSync.h" - -#if ENABLE(FILE_SYSTEM) - -#include "AsyncFileSystem.h" -#include "AsyncFileWriter.h" -#include "DOMFilePath.h" -#include "DirectoryEntrySync.h" -#include "ErrorCallback.h" -#include "File.h" -#include "FileEntrySync.h" -#include "FileError.h" -#include "FileException.h" -#include "FileMetadata.h" -#include "FileSystemCallbacks.h" -#include "FileWriterBaseCallback.h" -#include "FileWriterSync.h" - -namespace WebCore { - -class FileWriterBase; - -PassRefPtr<DOMFileSystemSync> DOMFileSystemSync::create(DOMFileSystemBase* fileSystem) -{ - return adoptRef(new DOMFileSystemSync(fileSystem->m_context, fileSystem->m_name, fileSystem->m_asyncFileSystem.release())); -} - -DOMFileSystemSync::DOMFileSystemSync(ScriptExecutionContext* context, const String& name, PassOwnPtr<AsyncFileSystem> asyncFileSystem) - : DOMFileSystemBase(context, name, asyncFileSystem) -{ -} - -DOMFileSystemSync::~DOMFileSystemSync() -{ -} - -PassRefPtr<DirectoryEntrySync> DOMFileSystemSync::root() -{ - return DirectoryEntrySync::create(this, DOMFilePath::root); -} - -namespace { - -class CreateFileHelper : public AsyncFileSystemCallbacks { -public: - class CreateFileResult : public RefCounted<CreateFileResult> { - public: - static PassRefPtr<CreateFileResult> create() - { - return adoptRef(new CreateFileResult()); - } - - bool m_failed; - int m_code; - RefPtr<File> m_file; - - private: - CreateFileResult() - : m_failed(false) - , m_code(0) - { - } - - ~CreateFileResult() - { - } - friend class WTF::RefCounted<CreateFileResult>; - }; - - static PassOwnPtr<CreateFileHelper> create(PassRefPtr<CreateFileResult> result, const String& name) - { - return adoptPtr(new CreateFileHelper(result, name)); - } - - virtual void didFail(int code) - { - m_result->m_failed = true; - m_result->m_code = code; - } - - virtual ~CreateFileHelper() - { - } - - void didReadMetadata(const FileMetadata& metadata) - { - m_result->m_file = File::createWithName(metadata.platformPath, m_name); - } -private: - CreateFileHelper(PassRefPtr<CreateFileResult> result, const String& name) - : m_result(result) - , m_name(name) - { - } - - RefPtr<CreateFileResult> m_result; - String m_name; -}; - -} // namespace - -PassRefPtr<File> DOMFileSystemSync::createFile(const FileEntrySync* fileEntry, ExceptionCode& ec) -{ - ec = 0; - RefPtr<CreateFileHelper::CreateFileResult> result(CreateFileHelper::CreateFileResult::create()); - m_asyncFileSystem->createSnapshotFileAndReadMetadata(fileEntry->fullPath(), CreateFileHelper::create(result, fileEntry->name())); - if (!m_asyncFileSystem->waitForOperationToComplete()) { - ec = FileException::ABORT_ERR; - return 0; - } - if (result->m_failed) { - ec = result->m_code; - return 0; - } - return result->m_file; -} - -namespace { - -class ReceiveFileWriterCallback : public FileWriterBaseCallback { -public: - static PassRefPtr<ReceiveFileWriterCallback> create() - { - return adoptRef(new ReceiveFileWriterCallback()); - } - - bool handleEvent(FileWriterBase* fileWriterBase) - { -#ifndef NDEBUG - m_fileWriterBase = fileWriterBase; -#else - ASSERT_UNUSED(fileWriterBase, fileWriterBase); -#endif - return true; - } - -#ifndef NDEBUG - FileWriterBase* fileWriterBase() - { - return m_fileWriterBase; - } -#endif - -private: - ReceiveFileWriterCallback() -#ifndef NDEBUG - : m_fileWriterBase(0) -#endif - { - } - -#ifndef NDEBUG - FileWriterBase* m_fileWriterBase; -#endif -}; - -class LocalErrorCallback : public ErrorCallback { -public: - static PassRefPtr<LocalErrorCallback> create() - { - return adoptRef(new LocalErrorCallback()); - } - - bool handleEvent(FileError* error) - { - m_error = error; - return true; - } - - FileError* error() - { - return m_error.get(); - } - -private: - LocalErrorCallback() - { - } - RefPtr<FileError> m_error; -}; - -} - -PassRefPtr<FileWriterSync> DOMFileSystemSync::createWriter(const FileEntrySync* fileEntry, ExceptionCode& ec) -{ - ASSERT(fileEntry); - ec = 0; - - - RefPtr<FileWriterSync> fileWriter = FileWriterSync::create(); - RefPtr<ReceiveFileWriterCallback> successCallback = ReceiveFileWriterCallback::create(); - RefPtr<LocalErrorCallback> errorCallback = LocalErrorCallback::create(); - - OwnPtr<FileWriterBaseCallbacks> callbacks = FileWriterBaseCallbacks::create(fileWriter, successCallback, errorCallback); - m_asyncFileSystem->createWriter(fileWriter.get(), fileEntry->fullPath(), callbacks.release()); - if (!m_asyncFileSystem->waitForOperationToComplete()) { - ec = FileException::ABORT_ERR; - return 0; - } - if (errorCallback->error()) { - ASSERT(!successCallback->fileWriterBase()); - ec = FileException::ErrorCodeToExceptionCode(errorCallback->error()->code()); - return 0; - } - ASSERT(successCallback->fileWriterBase()); - ASSERT(static_cast<FileWriterSync*>(successCallback->fileWriterBase()) == fileWriter.get()); - return fileWriter; -} - -} - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/DOMFileSystemSync.h b/Source/WebCore/fileapi/DOMFileSystemSync.h deleted file mode 100644 index 0120fb058..000000000 --- a/Source/WebCore/fileapi/DOMFileSystemSync.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DOMFileSystemSync_h -#define DOMFileSystemSync_h - -#if ENABLE(FILE_SYSTEM) - -#include "DOMFileSystemBase.h" - -namespace WebCore { - -class DirectoryEntrySync; -class File; -class FileEntrySync; -class FileWriterSync; - -typedef int ExceptionCode; - -class DOMFileSystemSync : public DOMFileSystemBase { -public: - static PassRefPtr<DOMFileSystemSync> create(ScriptExecutionContext* context, const String& name, PassOwnPtr<AsyncFileSystem> asyncFileSystem) - { - return adoptRef(new DOMFileSystemSync(context, name, asyncFileSystem)); - } - - static PassRefPtr<DOMFileSystemSync> create(DOMFileSystemBase*); - - virtual ~DOMFileSystemSync(); - - PassRefPtr<DirectoryEntrySync> root(); - - PassRefPtr<File> createFile(const FileEntrySync*, ExceptionCode&); - PassRefPtr<FileWriterSync> createWriter(const FileEntrySync*, ExceptionCode&); - -private: - DOMFileSystemSync(ScriptExecutionContext*, const String& name, PassOwnPtr<AsyncFileSystem>); -}; - -} - -#endif // ENABLE(FILE_SYSTEM) - -#endif // DOMFileSystemSync_h diff --git a/Source/WebCore/fileapi/DOMFileSystemSync.idl b/Source/WebCore/fileapi/DOMFileSystemSync.idl deleted file mode 100644 index 706aa5027..000000000 --- a/Source/WebCore/fileapi/DOMFileSystemSync.idl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - JSNoStaticTables - ] DOMFileSystemSync { - readonly attribute DOMString name; - readonly attribute DirectoryEntrySync root; - }; -} diff --git a/Source/WebCore/fileapi/DOMWindowFileSystem.cpp b/Source/WebCore/fileapi/DOMWindowFileSystem.cpp deleted file mode 100644 index 570c39db2..000000000 --- a/Source/WebCore/fileapi/DOMWindowFileSystem.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2012, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - */ - -#include "config.h" -#include "DOMWindowFileSystem.h" - -#if ENABLE(FILE_SYSTEM) - -#include "AsyncFileSystem.h" -#include "DOMFileSystem.h" -#include "DOMWindow.h" -#include "Document.h" -#include "EntryCallback.h" -#include "ErrorCallback.h" -#include "FileError.h" -#include "FileSystemCallback.h" -#include "FileSystemCallbacks.h" -#include "LocalFileSystem.h" -#include "SecurityOrigin.h" - -namespace WebCore { - -DOMWindowFileSystem::DOMWindowFileSystem() -{ -} - -DOMWindowFileSystem::~DOMWindowFileSystem() -{ -} - -void DOMWindowFileSystem::webkitRequestFileSystem(DOMWindow* window, int type, long long size, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - if (!window->isCurrentlyDisplayedInFrame()) - return; - - Document* document = window->document(); - if (!document) - return; - - if (!AsyncFileSystem::isAvailable() || !document->securityOrigin()->canAccessFileSystem()) { - DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(FileError::SECURITY_ERR)); - return; - } - - AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type); - if (!AsyncFileSystem::isValidType(fileSystemType)) { - DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(FileError::INVALID_MODIFICATION_ERR)); - return; - } - - LocalFileSystem::localFileSystem().requestFileSystem(document, fileSystemType, size, FileSystemCallbacks::create(successCallback, errorCallback, document), false); -} - -void DOMWindowFileSystem::webkitResolveLocalFileSystemURL(DOMWindow* window, const String& url, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - if (!window->isCurrentlyDisplayedInFrame()) - return; - - Document* document = window->document(); - if (!document) - return; - - SecurityOrigin* securityOrigin = document->securityOrigin(); - KURL completedURL = document->completeURL(url); - if (!AsyncFileSystem::isAvailable() || !securityOrigin->canAccessFileSystem() || !securityOrigin->canRequest(completedURL)) { - DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(FileError::SECURITY_ERR)); - return; - } - - AsyncFileSystem::Type type; - String filePath; - if (!completedURL.isValid() || !AsyncFileSystem::crackFileSystemURL(completedURL, type, filePath)) { - DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(FileError::ENCODING_ERR)); - return; - } - - LocalFileSystem::localFileSystem().readFileSystem(document, type, ResolveURICallbacks::create(successCallback, errorCallback, document, filePath)); -} - -COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::TEMPORARY) == static_cast<int>(AsyncFileSystem::Temporary), enum_mismatch); -COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::PERSISTENT) == static_cast<int>(AsyncFileSystem::Persistent), enum_mismatch); - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/DOMWindowFileSystem.h b/Source/WebCore/fileapi/DOMWindowFileSystem.h deleted file mode 100644 index 2783553a1..000000000 --- a/Source/WebCore/fileapi/DOMWindowFileSystem.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2012, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - */ - -#ifndef DOMWindowFileSystem_h -#define DOMWindowFileSystem_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/PassRefPtr.h> -#include <wtf/text/WTFString.h> - -namespace WebCore { - -class DOMWindow; -class EntryCallback; -class ErrorCallback; -class FileSystemCallback; - -class DOMWindowFileSystem { -public: - - static void webkitRequestFileSystem(DOMWindow*, int type, long long size, PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback>); - static void webkitResolveLocalFileSystemURL(DOMWindow*, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>); - - // They are placed here and in all capital letters so they can be checked against the constants in the - // IDL at compile time. - enum FileSystemType { - TEMPORARY, - PERSISTENT, - }; - -private: - DOMWindowFileSystem(); - ~DOMWindowFileSystem(); -}; - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) - -#endif // DOMWindowFileSystem_h diff --git a/Source/WebCore/fileapi/DOMWindowFileSystem.idl b/Source/WebCore/fileapi/DOMWindowFileSystem.idl deleted file mode 100644 index b6ef51319..000000000 --- a/Source/WebCore/fileapi/DOMWindowFileSystem.idl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module window { - - interface [ - Conditional=FILE_SYSTEM, - Supplemental=DOMWindow - ] DOMWindowFileSystem { - const unsigned short TEMPORARY = 0; - const unsigned short PERSISTENT = 1; - - [V8EnabledAtRuntime=FileSystem] void webkitRequestFileSystem(in unsigned short type, in long long size, - in [Callback] FileSystemCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); - [V8EnabledAtRuntime=FileSystem] void webkitResolveLocalFileSystemURL(in DOMString url, - in [Callback, Optional] EntryCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); - }; - -} diff --git a/Source/WebCore/fileapi/DirectoryEntry.cpp b/Source/WebCore/fileapi/DirectoryEntry.cpp deleted file mode 100644 index 0f6e49f44..000000000 --- a/Source/WebCore/fileapi/DirectoryEntry.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "DirectoryEntry.h" - -#if ENABLE(FILE_SYSTEM) - -#include "DirectoryReader.h" -#include "EntryCallback.h" -#include "ErrorCallback.h" -#include "FileError.h" -#include "VoidCallback.h" - -namespace WebCore { - -DirectoryEntry::DirectoryEntry(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - : Entry(fileSystem, fullPath) -{ -} - -PassRefPtr<DirectoryReader> DirectoryEntry::createReader() -{ - return DirectoryReader::create(m_fileSystem, m_fullPath); -} - -void DirectoryEntry::getFile(const String& path, PassRefPtr<WebKitFlags> flags, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallbackRef) -{ - RefPtr<ErrorCallback> errorCallback(errorCallbackRef); - if (!m_fileSystem->getFile(this, path, flags, successCallback, errorCallback)) - filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR)); -} - -void DirectoryEntry::getDirectory(const String& path, PassRefPtr<WebKitFlags> flags, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallbackRef) -{ - RefPtr<ErrorCallback> errorCallback(errorCallbackRef); - if (!m_fileSystem->getDirectory(this, path, flags, successCallback, errorCallback)) - filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR)); -} - -void DirectoryEntry::removeRecursively(PassRefPtr<VoidCallback> successCallback, PassRefPtr<ErrorCallback> errorCallbackRef) const -{ - RefPtr<ErrorCallback> errorCallback(errorCallbackRef); - if (!m_fileSystem->removeRecursively(this, successCallback, errorCallback)) - filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR)); -} - -} - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/DirectoryEntry.h b/Source/WebCore/fileapi/DirectoryEntry.h deleted file mode 100644 index 822704713..000000000 --- a/Source/WebCore/fileapi/DirectoryEntry.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DirectoryEntry_h -#define DirectoryEntry_h - -#if ENABLE(FILE_SYSTEM) - -#include "Entry.h" -#include "WebKitFlags.h" -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class DOMFileSystemBase; -class DirectoryReader; -class EntryCallback; -class ErrorCallback; -class VoidCallback; - -class DirectoryEntry : public Entry { -public: - static PassRefPtr<DirectoryEntry> create(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - { - return adoptRef(new DirectoryEntry(fileSystem, fullPath)); - } - virtual bool isDirectory() const { return true; } - - PassRefPtr<DirectoryReader> createReader(); - void getFile(const String& path, PassRefPtr<WebKitFlags> = 0, PassRefPtr<EntryCallback> = 0, PassRefPtr<ErrorCallback> = 0); - void getDirectory(const String& path, PassRefPtr<WebKitFlags> = 0, PassRefPtr<EntryCallback> = 0, PassRefPtr<ErrorCallback> = 0); - void removeRecursively(PassRefPtr<VoidCallback> successCallback = 0, PassRefPtr<ErrorCallback> = 0) const; - -private: - DirectoryEntry(PassRefPtr<DOMFileSystemBase>, const String& fullPath); -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // DirectoryEntry_h diff --git a/Source/WebCore/fileapi/DirectoryEntry.idl b/Source/WebCore/fileapi/DirectoryEntry.idl deleted file mode 100644 index c6c9ae9bb..000000000 --- a/Source/WebCore/fileapi/DirectoryEntry.idl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - JSGenerateToNativeObject, - JSGenerateToJSObject, - JSNoStaticTables - ] DirectoryEntry : Entry { - DirectoryReader createReader(); - [Custom] void getFile(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString path, in [Optional] WebKitFlags flags, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - [Custom] void getDirectory(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString path, in [Optional] WebKitFlags flags, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - void removeRecursively(in [Callback] VoidCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - }; -} diff --git a/Source/WebCore/fileapi/DirectoryEntrySync.cpp b/Source/WebCore/fileapi/DirectoryEntrySync.cpp deleted file mode 100644 index 10deaceb0..000000000 --- a/Source/WebCore/fileapi/DirectoryEntrySync.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "DirectoryEntrySync.h" - -#if ENABLE(FILE_SYSTEM) - -#include "DirectoryReaderSync.h" -#include "EntrySync.h" -#include "FileEntrySync.h" -#include "FileException.h" -#include "SyncCallbackHelper.h" - -namespace WebCore { - -DirectoryEntrySync::DirectoryEntrySync(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - : EntrySync(fileSystem, fullPath) -{ -} - -PassRefPtr<DirectoryReaderSync> DirectoryEntrySync::createReader(ExceptionCode&) -{ - return DirectoryReaderSync::create(m_fileSystem, m_fullPath); -} - -PassRefPtr<FileEntrySync> DirectoryEntrySync::getFile(const String& path, PassRefPtr<WebKitFlags> flags, ExceptionCode& ec) -{ - ec = 0; - EntrySyncCallbackHelper helper(m_fileSystem->asyncFileSystem()); - if (!m_fileSystem->getFile(this, path, flags, helper.successCallback(), helper.errorCallback())) { - ec = FileException::INVALID_MODIFICATION_ERR; - return 0; - } - return static_pointer_cast<FileEntrySync>(helper.getResult(ec)); -} - -PassRefPtr<DirectoryEntrySync> DirectoryEntrySync::getDirectory(const String& path, PassRefPtr<WebKitFlags> flags, ExceptionCode& ec) -{ - ec = 0; - EntrySyncCallbackHelper helper(m_fileSystem->asyncFileSystem()); - if (!m_fileSystem->getDirectory(this, path, flags, helper.successCallback(), helper.errorCallback())) { - ec = FileException::INVALID_MODIFICATION_ERR; - return 0; - } - return static_pointer_cast<DirectoryEntrySync>(helper.getResult(ec)); -} - -void DirectoryEntrySync::removeRecursively(ExceptionCode& ec) -{ - ec = 0; - VoidSyncCallbackHelper helper(m_fileSystem->asyncFileSystem()); - if (!m_fileSystem->removeRecursively(this, helper.successCallback(), helper.errorCallback())) { - ec = FileException::INVALID_MODIFICATION_ERR; - return; - } - helper.getResult(ec); -} - -} - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/DirectoryEntrySync.h b/Source/WebCore/fileapi/DirectoryEntrySync.h deleted file mode 100644 index 62b481a87..000000000 --- a/Source/WebCore/fileapi/DirectoryEntrySync.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DirectoryEntrySync_h -#define DirectoryEntrySync_h - -#if ENABLE(FILE_SYSTEM) - -#include "EntrySync.h" -#include "WebKitFlags.h" -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class DirectoryReaderSync; -class FileEntrySync; - -class DirectoryEntrySync : public EntrySync { -public: - static PassRefPtr<DirectoryEntrySync> create(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - { - return adoptRef(new DirectoryEntrySync(fileSystem, fullPath)); - } - virtual bool isDirectory() const { return true; } - - PassRefPtr<DirectoryReaderSync> createReader(ExceptionCode&); - PassRefPtr<FileEntrySync> getFile(const String& path, PassRefPtr<WebKitFlags>, ExceptionCode&); - PassRefPtr<DirectoryEntrySync> getDirectory(const String& path, PassRefPtr<WebKitFlags>, ExceptionCode&); - void removeRecursively(ExceptionCode&); - -private: - friend class EntrySync; - DirectoryEntrySync(PassRefPtr<DOMFileSystemBase>, const String& fullPath); -}; - -} - -#endif // ENABLE(FILE_SYSTEM) - -#endif // DirectoryEntrySync_h diff --git a/Source/WebCore/fileapi/DirectoryEntrySync.idl b/Source/WebCore/fileapi/DirectoryEntrySync.idl deleted file mode 100644 index 66c288fbb..000000000 --- a/Source/WebCore/fileapi/DirectoryEntrySync.idl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - JSGenerateToNativeObject, - JSGenerateToJSObject, - JSNoStaticTables - ] DirectoryEntrySync : EntrySync { - DirectoryReaderSync createReader() raises (FileException); - [Custom] FileEntrySync getFile(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString path, in WebKitFlags flags) raises (FileException); - [Custom] DirectoryEntrySync getDirectory(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString path, in WebKitFlags flags) raises (FileException); - void removeRecursively() raises (FileException); - }; -} diff --git a/Source/WebCore/fileapi/DirectoryReader.cpp b/Source/WebCore/fileapi/DirectoryReader.cpp deleted file mode 100644 index fe2d99f44..000000000 --- a/Source/WebCore/fileapi/DirectoryReader.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "DirectoryReader.h" - -#if ENABLE(FILE_SYSTEM) - -#include "EntriesCallback.h" -#include "EntryArray.h" -#include "ErrorCallback.h" -#include "FileError.h" - -namespace WebCore { - -DirectoryReader::DirectoryReader(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - : DirectoryReaderBase(fileSystem, fullPath) -{ -} - -void DirectoryReader::readEntries(PassRefPtr<EntriesCallback> entriesCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - if (!m_hasMoreEntries) { - filesystem()->scheduleCallback(entriesCallback, EntryArray::create()); - return; - } - filesystem()->readDirectory(this, m_fullPath, entriesCallback, errorCallback); -} - -} - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/DirectoryReader.h b/Source/WebCore/fileapi/DirectoryReader.h deleted file mode 100644 index bc8985894..000000000 --- a/Source/WebCore/fileapi/DirectoryReader.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DirectoryReader_h -#define DirectoryReader_h - -#if ENABLE(FILE_SYSTEM) - -#include "DOMFileSystem.h" -#include "DirectoryReaderBase.h" -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class EntriesCallback; -class EntriesCallbacks; -class ErrorCallback; - -class DirectoryReader : public DirectoryReaderBase { -public: - static PassRefPtr<DirectoryReader> create(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - { - return adoptRef(new DirectoryReader(fileSystem, fullPath)); - } - - void readEntries(PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback> = 0); - - DOMFileSystem* filesystem() const { return static_cast<DOMFileSystem*>(m_fileSystem.get()); } - -private: - DirectoryReader(PassRefPtr<DOMFileSystemBase>, const String& fullPath); -}; - -} - -#endif // ENABLE(FILE_SYSTEM) - -#endif // DirectoryReader_h diff --git a/Source/WebCore/fileapi/DirectoryReader.idl b/Source/WebCore/fileapi/DirectoryReader.idl deleted file mode 100644 index 87ce8521d..000000000 --- a/Source/WebCore/fileapi/DirectoryReader.idl +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - JSNoStaticTables - ] DirectoryReader { - void readEntries(in [Callback] EntriesCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - }; -} diff --git a/Source/WebCore/fileapi/DirectoryReaderBase.h b/Source/WebCore/fileapi/DirectoryReaderBase.h deleted file mode 100644 index 4096fe8a2..000000000 --- a/Source/WebCore/fileapi/DirectoryReaderBase.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DirectoryReaderBase_h -#define DirectoryReaderBase_h - -#if ENABLE(FILE_SYSTEM) - -#include "DOMFileSystemBase.h" -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class DirectoryReaderBase : public RefCounted<DirectoryReaderBase> { -public: - DOMFileSystemBase* filesystem() const { return m_fileSystem.get(); } - void setHasMoreEntries(bool hasMoreEntries) { m_hasMoreEntries = hasMoreEntries; } - -protected: - DirectoryReaderBase(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - : m_fileSystem(fileSystem) - , m_fullPath(fullPath) - , m_hasMoreEntries(true) - { - } - - RefPtr<DOMFileSystemBase> m_fileSystem; - - // This is a virtual path. - String m_fullPath; - - bool m_hasMoreEntries; -}; - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) - -#endif // DirectoryReaderBase_h diff --git a/Source/WebCore/fileapi/DirectoryReaderSync.cpp b/Source/WebCore/fileapi/DirectoryReaderSync.cpp deleted file mode 100644 index 014478e7b..000000000 --- a/Source/WebCore/fileapi/DirectoryReaderSync.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "DirectoryReaderSync.h" - -#if ENABLE(FILE_SYSTEM) - -#include "DirectoryEntry.h" -#include "DirectoryEntrySync.h" -#include "EntryArraySync.h" -#include "EntrySync.h" -#include "FileEntrySync.h" -#include "FileException.h" -#include "SyncCallbackHelper.h" - -namespace WebCore { - -DirectoryReaderSync::DirectoryReaderSync(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - : DirectoryReaderBase(fileSystem, fullPath) -{ -} - -PassRefPtr<EntryArraySync> DirectoryReaderSync::readEntries(ExceptionCode& ec) -{ - ec = 0; - if (!m_hasMoreEntries) - return EntryArraySync::create(); - - EntriesSyncCallbackHelper helper(m_fileSystem->asyncFileSystem()); - if (!m_fileSystem->readDirectory(this, m_fullPath, helper.successCallback(), helper.errorCallback())) { - ec = FileException::INVALID_MODIFICATION_ERR; - setHasMoreEntries(false); - return 0; - } - return helper.getResult(ec); -} - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/DirectoryReaderSync.h b/Source/WebCore/fileapi/DirectoryReaderSync.h deleted file mode 100644 index b1d1282c2..000000000 --- a/Source/WebCore/fileapi/DirectoryReaderSync.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DirectoryReaderSync_h -#define DirectoryReaderSync_h - -#if ENABLE(FILE_SYSTEM) - -#include "DirectoryReaderBase.h" -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class EntryArraySync; - -typedef int ExceptionCode; - -class DirectoryReaderSync : public DirectoryReaderBase { -public: - static PassRefPtr<DirectoryReaderSync> create(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - { - return adoptRef(new DirectoryReaderSync(fileSystem, fullPath)); - } - - PassRefPtr<EntryArraySync> readEntries(ExceptionCode&); - -private: - DirectoryReaderSync(PassRefPtr<DOMFileSystemBase>, const String& fullPath); -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // DirectoryReaderSync_h diff --git a/Source/WebCore/fileapi/DirectoryReaderSync.idl b/Source/WebCore/fileapi/DirectoryReaderSync.idl deleted file mode 100644 index a8ff685ce..000000000 --- a/Source/WebCore/fileapi/DirectoryReaderSync.idl +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - JSNoStaticTables - ] DirectoryReaderSync { - EntryArraySync readEntries() raises (FileException); - }; -} diff --git a/Source/WebCore/fileapi/EntriesCallback.h b/Source/WebCore/fileapi/EntriesCallback.h deleted file mode 100644 index 9f812e978..000000000 --- a/Source/WebCore/fileapi/EntriesCallback.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef EntriesCallback_h -#define EntriesCallback_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/RefCounted.h> - -namespace WebCore { - -class EntryArray; - -class EntriesCallback : public RefCounted<EntriesCallback> { -public: - virtual ~EntriesCallback() { } - virtual bool handleEvent(EntryArray*) = 0; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // EntriesCallback_h diff --git a/Source/WebCore/fileapi/EntriesCallback.idl b/Source/WebCore/fileapi/EntriesCallback.idl deleted file mode 100644 index 73b374d79..000000000 --- a/Source/WebCore/fileapi/EntriesCallback.idl +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - Callback - ] EntriesCallback { - boolean handleEvent(in EntryArray entries); - }; -} diff --git a/Source/WebCore/fileapi/Entry.cpp b/Source/WebCore/fileapi/Entry.cpp deleted file mode 100644 index 8b0f6ac1d..000000000 --- a/Source/WebCore/fileapi/Entry.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "config.h" -#include "Entry.h" - -#if ENABLE(FILE_SYSTEM) - -#include "AsyncFileSystem.h" -#include "DirectoryEntry.h" -#include "EntryCallback.h" -#include "ErrorCallback.h" -#include "FileError.h" -#include "FileSystemCallbacks.h" -#include "MetadataCallback.h" -#include "ScriptExecutionContext.h" -#include "SecurityOrigin.h" -#include "VoidCallback.h" -#include <wtf/text/StringBuilder.h> - -namespace WebCore { - -Entry::Entry(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - : EntryBase(fileSystem, fullPath) -{ -} - -void Entry::getMetadata(PassRefPtr<MetadataCallback> successCallback, PassRefPtr<ErrorCallback> errorCallbackRef) -{ - RefPtr<ErrorCallback> errorCallback(errorCallbackRef); - if (!m_fileSystem->getMetadata(this, successCallback, errorCallback)) - filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR)); -} - -void Entry::moveTo(PassRefPtr<DirectoryEntry> parent, const String& name, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallbackRef) const -{ - RefPtr<ErrorCallback> errorCallback(errorCallbackRef); - if (!m_fileSystem->move(this, parent.get(), name, successCallback, errorCallback)) - filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR)); -} - -void Entry::copyTo(PassRefPtr<DirectoryEntry> parent, const String& name, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallbackRef) const -{ - RefPtr<ErrorCallback> errorCallback(errorCallbackRef); - if (!m_fileSystem->copy(this, parent.get(), name, successCallback, errorCallback)) - filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR)); -} - -void Entry::remove(PassRefPtr<VoidCallback> successCallback, PassRefPtr<ErrorCallback> errorCallbackRef) const -{ - RefPtr<ErrorCallback> errorCallback(errorCallbackRef); - if (!m_fileSystem->remove(this, successCallback, errorCallback)) - filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR)); -} - -void Entry::getParent(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallbackRef) const -{ - RefPtr<ErrorCallback> errorCallback(errorCallbackRef); - if (!m_fileSystem->getParent(this, successCallback, errorCallback)) - filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR)); -} - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/Entry.h b/Source/WebCore/fileapi/Entry.h deleted file mode 100644 index 09cc964eb..000000000 --- a/Source/WebCore/fileapi/Entry.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef Entry_h -#define Entry_h - -#if ENABLE(FILE_SYSTEM) - -#include "DOMFileSystem.h" -#include "EntryBase.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class DirectoryEntry; -class EntryCallback; -class EntrySync; -class ErrorCallback; -class MetadataCallback; -class VoidCallback; - -class Entry : public EntryBase { -public: - DOMFileSystem* filesystem() const { return static_cast<DOMFileSystem*>(m_fileSystem.get()); } - - void getMetadata(PassRefPtr<MetadataCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); - void moveTo(PassRefPtr<DirectoryEntry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0) const; - void copyTo(PassRefPtr<DirectoryEntry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0) const; - void remove(PassRefPtr<VoidCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0) const; - void getParent(PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0) const; - -protected: - Entry(PassRefPtr<DOMFileSystemBase>, const String& fullPath); -}; - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) - -#endif // Entry_h diff --git a/Source/WebCore/fileapi/Entry.idl b/Source/WebCore/fileapi/Entry.idl deleted file mode 100644 index c6cdba5bd..000000000 --- a/Source/WebCore/fileapi/Entry.idl +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - CustomToJSObject, - JSNoStaticTables - ] Entry { - readonly attribute boolean isFile; - readonly attribute boolean isDirectory; - readonly attribute DOMString name; - readonly attribute DOMString fullPath; - readonly attribute DOMFileSystem filesystem; - - void getMetadata(in [Callback] MetadataCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - void moveTo(in DirectoryEntry parent, in [Optional, TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - void copyTo(in DirectoryEntry parent, in [Optional, TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - DOMString toURL(); - void remove(in [Callback] VoidCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - void getParent(in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - }; -} diff --git a/Source/WebCore/fileapi/EntryArray.cpp b/Source/WebCore/fileapi/EntryArray.cpp deleted file mode 100644 index 6c4f74fb5..000000000 --- a/Source/WebCore/fileapi/EntryArray.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "EntryArray.h" - -#if ENABLE(FILE_SYSTEM) - -namespace WebCore { - -EntryArray::EntryArray() -{ -} - -Entry* EntryArray::item(unsigned index) const -{ - if (index >= m_entries.size()) - return 0; - return m_entries[index].get(); -} - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/EntryArray.h b/Source/WebCore/fileapi/EntryArray.h deleted file mode 100644 index e5957abd1..000000000 --- a/Source/WebCore/fileapi/EntryArray.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef EntryArray_h -#define EntryArray_h - -#if ENABLE(FILE_SYSTEM) - -#include "Entry.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class EntryArray : public RefCounted<EntryArray> { -public: - static PassRefPtr<EntryArray> create() - { - return adoptRef(new EntryArray()); - } - - unsigned length() const { return m_entries.size(); } - Entry* item(unsigned index) const; - void set(unsigned index, PassRefPtr<Entry> entry); - - bool isEmpty() const { return m_entries.isEmpty(); } - void clear() { m_entries.clear(); } - void append(PassRefPtr<Entry> entry) { m_entries.append(entry); } - -private: - EntryArray(); - - Vector<RefPtr<Entry> > m_entries; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // EntryArray_h diff --git a/Source/WebCore/fileapi/EntryArray.idl b/Source/WebCore/fileapi/EntryArray.idl deleted file mode 100644 index 324dbc68b..000000000 --- a/Source/WebCore/fileapi/EntryArray.idl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - IndexedGetter, - JSNoStaticTables - ] EntryArray { - readonly attribute unsigned long length; - Entry item(in [IsIndex] unsigned long index); - }; -} diff --git a/Source/WebCore/fileapi/EntryArraySync.cpp b/Source/WebCore/fileapi/EntryArraySync.cpp deleted file mode 100644 index 1e2fa9151..000000000 --- a/Source/WebCore/fileapi/EntryArraySync.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "EntryArraySync.h" - -#if ENABLE(FILE_SYSTEM) - -#include "EntryArray.h" - -namespace WebCore { - -PassRefPtr<EntryArraySync> EntryArraySync::create(EntryArray* entries) -{ - RefPtr<EntryArraySync> entriesSync = adoptRef(new EntryArraySync()); - if (entries) { - for (unsigned i = 0; i < entries->length(); ++i) - entriesSync->append(EntrySync::create(entries->item(i))); - } - return entriesSync.release(); -} - -EntryArraySync::EntryArraySync() -{ -} - -EntrySync* EntryArraySync::item(unsigned index) const -{ - if (index >= m_entries.size()) - return 0; - return m_entries[index].get(); -} - -} - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/EntryArraySync.h b/Source/WebCore/fileapi/EntryArraySync.h deleted file mode 100644 index 46cf40911..000000000 --- a/Source/WebCore/fileapi/EntryArraySync.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef EntryArraySync_h -#define EntryArraySync_h - -#if ENABLE(FILE_SYSTEM) - -#include "EntrySync.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class EntryArray; - -class EntryArraySync : public RefCounted<EntryArraySync> { -public: - static PassRefPtr<EntryArraySync> create() - { - return adoptRef(new EntryArraySync()); - } - - static PassRefPtr<EntryArraySync> create(EntryArray*); - - unsigned length() const { return m_entries.size(); } - EntrySync* item(unsigned index) const; - - bool isEmpty() const { return m_entries.isEmpty(); } - void clear() { m_entries.clear(); } - void append(PassRefPtr<EntrySync> entry) { m_entries.append(entry); } - -private: - EntryArraySync(); - - Vector<RefPtr<EntrySync> > m_entries; -}; - -} - -#endif // ENABLE(FILE_SYSTEM) - -#endif // EntryArraySync_h diff --git a/Source/WebCore/fileapi/EntryArraySync.idl b/Source/WebCore/fileapi/EntryArraySync.idl deleted file mode 100644 index 224a68a24..000000000 --- a/Source/WebCore/fileapi/EntryArraySync.idl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - IndexedGetter, - JSNoStaticTables - ] EntryArraySync { - readonly attribute unsigned long length; - EntrySync item(in [IsIndex] unsigned long index); - }; -} diff --git a/Source/WebCore/fileapi/EntryBase.cpp b/Source/WebCore/fileapi/EntryBase.cpp deleted file mode 100644 index 0b1254b7a..000000000 --- a/Source/WebCore/fileapi/EntryBase.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "EntryBase.h" - -#if ENABLE(FILE_SYSTEM) - -#include "AsyncFileSystem.h" -#include "DOMFilePath.h" -#include "DOMFileSystemBase.h" -#include "PlatformString.h" -#include "SecurityOrigin.h" -#include <wtf/PassRefPtr.h> -#include <wtf/text/StringBuilder.h> - -namespace WebCore { - -EntryBase::EntryBase(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - : m_fileSystem(fileSystem) - , m_fullPath(fullPath) - , m_name(DOMFilePath::getName(fullPath)) -{ -} - -EntryBase::~EntryBase() -{ -} - -String EntryBase::toURL() -{ - return m_fileSystem->asyncFileSystem()->toURL(m_fileSystem->securityOrigin()->toString(), m_fullPath); -} - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/EntryBase.h b/Source/WebCore/fileapi/EntryBase.h deleted file mode 100644 index a34a914f1..000000000 --- a/Source/WebCore/fileapi/EntryBase.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef EntryBase_h -#define EntryBase_h - -#if ENABLE(FILE_SYSTEM) - -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class DOMFileSystemBase; -class EntrySync; - -// A common base class for Entry and EntrySync. -class EntryBase : public RefCounted<EntryBase> { -public: - virtual ~EntryBase(); - - DOMFileSystemBase* filesystem() const { return m_fileSystem.get(); } - - virtual bool isFile() const { return false; } - virtual bool isDirectory() const { return false; } - - const String& fullPath() const { return m_fullPath; } - const String& name() const { return m_name; } - - String toURL(); - -protected: - EntryBase(PassRefPtr<DOMFileSystemBase>, const String& fullPath); - friend class EntrySync; - - RefPtr<DOMFileSystemBase> m_fileSystem; - - // This is a virtual path. - String m_fullPath; - - String m_name; -}; - -} - -#endif // ENABLE(FILE_SYSTEM) - -#endif // EntryBase_h diff --git a/Source/WebCore/fileapi/EntryCallback.h b/Source/WebCore/fileapi/EntryCallback.h deleted file mode 100644 index 9580eda88..000000000 --- a/Source/WebCore/fileapi/EntryCallback.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef EntryCallback_h -#define EntryCallback_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/RefCounted.h> - -namespace WebCore { - -class Entry; - -class EntryCallback : public RefCounted<EntryCallback> { -public: - virtual ~EntryCallback() { } - virtual bool handleEvent(Entry*) = 0; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // EntryCallback_h diff --git a/Source/WebCore/fileapi/EntryCallback.idl b/Source/WebCore/fileapi/EntryCallback.idl deleted file mode 100644 index bea3fd147..000000000 --- a/Source/WebCore/fileapi/EntryCallback.idl +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - Callback - ] EntryCallback { - boolean handleEvent(in Entry entry); - }; -} diff --git a/Source/WebCore/fileapi/EntrySync.cpp b/Source/WebCore/fileapi/EntrySync.cpp deleted file mode 100644 index 299aeda36..000000000 --- a/Source/WebCore/fileapi/EntrySync.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "EntrySync.h" - -#if ENABLE(FILE_SYSTEM) - -#include "DOMFilePath.h" -#include "DOMFileSystemSync.h" -#include "DirectoryEntry.h" -#include "DirectoryEntrySync.h" -#include "FileEntrySync.h" -#include "FileException.h" -#include "Metadata.h" -#include "SyncCallbackHelper.h" - -namespace WebCore { - -PassRefPtr<EntrySync> EntrySync::create(EntryBase* entry) -{ - if (entry->isFile()) - return adoptRef(new FileEntrySync(entry->m_fileSystem, entry->m_fullPath)); - return adoptRef(new DirectoryEntrySync(entry->m_fileSystem, entry->m_fullPath)); -} - -PassRefPtr<Metadata> EntrySync::getMetadata(ExceptionCode& ec) -{ - ec = 0; - MetadataSyncCallbackHelper helper(m_fileSystem->asyncFileSystem()); - if (!m_fileSystem->getMetadata(this, helper.successCallback(), helper.errorCallback())) { - ec = FileException::INVALID_MODIFICATION_ERR; - return 0; - } - return helper.getResult(ec); -} - -PassRefPtr<EntrySync> EntrySync::moveTo(PassRefPtr<DirectoryEntrySync> parent, const String& name, ExceptionCode& ec) const -{ - ec = 0; - EntrySyncCallbackHelper helper(m_fileSystem->asyncFileSystem()); - if (!m_fileSystem->move(this, parent.get(), name, helper.successCallback(), helper.errorCallback())) { - ec = FileException::INVALID_MODIFICATION_ERR; - return 0; - } - return helper.getResult(ec); -} - -PassRefPtr<EntrySync> EntrySync::copyTo(PassRefPtr<DirectoryEntrySync> parent, const String& name, ExceptionCode& ec) const -{ - ec = 0; - EntrySyncCallbackHelper helper(m_fileSystem->asyncFileSystem()); - if (!m_fileSystem->copy(this, parent.get(), name, helper.successCallback(), helper.errorCallback())) { - ec = FileException::INVALID_MODIFICATION_ERR; - return 0; - } - return helper.getResult(ec); -} - -void EntrySync::remove(ExceptionCode& ec) const -{ - ec = 0; - VoidSyncCallbackHelper helper(m_fileSystem->asyncFileSystem()); - if (!m_fileSystem->remove(this, helper.successCallback(), helper.errorCallback())) { - ec = FileException::INVALID_MODIFICATION_ERR; - return; - } - helper.getResult(ec); -} - -PassRefPtr<EntrySync> EntrySync::getParent() const -{ - // Sync verion of getParent doesn't throw exceptions. - String parentPath = DOMFilePath::getDirectory(fullPath()); - return DirectoryEntrySync::create(m_fileSystem, parentPath); -} - -EntrySync::EntrySync(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - : EntryBase(fileSystem, fullPath) -{ -} - -} - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/EntrySync.h b/Source/WebCore/fileapi/EntrySync.h deleted file mode 100644 index 644ad7171..000000000 --- a/Source/WebCore/fileapi/EntrySync.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef EntrySync_h -#define EntrySync_h - -#if ENABLE(FILE_SYSTEM) - -#include "DOMFileSystemSync.h" -#include "EntryBase.h" -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class DirectoryEntrySync; -class Metadata; - -typedef int ExceptionCode; - -class EntrySync : public EntryBase { -public: - static PassRefPtr<EntrySync> create(EntryBase*); - - DOMFileSystemSync* filesystem() const { return static_cast<DOMFileSystemSync*>(m_fileSystem.get()); } - - PassRefPtr<Metadata> getMetadata(ExceptionCode&); - PassRefPtr<EntrySync> moveTo(PassRefPtr<DirectoryEntrySync> parent, const String& name, ExceptionCode&) const; - PassRefPtr<EntrySync> copyTo(PassRefPtr<DirectoryEntrySync> parent, const String& name, ExceptionCode&) const; - void remove(ExceptionCode&) const; - PassRefPtr<EntrySync> getParent() const; - -protected: - EntrySync(PassRefPtr<DOMFileSystemBase>, const String& fullPath); -}; - -} - -#endif // ENABLE(FILE_SYSTEM) - -#endif // EntrySync_h diff --git a/Source/WebCore/fileapi/EntrySync.idl b/Source/WebCore/fileapi/EntrySync.idl deleted file mode 100644 index cd4bae7de..000000000 --- a/Source/WebCore/fileapi/EntrySync.idl +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - CustomToJSObject, - JSNoStaticTables - ] EntrySync { - readonly attribute boolean isFile; - readonly attribute boolean isDirectory; - readonly attribute DOMString name; - readonly attribute DOMString fullPath; - readonly attribute DOMFileSystemSync filesystem; - - Metadata getMetadata() raises (FileException); - EntrySync moveTo(in DirectoryEntrySync parent, in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString name) raises (FileException); - EntrySync copyTo(in DirectoryEntrySync parent, in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString name) raises (FileException); - DOMString toURL(); - void remove() raises (FileException); - DirectoryEntrySync getParent(); - }; -} diff --git a/Source/WebCore/fileapi/ErrorCallback.h b/Source/WebCore/fileapi/ErrorCallback.h deleted file mode 100644 index cceb354fc..000000000 --- a/Source/WebCore/fileapi/ErrorCallback.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ErrorCallback_h -#define ErrorCallback_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/RefCounted.h> - -namespace WebCore { - -class FileError; - -class ErrorCallback : public RefCounted<ErrorCallback> { -public: - virtual ~ErrorCallback() { } - virtual bool handleEvent(FileError*) = 0; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // ErrorCallback_h diff --git a/Source/WebCore/fileapi/ErrorCallback.idl b/Source/WebCore/fileapi/ErrorCallback.idl deleted file mode 100644 index fc7fa85c4..000000000 --- a/Source/WebCore/fileapi/ErrorCallback.idl +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - Callback - ] ErrorCallback { - boolean handleEvent(in FileError error); - }; -} diff --git a/Source/WebCore/fileapi/File.cpp b/Source/WebCore/fileapi/File.cpp index d409b9719..905291b2d 100644 --- a/Source/WebCore/fileapi/File.cpp +++ b/Source/WebCore/fileapi/File.cpp @@ -50,8 +50,7 @@ static PassOwnPtr<BlobData> createBlobDataForFile(const String& path) return createBlobDataForFileWithType(path, type); } -#if ENABLE(FILE_SYSTEM) -static PassOwnPtr<BlobData> createBlobDataForFileSystemFile(const String& path, const String& fileSystemName) +static PassOwnPtr<BlobData> createBlobDataForFileWithName(const String& path, const String& fileSystemName) { String type; int index = fileSystemName.reverseFind('.'); @@ -59,7 +58,6 @@ static PassOwnPtr<BlobData> createBlobDataForFileSystemFile(const String& path, type = MIMETypeRegistry::getWellKnownMIMETypeForExtension(fileSystemName.substring(index + 1)); return createBlobDataForFileWithType(path, type); } -#endif #if ENABLE(DIRECTORY_UPLOAD) PassRefPtr<File> File::createWithRelativePath(const String& path, const String& relativePath) @@ -87,14 +85,12 @@ File::File(const String& path, const KURL& url, const String& type) // See SerializedScriptValue.cpp for js and v8. } -#if ENABLE(FILE_SYSTEM) File::File(const String& path, const String& name) - : Blob(createBlobDataForFileSystemFile(path, name), -1) + : Blob(createBlobDataForFileWithName(path, name), -1) , m_path(path) , m_name(name) { } -#endif double File::lastModifiedDate() const { diff --git a/Source/WebCore/fileapi/File.h b/Source/WebCore/fileapi/File.h index 13a91fe3e..83756711c 100644 --- a/Source/WebCore/fileapi/File.h +++ b/Source/WebCore/fileapi/File.h @@ -52,13 +52,13 @@ public: static PassRefPtr<File> createWithRelativePath(const String& path, const String& relativePath); #endif -#if ENABLE(FILE_SYSTEM) // Create a file with a name exposed to the author (via File.name and associated DOM properties) that differs from the one provided in the path. static PassRefPtr<File> createWithName(const String& path, const String& name) { + if (name.isEmpty()) + return adoptRef(new File(path)); return adoptRef(new File(path, name)); } -#endif virtual unsigned long long size() const; virtual bool isFile() const { return true; } @@ -74,19 +74,12 @@ public: // Note that this involves synchronous file operation. Think twice before calling this function. void captureSnapshot(long long& snapshotSize, double& snapshotModificationTime) const; - // FIXME: obsolete attributes. To be removed. - const String& fileName() const { return name(); } - unsigned long long fileSize() const { return size(); } - private: File(const String& path); // For deserialization. File(const String& path, const KURL& srcURL, const String& type); - -#if ENABLE(FILE_SYSTEM) File(const String& path, const String& name); -#endif String m_path; String m_name; diff --git a/Source/WebCore/fileapi/File.idl b/Source/WebCore/fileapi/File.idl index 4c3bafc27..7c0de4309 100644 --- a/Source/WebCore/fileapi/File.idl +++ b/Source/WebCore/fileapi/File.idl @@ -37,10 +37,6 @@ module html { #if defined(ENABLE_DIRECTORY_UPLOAD) && ENABLE_DIRECTORY_UPLOAD readonly attribute DOMString webkitRelativePath; #endif - - // FIXME: obsolete attributes. To be removed. - readonly attribute DOMString fileName; - readonly attribute unsigned long long fileSize; }; } diff --git a/Source/WebCore/fileapi/FileCallback.h b/Source/WebCore/fileapi/FileCallback.h deleted file mode 100644 index 6f5ca3d14..000000000 --- a/Source/WebCore/fileapi/FileCallback.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FileCallback_h -#define FileCallback_h - -#if ENABLE(FILE_SYSTEM) - -#include "File.h" -#include <wtf/RefCounted.h> - -namespace WebCore { - -class FileCallback : public RefCounted<FileCallback> { -public: - virtual ~FileCallback() { } - virtual bool handleEvent(File*) = 0; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // FileCallback_h diff --git a/Source/WebCore/fileapi/FileCallback.idl b/Source/WebCore/fileapi/FileCallback.idl deleted file mode 100644 index 0ab814fed..000000000 --- a/Source/WebCore/fileapi/FileCallback.idl +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module fileapi { - interface [ - Conditional=FILE_SYSTEM, - Callback - ] FileCallback { - boolean handleEvent(in File file); - }; -} diff --git a/Source/WebCore/fileapi/FileEntry.cpp b/Source/WebCore/fileapi/FileEntry.cpp deleted file mode 100644 index a5ecff578..000000000 --- a/Source/WebCore/fileapi/FileEntry.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "FileEntry.h" - -#if ENABLE(FILE_SYSTEM) - -#include "DOMFileSystem.h" -#include "ErrorCallback.h" -#include "File.h" -#include "FileCallback.h" -#include "FileWriterCallback.h" - -namespace WebCore { - -FileEntry::FileEntry(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - : Entry(fileSystem, fullPath) -{ -} - -void FileEntry::createWriter(PassRefPtr<FileWriterCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - filesystem()->createWriter(this, successCallback, errorCallback); -} - -void FileEntry::file(PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - filesystem()->createFile(this, successCallback, errorCallback); -} - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/FileEntry.h b/Source/WebCore/fileapi/FileEntry.h deleted file mode 100644 index f9cc85631..000000000 --- a/Source/WebCore/fileapi/FileEntry.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FileEntry_h -#define FileEntry_h - -#if ENABLE(FILE_SYSTEM) - -#include "Entry.h" - -namespace WebCore { - -class DOMFileSystemBase; -class FileCallback; -class FileWriterCallback; - -class FileEntry : public Entry { -public: - static PassRefPtr<FileEntry> create(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - { - return adoptRef(new FileEntry(fileSystem, fullPath)); - } - - void createWriter(PassRefPtr<FileWriterCallback>, PassRefPtr<ErrorCallback> = 0); - void file(PassRefPtr<FileCallback>, PassRefPtr<ErrorCallback> = 0); - - virtual bool isFile() const { return true; } - -private: - FileEntry(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath); -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // FileEntry_h diff --git a/Source/WebCore/fileapi/FileEntry.idl b/Source/WebCore/fileapi/FileEntry.idl deleted file mode 100644 index 63b004050..000000000 --- a/Source/WebCore/fileapi/FileEntry.idl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - JSGenerateToNativeObject, - JSGenerateToJSObject, - JSNoStaticTables - ] FileEntry : Entry { - void createWriter(in [Callback] FileWriterCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - void file(in [Callback] FileCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - }; -} diff --git a/Source/WebCore/fileapi/FileEntrySync.cpp b/Source/WebCore/fileapi/FileEntrySync.cpp deleted file mode 100644 index d899de786..000000000 --- a/Source/WebCore/fileapi/FileEntrySync.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "FileEntrySync.h" - -#if ENABLE(FILE_SYSTEM) - -#include "File.h" -#include "FileWriterSync.h" - -namespace WebCore { - -FileEntrySync::FileEntrySync(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - : EntrySync(fileSystem, fullPath) -{ -} - -PassRefPtr<File> FileEntrySync::file(ExceptionCode& ec) -{ - return filesystem()->createFile(this, ec); -} - -PassRefPtr<FileWriterSync> FileEntrySync::createWriter(ExceptionCode& ec) -{ - return filesystem()->createWriter(this, ec); -} - -} - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/FileEntrySync.h b/Source/WebCore/fileapi/FileEntrySync.h deleted file mode 100644 index 615a604bf..000000000 --- a/Source/WebCore/fileapi/FileEntrySync.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FileEntrySync_h -#define FileEntrySync_h - -#if ENABLE(FILE_SYSTEM) - -#include "EntrySync.h" -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class File; -class FileWriterSync; - -class FileEntrySync : public EntrySync { -public: - static PassRefPtr<FileEntrySync> create(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath) - { - return adoptRef(new FileEntrySync(fileSystem, fullPath)); - } - - virtual bool isFile() const { return true; } - - PassRefPtr<File> file(ExceptionCode&); - PassRefPtr<FileWriterSync> createWriter(ExceptionCode&); - -private: - friend class EntrySync; - FileEntrySync(PassRefPtr<DOMFileSystemBase>, const String& fullPath); -}; - -} - -#endif // ENABLE(FILE_SYSTEM) - -#endif // FileEntrySync_h diff --git a/Source/WebCore/fileapi/FileEntrySync.idl b/Source/WebCore/fileapi/FileEntrySync.idl deleted file mode 100644 index 8ac40baa2..000000000 --- a/Source/WebCore/fileapi/FileEntrySync.idl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - JSGenerateToNativeObject, - JSGenerateToJSObject, - JSNoStaticTables - ] FileEntrySync : EntrySync { - File file() raises (FileException); - FileWriterSync createWriter() raises (FileException); - }; -} diff --git a/Source/WebCore/fileapi/FileException.cpp b/Source/WebCore/fileapi/FileException.cpp index 5007f1cd5..357fb495d 100644 --- a/Source/WebCore/fileapi/FileException.cpp +++ b/Source/WebCore/fileapi/FileException.cpp @@ -34,39 +34,24 @@ namespace WebCore { -// FIXME: This should be an array of structs to pair the names and descriptions. -static const char* const exceptionNames[] = { - "NOT_FOUND_ERR", - "SECURITY_ERR", - "ABORT_ERR", - "NOT_READABLE_ERR", - "ENCODING_ERR", - "NO_MODIFICATION_ALLOWED_ERR", - "INVALID_STATE_ERR", - "SYNTAX_ERR", - "INVALID_MODIFICATION_ERR", - "QUOTA_EXCEEDED_ERR", - "TYPE_MISMATCH_ERR", - "PATH_EXISTS_ERR" +static struct FileExceptionNameDescription { + const char* const name; + const char* const description; +} fileExceptions[] = { + { "NOT_FOUND_ERR", "A requested file or directory could not be found at the time an operation was processed." }, + { "SECURITY_ERR", "It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources." }, + { "ABORT_ERR", "An ongoing operation was aborted, typically with a call to abort()." }, + { "NOT_READABLE_ERR", "The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired." }, + { "ENCODING_ERR", "A URI supplied to the API was malformed, or the resulting Data URL has exceeded the URL length limitations for Data URLs." }, + { "NO_MODIFICATION_ALLOWED_ERR", "An attempt was made to write to a file or directory which could not be modified due to the state of the underlying filesystem." }, + { "INVALID_STATE_ERR", "An operation that depends on state cached in an interface object was made but the state had changed since it was read from disk." }, + { "SYNTAX_ERR", "An invalid or unsupported argument was given, like an invalid line ending specifier." }, + { "INVALID_MODIFICATION_ERR", "The modification request was illegal." }, + { "QUOTA_EXCEEDED_ERR", "The operation failed because it would cause the application to exceed its storage quota." }, + { "TYPE_MISMATCH_ERR", "The path supplied exists, but was not an entry of requested type." }, + { "PATH_EXISTS_ERR", "An attempt was made to create a file or directory where an element already exists." } }; -static const char* const exceptionDescriptions[] = { - "A requested file or directory could not be found at the time an operation was processed.", - "It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources.", - "An ongoing operation was aborted, typically with a call to abort().", - "The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.", - "A URI supplied to the API was malformed, or the resulting Data URL has exceeded the URL length limitations for Data URLs.", - "An attempt was made to write to a file or directory which could not be modified due to the state of the underlying filesystem.", - "An operation that depends on state cached in an interface object was made but the state had changed since it was read from disk.", - "An invalid or unsupported argument was given, like an invalid line ending specifier.", - "The modification request was illegal.", - "The operation failed because it would cause the application to exceed its storage quota.", - "The path supplied exists, but was not an entry of requested type.", - "An attempt was made to create a file or directory where an element already exists." -}; - -COMPILE_ASSERT(WTF_ARRAY_LENGTH(exceptionNames) == WTF_ARRAY_LENGTH(exceptionDescriptions), FileExceptionTablesMustMatch); - bool FileException::initializeDescription(ExceptionCode ec, ExceptionCodeDescription* description) { if (ec < FileExceptionOffset || ec > FileExceptionMax) @@ -76,11 +61,11 @@ bool FileException::initializeDescription(ExceptionCode ec, ExceptionCodeDescrip description->code = ec - FileExceptionOffset; description->type = FileExceptionType; - size_t tableSize = WTF_ARRAY_LENGTH(exceptionNames); + size_t tableSize = WTF_ARRAY_LENGTH(fileExceptions); size_t tableIndex = ec - NOT_FOUND_ERR; - description->name = tableIndex < tableSize ? exceptionNames[tableIndex] : 0; - description->description = tableIndex < tableSize ? exceptionDescriptions[tableIndex] : 0; + description->name = tableIndex < tableSize ? fileExceptions[tableIndex].name : 0; + description->description = tableIndex < tableSize ? fileExceptions[tableIndex].description : 0; return true; } diff --git a/Source/WebCore/fileapi/FileException.idl b/Source/WebCore/fileapi/FileException.idl index 65de225ff..33244f9fc 100644 --- a/Source/WebCore/fileapi/FileException.idl +++ b/Source/WebCore/fileapi/FileException.idl @@ -29,7 +29,7 @@ */ module html { - interface [ + exception [ Conditional=BLOB|FILE_SYSTEM, DoNotCheckConstants, JSNoStaticTables diff --git a/Source/WebCore/fileapi/FileSystemCallback.h b/Source/WebCore/fileapi/FileSystemCallback.h deleted file mode 100644 index 63f8416d3..000000000 --- a/Source/WebCore/fileapi/FileSystemCallback.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FileSystemCallback_h -#define FileSystemCallback_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/RefCounted.h> - -namespace WebCore { - -class DOMFileSystem; - -class FileSystemCallback : public RefCounted<FileSystemCallback> { -public: - virtual ~FileSystemCallback() { } - virtual bool handleEvent(DOMFileSystem*) = 0; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // FileSystemCallback_h diff --git a/Source/WebCore/fileapi/FileSystemCallback.idl b/Source/WebCore/fileapi/FileSystemCallback.idl deleted file mode 100644 index cf686ff1b..000000000 --- a/Source/WebCore/fileapi/FileSystemCallback.idl +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - Callback - ] FileSystemCallback { - boolean handleEvent(in DOMFileSystem fileSystem); - }; -} diff --git a/Source/WebCore/fileapi/FileSystemCallbacks.cpp b/Source/WebCore/fileapi/FileSystemCallbacks.cpp deleted file mode 100644 index 1e9a99d24..000000000 --- a/Source/WebCore/fileapi/FileSystemCallbacks.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "FileSystemCallbacks.h" - -#if ENABLE(FILE_SYSTEM) - -#include "AsyncFileSystem.h" -#include "AsyncFileWriter.h" -#include "DOMFilePath.h" -#include "DOMFileSystemBase.h" -#include "DirectoryEntry.h" -#include "DirectoryReader.h" -#include "EntriesCallback.h" -#include "EntryArray.h" -#include "EntryCallback.h" -#include "ErrorCallback.h" -#include "FileEntry.h" -#include "FileError.h" -#include "FileMetadata.h" -#include "FileSystemCallback.h" -#include "FileWriterBase.h" -#include "FileWriterBaseCallback.h" -#include "Metadata.h" -#include "MetadataCallback.h" -#include "ScriptExecutionContext.h" -#include "VoidCallback.h" - -namespace WebCore { - -FileSystemCallbacksBase::FileSystemCallbacksBase(PassRefPtr<ErrorCallback> errorCallback) - : m_errorCallback(errorCallback) -{ -} - -FileSystemCallbacksBase::~FileSystemCallbacksBase() -{ -} - -void FileSystemCallbacksBase::didFail(int code) -{ - if (m_errorCallback) { - m_errorCallback->handleEvent(FileError::create(static_cast<FileError::ErrorCode>(code)).get()); - m_errorCallback.clear(); - } -} - -// EntryCallbacks ------------------------------------------------------------- - -PassOwnPtr<EntryCallbacks> EntryCallbacks::create(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, PassRefPtr<DOMFileSystemBase> fileSystem, const String& expectedPath, bool isDirectory) -{ - return adoptPtr(new EntryCallbacks(successCallback, errorCallback, fileSystem, expectedPath, isDirectory)); -} - -EntryCallbacks::EntryCallbacks(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, PassRefPtr<DOMFileSystemBase> fileSystem, const String& expectedPath, bool isDirectory) - : FileSystemCallbacksBase(errorCallback) - , m_successCallback(successCallback) - , m_fileSystem(fileSystem) - , m_expectedPath(expectedPath) - , m_isDirectory(isDirectory) -{ -} - -void EntryCallbacks::didSucceed() -{ - if (m_successCallback) { - if (m_isDirectory) - m_successCallback->handleEvent(DirectoryEntry::create(m_fileSystem, m_expectedPath).get()); - else - m_successCallback->handleEvent(FileEntry::create(m_fileSystem, m_expectedPath).get()); - } - m_successCallback.clear(); -} - -// EntriesCallbacks ----------------------------------------------------------- - -PassOwnPtr<EntriesCallbacks> EntriesCallbacks::create(PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, PassRefPtr<DirectoryReaderBase> directoryReader, const String& basePath) -{ - return adoptPtr(new EntriesCallbacks(successCallback, errorCallback, directoryReader, basePath)); -} - -EntriesCallbacks::EntriesCallbacks(PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, PassRefPtr<DirectoryReaderBase> directoryReader, const String& basePath) - : FileSystemCallbacksBase(errorCallback) - , m_successCallback(successCallback) - , m_directoryReader(directoryReader) - , m_basePath(basePath) - , m_entries(EntryArray::create()) -{ - ASSERT(m_directoryReader); -} - -void EntriesCallbacks::didReadDirectoryEntry(const String& name, bool isDirectory) -{ - if (isDirectory) - m_entries->append(DirectoryEntry::create(m_directoryReader->filesystem(), DOMFilePath::append(m_basePath, name))); - else - m_entries->append(FileEntry::create(m_directoryReader->filesystem(), DOMFilePath::append(m_basePath, name))); -} - -void EntriesCallbacks::didReadDirectoryEntries(bool hasMore) -{ - m_directoryReader->setHasMoreEntries(hasMore); - if (m_successCallback) - m_successCallback->handleEvent(m_entries.get()); -} - -// FileSystemCallbacks -------------------------------------------------------- - -PassOwnPtr<FileSystemCallbacks> FileSystemCallbacks::create(PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, ScriptExecutionContext* scriptExecutionContext) -{ - return adoptPtr(new FileSystemCallbacks(successCallback, errorCallback, scriptExecutionContext)); -} - -FileSystemCallbacks::FileSystemCallbacks(PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, ScriptExecutionContext* context) - : FileSystemCallbacksBase(errorCallback) - , m_successCallback(successCallback) - , m_scriptExecutionContext(context) -{ -} - -void FileSystemCallbacks::didOpenFileSystem(const String& name, PassOwnPtr<AsyncFileSystem> asyncFileSystem) -{ - if (m_successCallback) { - ASSERT(asyncFileSystem); - RefPtr<DOMFileSystem> fileSystem = DOMFileSystem::create(m_scriptExecutionContext.get(), name, asyncFileSystem); - m_successCallback->handleEvent(fileSystem.get()); - m_scriptExecutionContext.clear(); - } - m_successCallback.clear(); -} - -// ResolveURICallbacks -------------------------------------------------------- - -namespace { - -class ErrorCallbackWrapper : public ErrorCallback { -public: - static PassRefPtr<ErrorCallbackWrapper> create(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, PassRefPtr<DirectoryEntry> root, const String& filePath) - { - return adoptRef(new ErrorCallbackWrapper(successCallback, errorCallback, root, filePath)); - } - - virtual bool handleEvent(FileError* error) - { - ASSERT(error); - if (error->code() == FileError::TYPE_MISMATCH_ERR) - m_root->getFile(m_filePath, 0, m_successCallback, m_errorCallback); - else if (m_errorCallback) - m_errorCallback->handleEvent(error); - return true; - } - -private: - ErrorCallbackWrapper(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, PassRefPtr<DirectoryEntry> root, const String& filePath) - : m_successCallback(successCallback) - , m_errorCallback(errorCallback) - , m_root(root) - , m_filePath(filePath) - { - ASSERT(m_root); - } - - RefPtr<EntryCallback> m_successCallback; - RefPtr<ErrorCallback> m_errorCallback; - RefPtr<DirectoryEntry> m_root; - String m_filePath; -}; - -} // namespace - -PassOwnPtr<ResolveURICallbacks> ResolveURICallbacks::create(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, ScriptExecutionContext* scriptExecutionContext, const String& filePath) -{ - return adoptPtr(new ResolveURICallbacks(successCallback, errorCallback, scriptExecutionContext, filePath)); -} - -ResolveURICallbacks::ResolveURICallbacks(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, ScriptExecutionContext* context, const String& filePath) - : FileSystemCallbacksBase(errorCallback) - , m_successCallback(successCallback) - , m_scriptExecutionContext(context) - , m_filePath(filePath) -{ -} - -void ResolveURICallbacks::didOpenFileSystem(const String& name, PassOwnPtr<AsyncFileSystem> asyncFileSystem) -{ - ASSERT(asyncFileSystem); - RefPtr<DirectoryEntry> root = DOMFileSystem::create(m_scriptExecutionContext.get(), name, asyncFileSystem)->root(); - root->getDirectory(m_filePath, 0, m_successCallback, ErrorCallbackWrapper::create(m_successCallback, m_errorCallback, root, m_filePath)); -} - -// MetadataCallbacks ---------------------------------------------------------- - -PassOwnPtr<MetadataCallbacks> MetadataCallbacks::create(PassRefPtr<MetadataCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - return adoptPtr(new MetadataCallbacks(successCallback, errorCallback)); -} - -MetadataCallbacks::MetadataCallbacks(PassRefPtr<MetadataCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) - : FileSystemCallbacksBase(errorCallback) - , m_successCallback(successCallback) -{ -} - -void MetadataCallbacks::didReadMetadata(const FileMetadata& metadata) -{ - if (m_successCallback) - m_successCallback->handleEvent(Metadata::create(metadata).get()); - m_successCallback.clear(); -} - -// FileWriterBaseCallbacks ---------------------------------------------------------- - -PassOwnPtr<FileWriterBaseCallbacks> FileWriterBaseCallbacks::create(PassRefPtr<FileWriterBase> fileWriter, PassRefPtr<FileWriterBaseCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - return adoptPtr(new FileWriterBaseCallbacks(fileWriter, successCallback, errorCallback)); -} - -FileWriterBaseCallbacks::FileWriterBaseCallbacks(PassRefPtr<FileWriterBase> fileWriter, PassRefPtr<FileWriterBaseCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) - : FileSystemCallbacksBase(errorCallback) - , m_fileWriter(fileWriter) - , m_successCallback(successCallback) -{ -} - -void FileWriterBaseCallbacks::didCreateFileWriter(PassOwnPtr<AsyncFileWriter> asyncFileWriter, long long length) -{ - m_fileWriter->initialize(asyncFileWriter, length); - if (m_successCallback) - m_successCallback->handleEvent(m_fileWriter.release().get()); - m_successCallback.clear(); -} - -// VoidCallbacks -------------------------------------------------------------- - -PassOwnPtr<VoidCallbacks> VoidCallbacks::create(PassRefPtr<VoidCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - return adoptPtr(new VoidCallbacks(successCallback, errorCallback)); -} - -VoidCallbacks::VoidCallbacks(PassRefPtr<VoidCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) - : FileSystemCallbacksBase(errorCallback) - , m_successCallback(successCallback) -{ -} - -void VoidCallbacks::didSucceed() -{ - if (m_successCallback) - m_successCallback->handleEvent(); - m_successCallback.clear(); -} - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/FileSystemCallbacks.h b/Source/WebCore/fileapi/FileSystemCallbacks.h deleted file mode 100644 index e02deb9f0..000000000 --- a/Source/WebCore/fileapi/FileSystemCallbacks.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FileSystemCallbacks_h -#define FileSystemCallbacks_h - -#if ENABLE(FILE_SYSTEM) - -#include "AsyncFileSystemCallbacks.h" -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/Vector.h> - -namespace WebCore { - -class AsyncFileWriter; -class DOMFileSystemBase; -class DirectoryReaderBase; -class EntriesCallback; -class EntryArray; -class EntryCallback; -class ErrorCallback; -struct FileMetadata; -class FileSystemCallback; -class FileWriterBase; -class FileWriterBaseCallback; -class MetadataCallback; -class ScriptExecutionContext; -class VoidCallback; - -class FileSystemCallbacksBase : public AsyncFileSystemCallbacks { -public: - virtual ~FileSystemCallbacksBase(); - - // For ErrorCallback. - virtual void didFail(int code); - - // Other callback methods are implemented by each subclass. - -protected: - FileSystemCallbacksBase(PassRefPtr<ErrorCallback> errorCallback); - RefPtr<ErrorCallback> m_errorCallback; -}; - -// Subclasses ---------------------------------------------------------------- - -class EntryCallbacks : public FileSystemCallbacksBase { -public: - static PassOwnPtr<EntryCallbacks> create(PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, PassRefPtr<DOMFileSystemBase>, const String& expectedPath, bool isDirectory); - virtual void didSucceed(); - -private: - EntryCallbacks(PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, PassRefPtr<DOMFileSystemBase>, const String& expectedPath, bool isDirectory); - RefPtr<EntryCallback> m_successCallback; - RefPtr<DOMFileSystemBase> m_fileSystem; - String m_expectedPath; - bool m_isDirectory; -}; - -class EntriesCallbacks : public FileSystemCallbacksBase { -public: - static PassOwnPtr<EntriesCallbacks> create(PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>, PassRefPtr<DirectoryReaderBase>, const String& basePath); - virtual void didReadDirectoryEntry(const String& name, bool isDirectory); - virtual void didReadDirectoryEntries(bool hasMore); - -private: - EntriesCallbacks(PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>, PassRefPtr<DirectoryReaderBase>, const String& basePath); - RefPtr<EntriesCallback> m_successCallback; - RefPtr<DirectoryReaderBase> m_directoryReader; - String m_basePath; - RefPtr<EntryArray> m_entries; -}; - -class FileSystemCallbacks : public FileSystemCallbacksBase { -public: - static PassOwnPtr<FileSystemCallbacks> create(PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback>, ScriptExecutionContext*); - virtual void didOpenFileSystem(const String& name, PassOwnPtr<AsyncFileSystem>); - -private: - FileSystemCallbacks(PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback>, ScriptExecutionContext*); - RefPtr<FileSystemCallback> m_successCallback; - RefPtr<ScriptExecutionContext> m_scriptExecutionContext; -}; - -class ResolveURICallbacks : public FileSystemCallbacksBase { -public: - static PassOwnPtr<ResolveURICallbacks> create(PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, ScriptExecutionContext*, const String& filePath); - virtual void didOpenFileSystem(const String& name, PassOwnPtr<AsyncFileSystem>); - -private: - ResolveURICallbacks(PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, ScriptExecutionContext*, const String& filePath); - RefPtr<EntryCallback> m_successCallback; - RefPtr<ScriptExecutionContext> m_scriptExecutionContext; - String m_filePath; -}; - -class MetadataCallbacks : public FileSystemCallbacksBase { -public: - static PassOwnPtr<MetadataCallbacks> create(PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>); - virtual void didReadMetadata(const FileMetadata&); - -private: - MetadataCallbacks(PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>); - RefPtr<MetadataCallback> m_successCallback; -}; - -class FileWriterBaseCallbacks : public FileSystemCallbacksBase { -public: - static PassOwnPtr<FileWriterBaseCallbacks> create(PassRefPtr<FileWriterBase>, PassRefPtr<FileWriterBaseCallback>, PassRefPtr<ErrorCallback>); - virtual void didCreateFileWriter(PassOwnPtr<AsyncFileWriter>, long long length); - -private: - FileWriterBaseCallbacks(PassRefPtr<FileWriterBase>, PassRefPtr<FileWriterBaseCallback>, PassRefPtr<ErrorCallback>); - RefPtr<FileWriterBase> m_fileWriter; - RefPtr<FileWriterBaseCallback> m_successCallback; -}; - -class VoidCallbacks : public FileSystemCallbacksBase { -public: - static PassOwnPtr<VoidCallbacks> create(PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>); - virtual void didSucceed(); - -private: - VoidCallbacks(PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>); - RefPtr<VoidCallback> m_successCallback; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // FileSystemCallbacks_h diff --git a/Source/WebCore/fileapi/FileWriter.cpp b/Source/WebCore/fileapi/FileWriter.cpp deleted file mode 100644 index 7cd9b8348..000000000 --- a/Source/WebCore/fileapi/FileWriter.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(FILE_SYSTEM) - -#include "FileWriter.h" - -#include "AsyncFileWriter.h" -#include "Blob.h" -#include "ExceptionCode.h" -#include "FileError.h" -#include "FileException.h" -#include "ProgressEvent.h" - -namespace WebCore { - -static const int kMaxRecursionDepth = 3; - -PassRefPtr<FileWriter> FileWriter::create(ScriptExecutionContext* context) -{ - RefPtr<FileWriter> fileWriter(adoptRef(new FileWriter(context))); - fileWriter->suspendIfNeeded(); - return fileWriter.release(); -} - -FileWriter::FileWriter(ScriptExecutionContext* context) - : ActiveDOMObject(context, this) - , m_readyState(INIT) - , m_isOperationInProgress(false) - , m_queuedOperation(OperationNone) - , m_bytesWritten(0) - , m_bytesToWrite(0) - , m_truncateLength(-1) - , m_numAborts(0) - , m_recursionDepth(0) -{ -} - -FileWriter::~FileWriter() -{ - ASSERT(!m_recursionDepth); - if (m_readyState == WRITING) - stop(); -} - -const AtomicString& FileWriter::interfaceName() const -{ - return eventNames().interfaceForFileWriter; -} - -bool FileWriter::hasPendingActivity() const -{ - return m_readyState == WRITING || ActiveDOMObject::hasPendingActivity(); -} - -bool FileWriter::canSuspend() const -{ - // FIXME: It is not currently possible to suspend a FileWriter, so pages with FileWriter can not go into page cache. - return false; -} - -void FileWriter::stop() -{ - // Make sure we've actually got something to stop, and haven't already called abort(). - if (writer() && m_readyState == WRITING && m_isOperationInProgress && m_queuedOperation == OperationNone) - writer()->abort(); - m_blobBeingWritten.clear(); - m_readyState = DONE; -} - -void FileWriter::write(Blob* data, ExceptionCode& ec) -{ - ASSERT(writer()); - ASSERT(data); - ASSERT(m_truncateLength == -1); - if (m_readyState == WRITING) { - setError(FileError::INVALID_STATE_ERR, ec); - return; - } - if (!data) { - setError(FileError::TYPE_MISMATCH_ERR, ec); - return; - } - if (m_recursionDepth > kMaxRecursionDepth) { - setError(FileError::SECURITY_ERR, ec); - return; - } - m_blobBeingWritten = data; - m_readyState = WRITING; - m_bytesWritten = 0; - m_bytesToWrite = data->size(); - ASSERT(m_queuedOperation == OperationNone); - if (m_isOperationInProgress) // We must be waiting for an abort to complete, since m_readyState wasn't WRITING. - m_queuedOperation = OperationWrite; - else - writer()->write(position(), m_blobBeingWritten.get()); - m_isOperationInProgress = true; - fireEvent(eventNames().writestartEvent); -} - -void FileWriter::seek(long long position, ExceptionCode& ec) -{ - ASSERT(writer()); - if (m_readyState == WRITING) { - setError(FileError::INVALID_STATE_ERR, ec); - return; - } - - ASSERT(m_truncateLength == -1); - ASSERT(m_queuedOperation == OperationNone); - seekInternal(position); -} - -void FileWriter::truncate(long long position, ExceptionCode& ec) -{ - ASSERT(writer()); - ASSERT(m_truncateLength == -1); - if (m_readyState == WRITING || position < 0) { - setError(FileError::INVALID_STATE_ERR, ec); - return; - } - if (m_recursionDepth > kMaxRecursionDepth) { - setError(FileError::SECURITY_ERR, ec); - return; - } - m_readyState = WRITING; - m_bytesWritten = 0; - m_bytesToWrite = 0; - m_truncateLength = position; - ASSERT(m_queuedOperation == OperationNone); - if (m_isOperationInProgress) // We must be waiting for an abort to complete. - m_queuedOperation = OperationTruncate; - else - writer()->truncate(m_truncateLength); - m_isOperationInProgress = true; - fireEvent(eventNames().writestartEvent); -} - -void FileWriter::abort(ExceptionCode& ec) -{ - ASSERT(writer()); - if (m_readyState != WRITING) { - return; - } - ++m_numAborts; - - if (m_isOperationInProgress) - writer()->abort(); - m_queuedOperation = OperationNone; - m_blobBeingWritten.clear(); - m_truncateLength = -1; - signalCompletion(FileError::ABORT_ERR); -} - -void FileWriter::didWrite(long long bytes, bool complete) -{ - ASSERT(m_readyState == WRITING); - ASSERT(m_truncateLength == -1); - ASSERT(m_isOperationInProgress); - ASSERT(bytes + m_bytesWritten > 0); - ASSERT(bytes + m_bytesWritten <= m_bytesToWrite); - m_bytesWritten += bytes; - ASSERT((m_bytesWritten == m_bytesToWrite) || !complete); - setPosition(position() + bytes); - if (position() > length()) - setLength(position()); - // TODO: Throttle to no more frequently than every 50ms. - int numAborts = m_numAborts; - fireEvent(eventNames().progressEvent); - // We could get an abort in the handler for this event. If we do, it's - // already handled the cleanup and signalCompletion call. - if (complete && numAborts == m_numAborts) { - m_blobBeingWritten.clear(); - m_isOperationInProgress = false; - signalCompletion(FileError::OK); - } -} - -void FileWriter::didTruncate() -{ - ASSERT(m_truncateLength >= 0); - setLength(m_truncateLength); - if (position() > length()) - setPosition(length()); - m_isOperationInProgress = false; - signalCompletion(FileError::OK); -} - -void FileWriter::didFail(FileError::ErrorCode code) -{ - ASSERT(m_isOperationInProgress); - m_isOperationInProgress = false; - ASSERT(code != FileError::OK); - if (code == FileError::ABORT_ERR) { - Operation operation = m_queuedOperation; - m_queuedOperation = OperationNone; - doOperation(operation); - } else { - ASSERT(m_queuedOperation == OperationNone); - ASSERT(m_readyState == WRITING); - m_blobBeingWritten.clear(); - signalCompletion(code); - } -} - -void FileWriter::doOperation(Operation operation) -{ - ASSERT(m_queuedOperation == OperationNone); - ASSERT(!m_isOperationInProgress); - ASSERT(operation == OperationNone || operation == OperationWrite || operation == OperationTruncate); - switch (operation) { - case OperationWrite: - ASSERT(m_truncateLength == -1); - ASSERT(m_blobBeingWritten.get()); - ASSERT(m_readyState == WRITING); - writer()->write(position(), m_blobBeingWritten.get()); - m_isOperationInProgress = true; - break; - case OperationTruncate: - ASSERT(m_truncateLength >= 0); - ASSERT(m_readyState == WRITING); - writer()->truncate(m_truncateLength); - m_isOperationInProgress = true; - break; - case OperationNone: - ASSERT(m_truncateLength == -1); - ASSERT(!m_blobBeingWritten.get()); - ASSERT(m_readyState == DONE); - break; - } -} - -void FileWriter::signalCompletion(FileError::ErrorCode code) -{ - m_readyState = DONE; - m_truncateLength = -1; - if (FileError::OK != code) { - m_error = FileError::create(code); - if (FileError::ABORT_ERR == code) - fireEvent(eventNames().abortEvent); - else - fireEvent(eventNames().errorEvent); - } else - fireEvent(eventNames().writeEvent); - fireEvent(eventNames().writeendEvent); -} - -void FileWriter::fireEvent(const AtomicString& type) -{ - ++m_recursionDepth; - dispatchEvent(ProgressEvent::create(type, true, m_bytesWritten, m_bytesToWrite)); - --m_recursionDepth; - ASSERT(m_recursionDepth >= 0); -} - -void FileWriter::setError(FileError::ErrorCode errorCode, ExceptionCode& ec) -{ - ec = FileException::ErrorCodeToExceptionCode(errorCode); - m_error = FileError::create(errorCode); -} - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/FileWriter.h b/Source/WebCore/fileapi/FileWriter.h deleted file mode 100644 index 946135072..000000000 --- a/Source/WebCore/fileapi/FileWriter.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FileWriter_h -#define FileWriter_h - -#if ENABLE(FILE_SYSTEM) - -#include "ActiveDOMObject.h" -#include "AsyncFileWriterClient.h" -#include "EventTarget.h" -#include "FileWriterBase.h" -#include "ScriptExecutionContext.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefPtr.h> - -namespace WebCore { - -class Blob; -class ScriptExecutionContext; - -class FileWriter : public FileWriterBase, public ActiveDOMObject, public EventTarget, public AsyncFileWriterClient { -public: - static PassRefPtr<FileWriter> create(ScriptExecutionContext*); - - enum ReadyState { - INIT = 0, - WRITING = 1, - DONE = 2 - }; - - void write(Blob*, ExceptionCode&); - void seek(long long position, ExceptionCode&); - void truncate(long long length, ExceptionCode&); - void abort(ExceptionCode&); - ReadyState readyState() const { return m_readyState; } - FileError* error() const { return m_error.get(); } - - // AsyncFileWriterClient - void didWrite(long long bytes, bool complete); - void didTruncate(); - void didFail(FileError::ErrorCode); - - // ActiveDOMObject - virtual bool canSuspend() const; - virtual bool hasPendingActivity() const; - virtual void stop(); - - // EventTarget - virtual const AtomicString& interfaceName() const; - virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); } - - using RefCounted<FileWriterBase>::ref; - using RefCounted<FileWriterBase>::deref; - - DEFINE_ATTRIBUTE_EVENT_LISTENER(writestart); - DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); - DEFINE_ATTRIBUTE_EVENT_LISTENER(write); - DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); - DEFINE_ATTRIBUTE_EVENT_LISTENER(error); - DEFINE_ATTRIBUTE_EVENT_LISTENER(writeend); - -private: - enum Operation { - OperationNone, - OperationWrite, - OperationTruncate - }; - - FileWriter(ScriptExecutionContext*); - - virtual ~FileWriter(); - - // EventTarget - virtual void refEventTarget() { ref(); } - virtual void derefEventTarget() { deref(); } - virtual EventTargetData* eventTargetData() { return &m_eventTargetData; } - virtual EventTargetData* ensureEventTargetData() { return &m_eventTargetData; } - - void doOperation(Operation); - - void signalCompletion(FileError::ErrorCode); - - void fireEvent(const AtomicString& type); - - void setError(FileError::ErrorCode, ExceptionCode&); - - RefPtr<FileError> m_error; - EventTargetData m_eventTargetData; - ReadyState m_readyState; - bool m_isOperationInProgress; - Operation m_queuedOperation; - long long m_bytesWritten; - long long m_bytesToWrite; - long long m_truncateLength; - long long m_numAborts; - long long m_recursionDepth; - RefPtr<Blob> m_blobBeingWritten; -}; - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) - -#endif // FileWriter_h diff --git a/Source/WebCore/fileapi/FileWriter.idl b/Source/WebCore/fileapi/FileWriter.idl deleted file mode 100644 index c6a88f366..000000000 --- a/Source/WebCore/fileapi/FileWriter.idl +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * Copyright (C) 2011 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [ - Conditional=FILE_SYSTEM, - ActiveDOMObject, - CallWith=ScriptExecutionContext, - EventTarget, - JSNoStaticTables - ] FileWriter { - // ready states - const unsigned short INIT = 0; - const unsigned short WRITING = 1; - const unsigned short DONE = 2; - readonly attribute unsigned short readyState; - - // async write/modify methods - void write(in Blob data) raises (FileException); - void seek(in long long position) raises (FileException); - void truncate(in long long size) raises (FileException); - - void abort() raises (FileException); - - readonly attribute FileError error; - readonly attribute long long position; - readonly attribute long long length; - - attribute EventListener onwritestart; - attribute EventListener onprogress; - attribute EventListener onwrite; - attribute EventListener onabort; - attribute EventListener onerror; - attribute EventListener onwriteend; - }; -} diff --git a/Source/WebCore/fileapi/FileWriterBase.cpp b/Source/WebCore/fileapi/FileWriterBase.cpp deleted file mode 100644 index dc55bb871..000000000 --- a/Source/WebCore/fileapi/FileWriterBase.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(FILE_SYSTEM) - -#include "FileWriterBase.h" - -#include "AsyncFileWriter.h" -#include "Blob.h" -#include "ExceptionCode.h" -#include "FileError.h" -#include "FileException.h" -#include "ProgressEvent.h" - -namespace WebCore { - -FileWriterBase::~FileWriterBase() -{ -} - -void FileWriterBase::initialize(PassOwnPtr<AsyncFileWriter> writer, long long length) -{ - ASSERT(!m_writer); - ASSERT(length >= 0); - m_writer = writer; - m_length = length; -} - -FileWriterBase::FileWriterBase() - : m_position(0) -{ -} - -void FileWriterBase::seekInternal(long long position) -{ - if (position > m_length) - position = m_length; - else if (position < 0) - position = m_length + position; - if (position < 0) - position = 0; - m_position = position; -} - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/FileWriterBase.h b/Source/WebCore/fileapi/FileWriterBase.h deleted file mode 100644 index 3e913abcf..000000000 --- a/Source/WebCore/fileapi/FileWriterBase.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FileWriterBase_h -#define FileWriterBase_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class AsyncFileWriter; - -typedef int ExceptionCode; - -class FileWriterBase : public RefCounted<FileWriterBase> { -public: - virtual ~FileWriterBase(); - void initialize(PassOwnPtr<AsyncFileWriter>, long long length); - - long long position() const - { - return m_position; - } - long long length() const - { - return m_length; - } - -protected: - FileWriterBase(); - - AsyncFileWriter* writer() - { - return m_writer.get(); - } - - void setPosition(long long position) - { - m_position = position; - } - - void setLength(long long length) - { - m_length = length; - } - - void seekInternal(long long position); - -private: - friend class WTF::RefCounted<FileWriterBase>; - - OwnPtr<AsyncFileWriter> m_writer; - long long m_position; - long long m_length; -}; - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) - -#endif // FileWriterBase_h diff --git a/Source/WebCore/fileapi/FileWriterBaseCallback.h b/Source/WebCore/fileapi/FileWriterBaseCallback.h deleted file mode 100644 index 51e8ab7a0..000000000 --- a/Source/WebCore/fileapi/FileWriterBaseCallback.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FileWriterBaseCallback_h -#define FileWriterBaseCallback_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/RefCounted.h> - -namespace WebCore { - -class FileWriterBase; - -class FileWriterBaseCallback : public RefCounted<FileWriterBaseCallback> { -public: - virtual ~FileWriterBaseCallback() { } - virtual bool handleEvent(FileWriterBase*) = 0; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // FileWriterBaseCallback_h diff --git a/Source/WebCore/fileapi/FileWriterCallback.h b/Source/WebCore/fileapi/FileWriterCallback.h deleted file mode 100644 index 3f9e746fa..000000000 --- a/Source/WebCore/fileapi/FileWriterCallback.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FileWriterCallback_h -#define FileWriterCallback_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/RefCounted.h> - -namespace WebCore { - -class FileWriter; - -class FileWriterCallback : public RefCounted<FileWriterCallback> { -public: - virtual ~FileWriterCallback() { } - virtual bool handleEvent(FileWriter*) = 0; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // FileWriterCallback_h diff --git a/Source/WebCore/fileapi/FileWriterCallback.idl b/Source/WebCore/fileapi/FileWriterCallback.idl deleted file mode 100644 index df82fed8d..000000000 --- a/Source/WebCore/fileapi/FileWriterCallback.idl +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module fileapi { - interface [ - Conditional=FILE_SYSTEM, - Callback - ] FileWriterCallback { - boolean handleEvent(in FileWriter fileWriter); - }; -} diff --git a/Source/WebCore/fileapi/FileWriterSync.cpp b/Source/WebCore/fileapi/FileWriterSync.cpp deleted file mode 100644 index 28a68f818..000000000 --- a/Source/WebCore/fileapi/FileWriterSync.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(FILE_SYSTEM) - -#include "FileWriterSync.h" - -#include "AsyncFileWriter.h" -#include "Blob.h" -#include "FileException.h" - -namespace WebCore { - -void FileWriterSync::write(Blob* data, ExceptionCode& ec) -{ - ASSERT(writer()); - ASSERT(m_complete); - ec = 0; - if (!data) { - ec = FileException::TYPE_MISMATCH_ERR; - return; - } - - prepareForWrite(); - writer()->write(position(), data); - writer()->waitForOperationToComplete(); - ASSERT(m_complete); - ec = FileException::ErrorCodeToExceptionCode(m_error); - if (ec) - return; - setPosition(position() + data->size()); - if (position() > length()) - setLength(position()); -} - -void FileWriterSync::seek(long long position, ExceptionCode& ec) -{ - ASSERT(writer()); - ASSERT(m_complete); - ec = 0; - seekInternal(position); -} - -void FileWriterSync::truncate(long long offset, ExceptionCode& ec) -{ - ASSERT(writer()); - ASSERT(m_complete); - ec = 0; - if (offset < 0) { - ec = FileException::INVALID_STATE_ERR; - return; - } - prepareForWrite(); - writer()->truncate(offset); - writer()->waitForOperationToComplete(); - ASSERT(m_complete); - ec = FileException::ErrorCodeToExceptionCode(m_error); - if (ec) - return; - if (offset < position()) - setPosition(offset); - setLength(offset); -} - -void FileWriterSync::didWrite(long long bytes, bool complete) -{ - ASSERT(m_error == FileError::OK); - ASSERT(!m_complete); -#ifndef NDEBUG - m_complete = complete; -#else - ASSERT_UNUSED(complete, complete); -#endif -} - -void FileWriterSync::didTruncate() -{ - ASSERT(m_error == FileError::OK); - ASSERT(!m_complete); -#ifndef NDEBUG - m_complete = true; -#endif -} - -void FileWriterSync::didFail(FileError::ErrorCode error) -{ - ASSERT(m_error == FileError::OK); - m_error = error; - ASSERT(!m_complete); -#ifndef NDEBUG - m_complete = true; -#endif -} - -FileWriterSync::FileWriterSync() - : m_error(FileError::OK) -#ifndef NDEBUG - , m_complete(true) -#endif -{ -} - -void FileWriterSync::prepareForWrite() -{ - ASSERT(m_complete); - m_error = FileError::OK; -#ifndef NDEBUG - m_complete = false; -#endif -} - -FileWriterSync::~FileWriterSync() -{ -} - - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/FileWriterSync.h b/Source/WebCore/fileapi/FileWriterSync.h deleted file mode 100644 index d9abefb80..000000000 --- a/Source/WebCore/fileapi/FileWriterSync.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FileWriterSync_h -#define FileWriterSync_h - -#if ENABLE(FILE_SYSTEM) - -#include "AsyncFileWriterClient.h" -#include "FileError.h" -#include "FileWriterBase.h" -#include <wtf/PassRefPtr.h> - -namespace WebCore { - -class Blob; - -typedef int ExceptionCode; - -class FileWriterSync : public FileWriterBase, public AsyncFileWriterClient { -public: - static PassRefPtr<FileWriterSync> create() - { - return adoptRef(new FileWriterSync()); - } - virtual ~FileWriterSync(); - - // FileWriterBase - void write(Blob*, ExceptionCode&); - void seek(long long position, ExceptionCode&); - void truncate(long long length, ExceptionCode&); - - // AsyncFileWriterClient, via FileWriterBase - void didWrite(long long bytes, bool complete); - void didTruncate(); - void didFail(FileError::ErrorCode); - -private: - FileWriterSync(); - void prepareForWrite(); - - FileError::ErrorCode m_error; -#ifndef NDEBUG - bool m_complete; -#endif -}; - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) - -#endif // FileWriter_h diff --git a/Source/WebCore/fileapi/FileWriterSync.idl b/Source/WebCore/fileapi/FileWriterSync.idl deleted file mode 100644 index c561bb43b..000000000 --- a/Source/WebCore/fileapi/FileWriterSync.idl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [ - Conditional=FILE_SYSTEM, - ] FileWriterSync { - // synchronous write/modify methods - void write(in Blob data) raises (FileException); - void seek(in long long position) raises (FileException); - void truncate(in long long size) raises (FileException); - - readonly attribute long long position; - readonly attribute long long length; - }; -} diff --git a/Source/WebCore/fileapi/LocalFileSystem.cpp b/Source/WebCore/fileapi/LocalFileSystem.cpp deleted file mode 100644 index 8f0169eea..000000000 --- a/Source/WebCore/fileapi/LocalFileSystem.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "LocalFileSystem.h" - -#if PLATFORM(CHROMIUM) -#error "Chromium should not compile this file and instead define its own version of these factories." -#endif - -#if ENABLE(FILE_SYSTEM) - -#include "CrossThreadTask.h" -#include "DOMFileSystem.h" -#include "ErrorCallback.h" -#include "ExceptionCode.h" -#include "FileError.h" -#include "FileSystemCallback.h" -#include "FileSystemCallbacks.h" -#include "ScriptExecutionContext.h" -#include "SecurityOrigin.h" -#include <wtf/MainThread.h> -#include <wtf/PassRefPtr.h> - -namespace WebCore { - -LocalFileSystem* LocalFileSystem::s_instance = 0; - -void LocalFileSystem::initializeLocalFileSystem(const String& basePath) -{ - // FIXME: Should initialize the quota settings as well. - ASSERT(isMainThread()); - ASSERT(!s_instance); - if (s_instance) - return; - - OwnPtr<LocalFileSystem> localFileSystem = adoptPtr(new LocalFileSystem(basePath)); - s_instance = localFileSystem.leakPtr(); -} - -LocalFileSystem& LocalFileSystem::localFileSystem() -{ - // initializeLocalFileSystem must be called prior calling this. - ASSERT(s_instance); - return *s_instance; -} - -String LocalFileSystem::fileSystemBasePath() const -{ - return m_basePath; -} - -static void openFileSystem(ScriptExecutionContext*, const String& basePath, const String& identifier, AsyncFileSystem::Type type, bool create, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) -{ - AsyncFileSystem::openFileSystem(basePath, identifier, type, create, callbacks); -} - -void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool) -{ - // AsyncFileSystem::openFileSystem calls callbacks synchronously, so the method needs to be called asynchronously. - context->postTask(createCallbackTask(&openFileSystem, fileSystemBasePath(), context->securityOrigin()->databaseIdentifier(), type, false, callbacks)); -} - -void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, long long, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool) -{ - // AsyncFileSystem::openFileSystem calls callbacks synchronously, so the method needs to be called asynchronously. - context->postTask(createCallbackTask(&openFileSystem, fileSystemBasePath(), context->securityOrigin()->databaseIdentifier(), type, true, callbacks)); -} - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/LocalFileSystem.h b/Source/WebCore/fileapi/LocalFileSystem.h deleted file mode 100644 index 247bb2cdf..000000000 --- a/Source/WebCore/fileapi/LocalFileSystem.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef LocalFileSystem_h -#define LocalFileSystem_h - -#if ENABLE(FILE_SYSTEM) - -#include "AsyncFileSystem.h" -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class ErrorCallback; -class FileSystemCallback; -class ScriptExecutionContext; - -// Keeps per-process information and provides an entry point to open a file system. -class LocalFileSystem { - WTF_MAKE_NONCOPYABLE(LocalFileSystem); -public: - // Returns a per-process instance of LocalFileSystem. - // Note that LocalFileSystem::initializeLocalFileSystem must be called before - // calling this one. - static LocalFileSystem& localFileSystem(); - - // Does not create the root path for file system, just reads it if available. - void readFileSystem(ScriptExecutionContext*, AsyncFileSystem::Type, PassOwnPtr<AsyncFileSystemCallbacks>, bool synchronous = false); - - void requestFileSystem(ScriptExecutionContext*, AsyncFileSystem::Type, long long size, PassOwnPtr<AsyncFileSystemCallbacks>, bool synchronous = false); - -#if !PLATFORM(CHROMIUM) - // This call is not thread-safe; must be called before any worker threads are created. - void initializeLocalFileSystem(const String&); - - String fileSystemBasePath() const; -#endif - -private: - LocalFileSystem(const String& basePath) - : m_basePath(basePath) - { - } - - static LocalFileSystem* s_instance; - - // An inner class that enforces thread-safe string access. - class SystemBasePath { - public: - explicit SystemBasePath(const String& path) : m_value(path) { } - operator String() const - { - return m_value.isolatedCopy(); - } - private: - String m_value; - }; - - SystemBasePath m_basePath; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // LocalFileSystem_h diff --git a/Source/WebCore/fileapi/Metadata.h b/Source/WebCore/fileapi/Metadata.h deleted file mode 100644 index 7d1253a12..000000000 --- a/Source/WebCore/fileapi/Metadata.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef Metadata_h -#define Metadata_h - -#if ENABLE(FILE_SYSTEM) - -#include "FileMetadata.h" -#include <wtf/RefCounted.h> - -namespace WebCore { - -class Metadata : public RefCounted<Metadata> { -public: - static PassRefPtr<Metadata> create(const FileMetadata& platformMetadata) - { - return adoptRef(new Metadata(platformMetadata)); - } - - static PassRefPtr<Metadata> create(Metadata* metadata) - { - return adoptRef(new Metadata(metadata->m_platformMetadata)); - } - - // Needs to return epoch time in milliseconds for Date while FileMetadata's modificationTime is in seconds. - double modificationTime() const { return m_platformMetadata.modificationTime * 1000.0; } - unsigned long long size() const { return static_cast<unsigned long long>(m_platformMetadata.length); } - -private: - Metadata(const FileMetadata& platformMetadata) - : m_platformMetadata(platformMetadata) - { - } - - FileMetadata m_platformMetadata; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // Metadata_h diff --git a/Source/WebCore/fileapi/Metadata.idl b/Source/WebCore/fileapi/Metadata.idl deleted file mode 100644 index ceaf21b5a..000000000 --- a/Source/WebCore/fileapi/Metadata.idl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - JSNoStaticTables - ] Metadata { - readonly attribute Date modificationTime; - readonly attribute unsigned long long size; - }; -} diff --git a/Source/WebCore/fileapi/MetadataCallback.h b/Source/WebCore/fileapi/MetadataCallback.h deleted file mode 100644 index 725a0c18f..000000000 --- a/Source/WebCore/fileapi/MetadataCallback.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MetadataCallback_h -#define MetadataCallback_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/RefCounted.h> - -namespace WebCore { - -class Metadata; - -class MetadataCallback : public RefCounted<MetadataCallback> { -public: - virtual ~MetadataCallback() { } - virtual bool handleEvent(Metadata*) = 0; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // MetadataCallback_h diff --git a/Source/WebCore/fileapi/MetadataCallback.idl b/Source/WebCore/fileapi/MetadataCallback.idl deleted file mode 100644 index 44ca18054..000000000 --- a/Source/WebCore/fileapi/MetadataCallback.idl +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - Callback - ] MetadataCallback { - boolean handleEvent(in Metadata metadata); - }; -} diff --git a/Source/WebCore/fileapi/OperationNotAllowedException.cpp b/Source/WebCore/fileapi/OperationNotAllowedException.cpp index 2c9bc8e11..582176df7 100644 --- a/Source/WebCore/fileapi/OperationNotAllowedException.cpp +++ b/Source/WebCore/fileapi/OperationNotAllowedException.cpp @@ -34,17 +34,13 @@ namespace WebCore { -// FIXME: This should be an array of structs to pair the names and descriptions. -static const char* const exceptionNames[] = { - "NOT_ALLOWED_ERR" +static struct OperationNotAllowedExceptionNameDescription { + const char* const name; + const char* const description; +} operationNotAllowedExceptions[] = { + { "NOT_ALLOWED_ERR", "A read method was called while the object was in the LOADING state due to a previous read call." } }; -static const char* const exceptionDescriptions[] = { - "A read method was called while the object was in the LOADING state due to a previous read call." -}; - -COMPILE_ASSERT(WTF_ARRAY_LENGTH(exceptionNames) == WTF_ARRAY_LENGTH(exceptionDescriptions), OperationNotAllowedExceptionTablesMustMatch); - bool OperationNotAllowedException::initializeDescription(ExceptionCode ec, ExceptionCodeDescription* description) { if (ec < OperationNotAllowedExceptionOffset || ec > OperationNotAllowedExceptionMax) @@ -54,11 +50,11 @@ bool OperationNotAllowedException::initializeDescription(ExceptionCode ec, Excep description->code = ec - OperationNotAllowedExceptionOffset; description->type = OperationNotAllowedExceptionType; - size_t tableSize = WTF_ARRAY_LENGTH(exceptionNames); + size_t tableSize = WTF_ARRAY_LENGTH(operationNotAllowedExceptions); size_t tableIndex = ec - NOT_ALLOWED_ERR; - description->name = tableIndex < tableSize ? exceptionNames[tableIndex] : 0; - description->description = tableIndex < tableSize ? exceptionDescriptions[tableIndex] : 0; + description->name = tableIndex < tableSize ? operationNotAllowedExceptions[tableIndex].name : 0; + description->description = tableIndex < tableSize ? operationNotAllowedExceptions[tableIndex].description : 0; return true; } diff --git a/Source/WebCore/fileapi/OperationNotAllowedException.idl b/Source/WebCore/fileapi/OperationNotAllowedException.idl index d01a377f9..50040df60 100644 --- a/Source/WebCore/fileapi/OperationNotAllowedException.idl +++ b/Source/WebCore/fileapi/OperationNotAllowedException.idl @@ -29,8 +29,8 @@ */ module html { - interface [ - Conditional=BLOB|FILE_SYSTEM, + exception [ + Conditional=BLOB, DoNotCheckConstants, JSNoStaticTables ] OperationNotAllowedException { diff --git a/Source/WebCore/fileapi/SyncCallbackHelper.h b/Source/WebCore/fileapi/SyncCallbackHelper.h deleted file mode 100644 index 950adf470..000000000 --- a/Source/WebCore/fileapi/SyncCallbackHelper.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SyncCallbackHelper_h -#define SyncCallbackHelper_h - -#if ENABLE(FILE_SYSTEM) - -#include "DirectoryEntry.h" -#include "EntriesCallback.h" -#include "EntryArraySync.h" -#include "EntryCallback.h" -#include "ErrorCallback.h" -#include "FileEntry.h" -#include "FileError.h" -#include "FileException.h" -#include "FileSystemCallback.h" -#include "MetadataCallback.h" -#include "VoidCallback.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class AsyncFileSystem; -class DirectoryEntrySync; -class EntryArraySync; -class EntrySync; -class FileEntrySync; - -typedef int ExceptionCode; - -// A helper template for FileSystemSync implementation. -template <typename SuccessCallback, typename ObserverType, typename CallbackArg, typename ResultType> -class SyncCallbackHelper { - WTF_MAKE_NONCOPYABLE(SyncCallbackHelper); -public: - typedef SyncCallbackHelper<SuccessCallback, ObserverType, CallbackArg, ResultType> HelperType; - SyncCallbackHelper(ObserverType* observer = 0) - : m_observer(observer) - , m_successCallback(SuccessCallbackImpl::create(this)) - , m_errorCallback(ErrorCallbackImpl::create(this)) - , m_exceptionCode(0) - , m_completed(false) - { - } - - PassRefPtr<ResultType> getResult(ExceptionCode& ec) - { - if (m_observer) { - while (!m_completed) { - if (!m_observer->waitForOperationToComplete()) { - m_exceptionCode = FileException::ABORT_ERR; - break; - } - } - } - ec = m_exceptionCode; - return m_result.release(); - } - - PassRefPtr<SuccessCallback> successCallback() { return m_successCallback; } - PassRefPtr<ErrorCallback> errorCallback() { return m_errorCallback; } - -private: - class SuccessCallbackImpl : public SuccessCallback { - public: - static PassRefPtr<SuccessCallbackImpl> create(HelperType* helper) - { - return adoptRef(new SuccessCallbackImpl(helper)); - } - - virtual void handleEvent() - { - m_helper->setError(0); - } - - virtual bool handleEvent(CallbackArg* arg) - { - m_helper->setResult(ResultType::create(arg)); - return true; - } - - private: - SuccessCallbackImpl(HelperType* helper) - : m_helper(helper) - { - } - HelperType* m_helper; - }; - - class ErrorCallbackImpl : public ErrorCallback { - public: - static PassRefPtr<ErrorCallbackImpl> create(HelperType* helper) - { - return adoptRef(new ErrorCallbackImpl(helper)); - } - - virtual bool handleEvent(FileError* error) - { - ASSERT(error); - m_helper->setError(error->code()); - return true; - } - - private: - ErrorCallbackImpl(HelperType* helper) - : m_helper(helper) - { - } - HelperType* m_helper; - }; - - friend class SuccessCallbackImpl; - friend class ErrorCallbackImpl; - - void setError(int code) - { - m_exceptionCode = FileException::ErrorCodeToExceptionCode(code); - m_completed = true; - } - - void setResult(PassRefPtr<ResultType> result) - { - m_result = result; - m_completed = true; - } - - ObserverType* m_observer; - RefPtr<SuccessCallbackImpl> m_successCallback; - RefPtr<ErrorCallbackImpl> m_errorCallback; - RefPtr<ResultType> m_result; - ExceptionCode m_exceptionCode; - bool m_completed; -}; - -struct EmptyType : public RefCounted<EmptyType> { - static PassRefPtr<EmptyType> create(EmptyType*) - { - return 0; - } -}; - -struct EmptyObserverType { - bool waitForOperationToComplete() - { - return false; - } -}; - -typedef SyncCallbackHelper<EntryCallback, AsyncFileSystem, Entry, EntrySync> EntrySyncCallbackHelper; -typedef SyncCallbackHelper<EntriesCallback, AsyncFileSystem, EntryArray, EntryArraySync> EntriesSyncCallbackHelper; -typedef SyncCallbackHelper<MetadataCallback, AsyncFileSystem, Metadata, Metadata> MetadataSyncCallbackHelper; -typedef SyncCallbackHelper<VoidCallback, AsyncFileSystem, EmptyType, EmptyType> VoidSyncCallbackHelper; -typedef SyncCallbackHelper<FileSystemCallback, EmptyObserverType, DOMFileSystem, DOMFileSystemSync> FileSystemSyncCallbackHelper; - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) - -#endif // SyncCallbackHelper_h diff --git a/Source/WebCore/fileapi/WebKitBlobBuilder.idl b/Source/WebCore/fileapi/WebKitBlobBuilder.idl index 5209ff8d4..e0c7c5c92 100644 --- a/Source/WebCore/fileapi/WebKitBlobBuilder.idl +++ b/Source/WebCore/fileapi/WebKitBlobBuilder.idl @@ -30,6 +30,7 @@ module html { interface [ + Conditional=LEGACY_WEBKIT_BLOB_BUILDER, Constructor, JSGenerateToNativeObject, JSNoStaticTables diff --git a/Source/WebCore/fileapi/WebKitFlags.h b/Source/WebCore/fileapi/WebKitFlags.h deleted file mode 100644 index a75b47230..000000000 --- a/Source/WebCore/fileapi/WebKitFlags.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebKitFlags_h -#define WebKitFlags_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class WebKitFlags : public RefCounted<WebKitFlags> { -public: - static PassRefPtr<WebKitFlags> create(bool create = false, bool exclusive = false) - { - return adoptRef(new WebKitFlags(create, exclusive)); - } - - bool isCreate() const { return m_create; } - void setCreate(bool create) { m_create = create; } - bool isExclusive() const { return m_exclusive; } - void setExclusive(bool exclusive) { m_exclusive = exclusive; } - -private: - WebKitFlags(bool create, bool exclusive) - : m_create(create) - , m_exclusive(exclusive) - { - } - bool m_create; - bool m_exclusive; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // WebKitFlags_h diff --git a/Source/WebCore/fileapi/WorkerContextFileSystem.cpp b/Source/WebCore/fileapi/WorkerContextFileSystem.cpp deleted file mode 100644 index 9651ef427..000000000 --- a/Source/WebCore/fileapi/WorkerContextFileSystem.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "config.h" -#include "WorkerContextFileSystem.h" - -#if ENABLE(FILE_SYSTEM) - -#include "AsyncFileSystem.h" -#include "DOMFileSystem.h" -#include "DOMFileSystemBase.h" -#include "DOMFileSystemSync.h" -#include "DirectoryEntrySync.h" -#include "ErrorCallback.h" -#include "FileEntrySync.h" -#include "FileError.h" -#include "FileException.h" -#include "FileSystemCallback.h" -#include "FileSystemCallbacks.h" -#include "LocalFileSystem.h" -#include "SecurityOrigin.h" -#include "SyncCallbackHelper.h" -#include "WorkerContext.h" - -namespace WebCore { - -void WorkerContextFileSystem::webkitRequestFileSystem(WorkerContext* worker, int type, long long size, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - ScriptExecutionContext* secureContext = worker->scriptExecutionContext(); - if (!AsyncFileSystem::isAvailable() || !secureContext->securityOrigin()->canAccessFileSystem()) { - DOMFileSystem::scheduleCallback(worker, errorCallback, FileError::create(FileError::SECURITY_ERR)); - return; - } - - AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type); - if (!AsyncFileSystem::isValidType(fileSystemType)) { - DOMFileSystem::scheduleCallback(worker, errorCallback, FileError::create(FileError::INVALID_MODIFICATION_ERR)); - return; - } - - LocalFileSystem::localFileSystem().requestFileSystem(worker, fileSystemType, size, FileSystemCallbacks::create(successCallback, errorCallback, worker), false); -} - -PassRefPtr<DOMFileSystemSync> WorkerContextFileSystem::webkitRequestFileSystemSync(WorkerContext* worker, int type, long long size, ExceptionCode& ec) -{ - ec = 0; - ScriptExecutionContext* secureContext = worker->scriptExecutionContext(); - if (!AsyncFileSystem::isAvailable() || !secureContext->securityOrigin()->canAccessFileSystem()) { - ec = FileException::SECURITY_ERR; - return 0; - } - - AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type); - if (!AsyncFileSystem::isValidType(fileSystemType)) { - ec = FileException::INVALID_MODIFICATION_ERR; - return 0; - } - - FileSystemSyncCallbackHelper helper; - LocalFileSystem::localFileSystem().requestFileSystem(worker, fileSystemType, size, FileSystemCallbacks::create(helper.successCallback(), helper.errorCallback(), worker), true); - return helper.getResult(ec); -} - -void WorkerContextFileSystem::webkitResolveLocalFileSystemURL(WorkerContext* worker, const String& url, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) -{ - KURL completedURL = worker->completeURL(url); - ScriptExecutionContext* secureContext = worker->scriptExecutionContext(); - if (!AsyncFileSystem::isAvailable() || !secureContext->securityOrigin()->canAccessFileSystem() || !secureContext->securityOrigin()->canRequest(completedURL)) { - DOMFileSystem::scheduleCallback(worker, errorCallback, FileError::create(FileError::SECURITY_ERR)); - return; - } - - AsyncFileSystem::Type type; - String filePath; - if (!completedURL.isValid() || !AsyncFileSystem::crackFileSystemURL(completedURL, type, filePath)) { - DOMFileSystem::scheduleCallback(worker, errorCallback, FileError::create(FileError::ENCODING_ERR)); - return; - } - - LocalFileSystem::localFileSystem().readFileSystem(worker, type, ResolveURICallbacks::create(successCallback, errorCallback, worker, filePath)); -} - -PassRefPtr<EntrySync> WorkerContextFileSystem::webkitResolveLocalFileSystemSyncURL(WorkerContext* worker, const String& url, ExceptionCode& ec) -{ - ec = 0; - KURL completedURL = worker->completeURL(url); - ScriptExecutionContext* secureContext = worker->scriptExecutionContext(); - if (!AsyncFileSystem::isAvailable() || !secureContext->securityOrigin()->canAccessFileSystem() || !secureContext->securityOrigin()->canRequest(completedURL)) { - ec = FileException::SECURITY_ERR; - return 0; - } - - AsyncFileSystem::Type type; - String filePath; - if (!completedURL.isValid() || !AsyncFileSystem::crackFileSystemURL(completedURL, type, filePath)) { - ec = FileException::ENCODING_ERR; - return 0; - } - - FileSystemSyncCallbackHelper readFileSystemHelper; - LocalFileSystem::localFileSystem().readFileSystem(worker, type, FileSystemCallbacks::create(readFileSystemHelper.successCallback(), readFileSystemHelper.errorCallback(), worker), true); - RefPtr<DOMFileSystemSync> fileSystem = readFileSystemHelper.getResult(ec); - if (!fileSystem) - return 0; - - RefPtr<EntrySync> entry = fileSystem->root()->getDirectory(filePath, 0, ec); - if (ec == FileException::TYPE_MISMATCH_ERR) - return fileSystem->root()->getFile(filePath, 0, ec); - - return entry.release(); -} - -COMPILE_ASSERT(static_cast<int>(WorkerContextFileSystem::TEMPORARY) == static_cast<int>(AsyncFileSystem::Temporary), enum_mismatch); -COMPILE_ASSERT(static_cast<int>(WorkerContextFileSystem::PERSISTENT) == static_cast<int>(AsyncFileSystem::Persistent), enum_mismatch); - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/WorkerContextFileSystem.h b/Source/WebCore/fileapi/WorkerContextFileSystem.h deleted file mode 100644 index c500f5e2e..000000000 --- a/Source/WebCore/fileapi/WorkerContextFileSystem.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef WorkerContextFileSystem_h -#define WorkerContextFileSystem_h - -#if ENABLE(FILE_SYSTEM) - -#include "DOMFileSystemSync.h" -#include <wtf/PassRefPtr.h> - -namespace WebCore { - -class EntryCallback; -class EntrySync; -class ErrorCallback; -class FileSystemCallback; -class WorkerContext; - -class WorkerContextFileSystem { -public: - enum FileSystemType { - TEMPORARY, - PERSISTENT, - }; - - static void webkitRequestFileSystem(WorkerContext*, int type, long long size, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback>); - static PassRefPtr<DOMFileSystemSync> webkitRequestFileSystemSync(WorkerContext*, int type, long long size, ExceptionCode&); - static void webkitResolveLocalFileSystemURL(WorkerContext*, const String& url, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback>); - static PassRefPtr<EntrySync> webkitResolveLocalFileSystemSyncURL(WorkerContext*, const String& url, ExceptionCode&); - -private: - WorkerContextFileSystem(); - ~WorkerContextFileSystem(); -}; - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) - -#endif // WorkerContextFileSystem_h diff --git a/Source/WebCore/fileapi/WorkerContextFileSystem.idl b/Source/WebCore/fileapi/WorkerContextFileSystem.idl deleted file mode 100644 index cb9c32849..000000000 --- a/Source/WebCore/fileapi/WorkerContextFileSystem.idl +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -module threads { - - interface [ - Conditional=FILE_SYSTEM, - Supplemental=WorkerContext - ] WorkerContextFileSystem { - const unsigned short TEMPORARY = 0; - const unsigned short PERSISTENT = 1; - - [V8EnabledAtRuntime=FileSystem] void webkitRequestFileSystem(in unsigned short type, in long long size, in [Callback, Optional] FileSystemCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); - [V8EnabledAtRuntime=FileSystem] DOMFileSystemSync webkitRequestFileSystemSync(in unsigned short type, in long long size) raises (FileException); - [V8EnabledAtRuntime=FileSystem] void webkitResolveLocalFileSystemURL(in DOMString url, in [Callback, Optional] EntryCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); - [V8EnabledAtRuntime=FileSystem] EntrySync webkitResolveLocalFileSystemSyncURL(in DOMString url) raises (FileException); - - attribute [V8EnabledAtRuntime=FileSystem] FileErrorConstructor FileError; - attribute [V8EnabledAtRuntime=FileSystem] FileExceptionConstructor FileException; - }; - -} |
