[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

kinuko at chromium.org kinuko at chromium.org
Wed Dec 22 12:23:52 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit fe83c32791287a1f8ddd0ed5fd97313dd1c81985
Author: kinuko at chromium.org <kinuko at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 20 23:49:01 2010 +0000

    2010-08-20  Kinuko Yasuda  <kinuko at chromium.org>
    
            Reviewed by Darin Fisher.
    
            Add Callback implementation for FileSystem API
            https://bugs.webkit.org/show_bug.cgi?id=44349
    
            No new tests; tests will be added later.
    
            * CMakeLists.txt:
            * GNUmakefile.am:
            * WebCore.gypi:
            * WebCore.pro:
            * WebCore.vcproj/WebCore.vcproj:
            * WebCore.xcodeproj/project.pbxproj:
            * storage/FileSystemCallbacks.cpp: Added.
            * storage/FileSystemCallbacks.h: Added.
    
            * storage/EntryCallback.h: Nits fix
            * storage/FileSystemCallback.h: Nits fix
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65763 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index 3fe6c2c..c447803 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -1460,6 +1460,7 @@ SET(WebCore_SOURCES
     storage/Entry.cpp
     storage/EntryArray.cpp
     storage/FileEntry.cpp
+    storage/FileSystemCallbacks.cpp
     storage/IDBAny.cpp
     storage/IDBDatabase.cpp
     storage/IDBDatabaseBackendImpl.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3c36554..6f2d5d4 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2010-08-20  Kinuko Yasuda  <kinuko at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Add Callback implementation for FileSystem API
+        https://bugs.webkit.org/show_bug.cgi?id=44349
+
+        No new tests; tests will be added later.
+
+        * CMakeLists.txt:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * storage/FileSystemCallbacks.cpp: Added.
+        * storage/FileSystemCallbacks.h: Added.
+
+        * storage/EntryCallback.h: Nits fix
+        * storage/FileSystemCallback.h: Nits fix
+
 2010-08-20  Andreas Kling  <andreas.kling at nokia.com>
 
         Reviewed by Ariya Hidayat.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 5acefc1..fd50f19 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -3049,6 +3049,8 @@ webcore_sources += \
        WebCore/storage/FileEntry.cpp \
        WebCore/storage/FileEntry.h \
        WebCore/storage/FileSystemCallback.h \
+       WebCore/storage/FileSystemCallbacks.cpp \
+       WebCore/storage/FileSystemCallbacks.h \
        WebCore/storage/Flags.h \
        WebCore/storage/Metadata.h \
        WebCore/storage/MetadataCallback.h
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 4f01877..e7304e3 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3567,6 +3567,8 @@
             'storage/FileEntry.cpp',
             'storage/FileEntry.h',
             'storage/FileSystemCallback.h',
+            'storage/FileSystemCallbacks.cpp',
+            'storage/FileSystemCallbacks.h',
             'storage/Flags.h',
             'storage/IDBAbortEvent.cpp',
             'storage/IDBAbortEvent.h',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index e8cbe3a..f5b9c43 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -2587,6 +2587,7 @@ contains(DEFINES, ENABLE_FILE_SYSTEM=1) {
         storage/ErrorCallback.h \
         storage/FileEntry.h \
         storage/FileSystemCallback.h \
+        storage/FileSystemCallbacks.h \
         storage/Flags.h \
         storage/Metadata.h \
         storage/MetadataCallback.h
@@ -2597,7 +2598,8 @@ contains(DEFINES, ENABLE_FILE_SYSTEM=1) {
         storage/DOMFileSystem.cpp \
         storage/Entry.cpp \
         storage/EntryArray.cpp \
-        storage/FileEntry.cpp
+        storage/FileEntry.cpp \
+        storage/FileSystemCallbacks.cpp
 }
 
 contains(DEFINES, ENABLE_ICONDATABASE=1) {
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 719793e..7d175c3 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -51197,6 +51197,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\storage\FileSystemCallbacks.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\storage\FileSystemCallbacks.h"
+				>
+			</File>
+			<File
 				RelativePath="..\storage\Flags.h"
 				>
 			</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 2247f13..aac9238 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -2430,6 +2430,12 @@
 		89B5EAA211E8003D00F2367E /* LineEnding.h in Headers */ = {isa = PBXBuildFile; fileRef = 89B5EAA011E8003D00F2367E /* LineEnding.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		89BED5EB11BE11CE00448492 /* BlobBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89BED5E911BE11CE00448492 /* BlobBuilder.cpp */; };
 		89BED5EC11BE11CE00448492 /* BlobBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 89BED5EA11BE11CE00448492 /* BlobBuilder.h */; };
+		89C0DD7A121F0C69009E17CA /* FileSystemCallbacks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89C0DD78121F0C69009E17CA /* FileSystemCallbacks.cpp */; };
+		89C0DD7B121F0C69009E17CA /* FileSystemCallbacks.h in Headers */ = {isa = PBXBuildFile; fileRef = 89C0DD79121F0C69009E17CA /* FileSystemCallbacks.h */; };
+		89C0E071121F4666009E17CA /* JSMetadata.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89C0E06D121F4666009E17CA /* JSMetadata.cpp */; };
+		89C0E072121F4666009E17CA /* JSMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 89C0E06E121F4666009E17CA /* JSMetadata.h */; };
+		89C0E073121F4666009E17CA /* JSMetadataCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89C0E06F121F4666009E17CA /* JSMetadataCallback.cpp */; };
+		89C0E074121F4666009E17CA /* JSMetadataCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 89C0E070121F4666009E17CA /* JSMetadataCallback.h */; };
 		89CD029311C85B870070B791 /* JSBlobBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89CD029111C85B870070B791 /* JSBlobBuilder.cpp */; };
 		89CD029411C85B870070B791 /* JSBlobBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 89CD029211C85B870070B791 /* JSBlobBuilder.h */; };
 		8A12E35D11FA33280025836A /* DocumentLoadTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A12E35C11FA33280025836A /* DocumentLoadTiming.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8297,6 +8303,12 @@
 		89B5EAA011E8003D00F2367E /* LineEnding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineEnding.h; sourceTree = "<group>"; };
 		89BED5E911BE11CE00448492 /* BlobBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobBuilder.cpp; sourceTree = "<group>"; };
 		89BED5EA11BE11CE00448492 /* BlobBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobBuilder.h; sourceTree = "<group>"; };
+		89C0DD78121F0C69009E17CA /* FileSystemCallbacks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemCallbacks.cpp; sourceTree = "<group>"; };
+		89C0DD79121F0C69009E17CA /* FileSystemCallbacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystemCallbacks.h; sourceTree = "<group>"; };
+		89C0E06D121F4666009E17CA /* JSMetadata.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSMetadata.cpp; path = ../WebKitBuild/Debug/DerivedSources/WebCore/JSMetadata.cpp; sourceTree = SOURCE_ROOT; };
+		89C0E06E121F4666009E17CA /* JSMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSMetadata.h; path = ../WebKitBuild/Debug/DerivedSources/WebCore/JSMetadata.h; sourceTree = SOURCE_ROOT; };
+		89C0E06F121F4666009E17CA /* JSMetadataCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSMetadataCallback.cpp; path = ../WebKitBuild/Debug/DerivedSources/WebCore/JSMetadataCallback.cpp; sourceTree = SOURCE_ROOT; };
+		89C0E070121F4666009E17CA /* JSMetadataCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSMetadataCallback.h; path = ../WebKitBuild/Debug/DerivedSources/WebCore/JSMetadataCallback.h; sourceTree = SOURCE_ROOT; };
 		89CD027911C859A80070B791 /* BlobBuilder.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BlobBuilder.idl; sourceTree = "<group>"; };
 		89CD029111C85B870070B791 /* JSBlobBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBlobBuilder.cpp; sourceTree = "<group>"; };
 		89CD029211C85B870070B791 /* JSBlobBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBlobBuilder.h; sourceTree = "<group>"; };
@@ -11596,6 +11608,8 @@
 				899ABC331215E4BE00F9F219 /* FileEntry.idl */,
 				897A2D2111FF58A50082740C /* FileSystemCallback.h */,
 				897A2D5F120001220082740C /* FileSystemCallback.idl */,
