summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/fileapi/DOMFileSystem.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-25 19:08:45 +0100
committerSteve Block <steveblock@google.com>2011-06-08 13:51:31 +0100
commit2bde8e466a4451c7319e3a072d118917957d6554 (patch)
tree28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/WebCore/fileapi/DOMFileSystem.cpp
parent6939c99b71d9372d14a0c74a772108052e8c48c8 (diff)
downloadexternal_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/WebCore/fileapi/DOMFileSystem.cpp')
-rw-r--r--Source/WebCore/fileapi/DOMFileSystem.cpp41
1 files changed, 38 insertions, 3 deletions
diff --git a/Source/WebCore/fileapi/DOMFileSystem.cpp b/Source/WebCore/fileapi/DOMFileSystem.cpp
index c1710cd..01d56d5 100644
--- a/Source/WebCore/fileapi/DOMFileSystem.cpp
+++ b/Source/WebCore/fileapi/DOMFileSystem.cpp
@@ -39,6 +39,7 @@
#include "ErrorCallback.h"
#include "File.h"
#include "FileEntry.h"
+#include "FileMetadata.h"
#include "FileSystemCallbacks.h"
#include "FileWriter.h"
#include "FileWriterBaseCallback.h"
@@ -111,12 +112,46 @@ void DOMFileSystem::createWriter(const FileEntry* fileEntry, PassRefPtr<FileWrit
m_asyncFileSystem->createWriter(fileWriter.get(), platformPath, callbacks.release());
}
-void DOMFileSystem::createFile(const FileEntry* fileEntry, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback>)
+namespace {
+
+class GetPathCallback : public FileSystemCallbacksBase {
+public:
+ static PassOwnPtr<GetPathCallback> create(PassRefPtr<DOMFileSystem> filesystem, const String& path, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+ {
+ return adoptPtr(new GetPathCallback(filesystem, path, successCallback, errorCallback));
+ }
+
+ virtual void didReadMetadata(const FileMetadata& metadata)
+ {
+ if (!metadata.platformPath.isEmpty())
+ m_path = metadata.platformPath;
+
+ m_filesystem->scheduleCallback(m_successCallback.release(), File::create(m_path));
+ }
+
+private:
+ GetPathCallback(PassRefPtr<DOMFileSystem> filesystem, const String& path, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+ : FileSystemCallbacksBase(errorCallback)
+ , m_filesystem(filesystem)
+ , m_path(path)
+ , m_successCallback(successCallback)
+ {
+ }
+
+ RefPtr<DOMFileSystem> m_filesystem;
+ String m_path;
+ RefPtr<FileCallback> m_successCallback;
+};
+
+} // namespace
+
+void DOMFileSystem::createFile(const FileEntry* fileEntry, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
{
String platformPath = m_asyncFileSystem->virtualToPlatformPath(fileEntry->fullPath());
- scheduleCallback(successCallback, File::create(platformPath));
+
+ m_asyncFileSystem->readMetadata(platformPath, GetPathCallback::create(this, platformPath, successCallback, errorCallback));
}
-} // namespace
+} // namespace WebCore
#endif // ENABLE(FILE_SYSTEM)