+				89C0DD78121F0C69009E17CA /* FileSystemCallbacks.cpp */,
+				89C0DD79121F0C69009E17CA /* FileSystemCallbacks.h */,
 				897A2D60120001220082740C /* Flags.h */,
 				897A2D61120001220082740C /* Flags.idl */,
 				C585A69811D4FB3D004C3E4B /* IDBAny.cpp */,
@@ -15130,6 +15144,10 @@
 				C585A67B11D4FB07004C3E4B /* JSIDBSuccessEvent.h */,
 				B656626F120B1227006EA85C /* JSIDBTransaction.cpp */,
 				B656626E120B1227006EA85C /* JSIDBTransaction.h */,
+				89C0E06D121F4666009E17CA /* JSMetadata.cpp */,
+				89C0E06E121F4666009E17CA /* JSMetadata.h */,
+				89C0E06F121F4666009E17CA /* JSMetadataCallback.cpp */,
+				89C0E070121F4666009E17CA /* JSMetadataCallback.h */,
 				514C76350CE9225E007EF3CD /* JSSQLError.cpp */,
 				BC8243250D0CE8A200460C8F /* JSSQLError.h */,
 				B525A96411CA2340003A23A8 /* JSSQLException.cpp */,
@@ -20333,6 +20351,9 @@
 				46A26906121B6B4300C41F3A /* FileWriter.h in Headers */,
 				2EF1BFF7121CB0BD00C27627 /* AsyncFileStream.h in Headers */,
 				2EF1BFF9121CB0CE00C27627 /* FileStreamClient.h in Headers */,
+				89C0DD7B121F0C69009E17CA /* FileSystemCallbacks.h in Headers */,
+				89C0E072121F4666009E17CA /* JSMetadata.h in Headers */,
+				89C0E074121F4666009E17CA /* JSMetadataCallback.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -22784,6 +22805,9 @@
 				2EDEF1F6121B0EFC00726DB2 /* BlobRegistryImpl.cpp in Sources */,
 				2EF1BFEA121C9F4200C27627 /* FileStream.cpp in Sources */,
 				46A26905121B6B4300C41F3A /* FileWriter.cpp in Sources */,
+				89C0DD7A121F0C69009E17CA /* FileSystemCallbacks.cpp in Sources */,
+				89C0E071121F4666009E17CA /* JSMetadata.cpp in Sources */,
+				89C0E073121F4666009E17CA /* JSMetadataCallback.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebCore/storage/EntryCallback.h b/WebCore/storage/EntryCallback.h
index 121bf07..9580eda 100644
--- a/WebCore/storage/EntryCallback.h
+++ b/WebCore/storage/EntryCallback.h
@@ -38,7 +38,6 @@
 namespace WebCore {
 
 class Entry;
-class ScriptExecutionContext;
 
 class EntryCallback : public RefCounted<EntryCallback> {
 public:
diff --git a/WebCore/storage/FileSystemCallback.h b/WebCore/storage/FileSystemCallback.h
index 19f44df..63f8416 100644
--- a/WebCore/storage/FileSystemCallback.h
+++ b/WebCore/storage/FileSystemCallback.h
@@ -38,7 +38,6 @@
 namespace WebCore {
 
 class DOMFileSystem;
-class ScriptExecutionContext;
 
 class FileSystemCallback : public RefCounted<FileSystemCallback> {
 public:
diff --git a/WebCore/storage/FileSystemCallbacks.cpp b/WebCore/storage/FileSystemCallbacks.cpp
new file mode 100644
index 0000000..ec352dd
--- /dev/null
+++ b/WebCore/storage/FileSystemCallbacks.cpp
@@ -0,0 +1,200 @@
+/*
+ * 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 "DOMFileSystem.h"
+#include "DirectoryEntry.h"
+#include "EntriesCallback.h"
+#include "EntryArray.h"
+#include "EntryCallback.h"
+#include "ErrorCallback.h"
+#include "ExceptionCode.h"
+#include "FileEntry.h"
+#include "FileError.h"
+#include "FileSystemCallback.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::didSucceed()
+{
+    // Each subclass must implement an appropriate one.
+    ASSERT_NOT_REACHED();
+}
+
+void FileSystemCallbacksBase::didOpenFileSystem(const String&, const String&)
+{
+    // Each subclass must implement an appropriate one.
+    ASSERT_NOT_REACHED();
+}
+
+void FileSystemCallbacksBase::didReadMetadata(double)
+{
+    // Each subclass must implement an appropriate one.
+    ASSERT_NOT_REACHED();
+}
+
+void FileSystemCallbacksBase::didReadDirectoryChunkDone(bool)
+{
+    // Each subclass must implement an appropriate one.
+    ASSERT_NOT_REACHED();
+}
+
+void FileSystemCallbacksBase::didReadDirectoryEntry(const String&, bool)
+{
+    // Each subclass must implement an appropriate one.
+    ASSERT_NOT_REACHED();
+}
+
+void FileSystemCallbacksBase::didFail(ExceptionCode code)
+{
+    if (m_errorCallback) {
+        m_errorCallback->handleEvent(FileError::create(code).get());
+        m_errorCallback.clear();
+    }
+}
+
+// EntryCallbacks -------------------------------------------------------------
+
+EntryCallbacks::EntryCallbacks(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DOMFileSystem* 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 -----------------------------------------------------------
+
+EntriesCallbacks::EntriesCallbacks(PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DOMFileSystem* fileSystem, const String& basePath)
+    : FileSystemCallbacksBase(errorCallback)
+    , m_successCallback(successCallback)
+    , m_fileSystem(fileSystem)
+    , m_basePath(basePath)
+{
+}
+
+void EntriesCallbacks::didReadDirectoryEntry(const String& name, bool isDirectory)
+{
+    if (isDirectory)
+        m_entries->append(DirectoryEntry::create(m_fileSystem, m_basePath + "/" + name));
+    else
+        m_entries->append(FileEntry::create(m_fileSystem, m_basePath + "/" + name));
+}
+
+void EntriesCallbacks::didReadDirectoryChunkDone(bool hasMore)
+{
+    if (m_successCallback) {
+        m_successCallback->handleEvent(m_entries.get());
+        m_entries->clear();
+        if (!hasMore) {
+            // If there're no more entries, call back once more with an empty array.
+            m_successCallback->handleEvent(m_entries.get());
+            m_successCallback.clear();
+        }
+    }
+}
+
+// FileSystemCallbacks --------------------------------------------------------
+
+FileSystemCallbacks::FileSystemCallbacks(PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+    : FileSystemCallbacksBase(errorCallback)
+    , m_successCallback(successCallback)
+{
+}
+
+void FileSystemCallbacks::didOpenFileSystem(const String& name, const String& rootPath)
+{
+    if (m_successCallback)
+        m_successCallback->handleEvent(DOMFileSystem::create(name, rootPath).get());
+    m_successCallback.clear();
+}
+
+// MetadataCallbacks ----------------------------------------------------------
+
+MetadataCallbacks::MetadataCallbacks(PassRefPtr<MetadataCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+    : FileSystemCallbacksBase(errorCallback)
+    , m_successCallback(successCallback)
+{
+}
+
+void MetadataCallbacks::didReadMetadata(double modificationTime)
+{
+    if (m_successCallback)
+        m_successCallback->handleEvent(Metadata::create(modificationTime).get());
+    m_successCallback.clear();
+}
+
+// VoidCallbacks --------------------------------------------------------------
+
+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/WebCore/storage/FileSystemCallbacks.h b/WebCore/storage/FileSystemCallbacks.h
new file mode 100644
index 0000000..e0e78d3
--- /dev/null
+++ b/WebCore/storage/FileSystemCallbacks.h
@@ -0,0 +1,138 @@
+/*
+ * 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 "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class DOMFileSystem;
+class ErrorCallback;
+class EntriesCallback;
+class EntryArray;
+class EntryCallback;
+class FileSystemCallback;
+class MetadataCallback;
+class ScriptExecutionContext;
+class VoidCallback;
+
+typedef int ExceptionCode;
+
+// A base class for FileSystem callbacks that bundles successCallback, errorCallback and some closure data for the callbacks.
+class FileSystemCallbacksBase : public Noncopyable {
+public:
+    virtual ~FileSystemCallbacksBase();
+
+    // For EntryCallbacks and VoidCallbacks.
+    virtual void didSucceed();
+
+    // For FileSystemCallbacks.
+    virtual void didOpenFileSystem(const String& name, const String& rootPath);
+
+    // For MetadataCallbacks.
+    virtual void didReadMetadata(double modificationTime);
+
+    // For EntriesCallbacks. didReadDirectoryEntry is called each time the API reads an entry, and didReadDirectoryDone is called when a chunk of entries have been read (i.e. good time to call back to the application).  If hasMore is true there can be more chunks.
+    virtual void didReadDirectoryEntry(const String& name, bool isDirectory);
+    virtual void didReadDirectoryChunkDone(bool hasMore);
+
+    // For ErrorCallback.
+    virtual void didFail(ExceptionCode code);
+
+protected:
+    FileSystemCallbacksBase(PassRefPtr<ErrorCallback> errorCallback);
+    RefPtr<ErrorCallback> m_errorCallback;
+};
+
+// Subclasses ----------------------------------------------------------------
+
+class EntryCallbacks : public FileSystemCallbacksBase {
+public:
+    EntryCallbacks(PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, DOMFileSystem*, const String& expectedPath, bool isDirectory);
+    virtual void didSucceed();
+
+private:
+    RefPtr<EntryCallback> m_successCallback;
+    DOMFileSystem* m_fileSystem;
+    String m_expectedPath;
+    bool m_isDirectory;
+};
+
+class EntriesCallbacks : public FileSystemCallbacksBase {
+public:
+    EntriesCallbacks(PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>, DOMFileSystem*, const String& basePath);
+    virtual void didReadDirectoryEntry(const String& name, bool isDirectory);
+    virtual void didReadDirectoryChunkDone(bool hasMore);
+
+private:
+    RefPtr<EntriesCallback> m_successCallback;
+    DOMFileSystem* m_fileSystem;
+    String m_basePath;
+    RefPtr<EntryArray> m_entries;
+};
+
+class FileSystemCallbacks : public FileSystemCallbacksBase {
+public:
+    FileSystemCallbacks(PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback>);
+    virtual void didOpenFileSystem(const String& name, const String& rootPath);
+
+private:
+    RefPtr<FileSystemCallback> m_successCallback;
+};
+
+class MetadataCallbacks : public FileSystemCallbacksBase {
+public:
+    MetadataCallbacks(PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>);
+    virtual void didReadMetadata(double modificationTime);
+
+private:
+    RefPtr<MetadataCallback> m_successCallback;
+};
+
+class VoidCallbacks : public FileSystemCallbacksBase {
+public:
+    VoidCallbacks(PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>);
+    virtual void didSucceed();
+
+private:
+    RefPtr<VoidCallback> m_successCallback;
+};
+
+} // namespace
+
+#endif // ENABLE(FILE_SYSTEM)
+
+#endif // FileSystemCallbacks_h

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list