Modified: trunk/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.cpp (148274 => 148275)
--- trunk/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.cpp 2013-04-12 13:10:28 UTC (rev 148274)
+++ trunk/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.cpp 2013-04-12 13:22:16 UTC (rev 148275)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ * Copyright (C) 2012, 2013 Research In Motion Limited. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -22,154 +22,130 @@
#include "AsyncFileSystemBlackBerry.h"
#include "AsyncFileSystemCallbacks.h"
+#include "AsyncFileWriterBlackBerry.h"
+#include "AsyncFileWriterClient.h"
+#include "DOMFileSystemBase.h"
#include "ExceptionCode.h"
+#include "KURL.h"
#include "NotImplemented.h"
+#include "PlatformAsyncFileSystemCallbacks.h"
+#include "ScriptExecutionContext.h"
+#include "SecurityOrigin.h"
#include <wtf/UnusedParam.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
namespace WebCore {
bool AsyncFileSystem::isAvailable()
{
- notImplemented();
- return false;
+ return true;
}
+// We don't use this one!
PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create()
{
- return adoptPtr(new AsyncFileSystemBlackBerry());
+ ASSERT_NOT_REACHED();
+ return PassOwnPtr<AsyncFileSystem>();
}
+// We don't use this one!
void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
UNUSED_PARAM(basePath);
UNUSED_PARAM(storageIdentifier);
UNUSED_PARAM(callbacks);
+ ASSERT_NOT_REACHED();
+}
- notImplemented();
- callbacks->didFail(NOT_SUPPORTED_ERR);
+void AsyncFileSystemBlackBerry::openFileSystem(const KURL& rootURL, const String& basePath, const String& storageIdentifier, FileSystemType type, long long size, bool create, int playerId, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
+{
+ BlackBerry::Platform::WebFileSystem::openFileSystem(BlackBerry::Platform::webKitThreadMessageClient(), basePath, storageIdentifier, static_cast<BlackBerry::Platform::WebFileSystem::Type>(type), size, create, new PlatformAsyncFileSystemCallbacks(callbacks, rootURL), playerId);
}
void AsyncFileSystem::deleteFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- UNUSED_PARAM(basePath);
- UNUSED_PARAM(storageIdentifier);
- UNUSED_PARAM(type);
-
- notImplemented();
- callbacks->didFail(NOT_SUPPORTED_ERR);
+ BlackBerry::Platform::WebFileSystem::deleteFileSystem(BlackBerry::Platform::webKitThreadMessageClient(), basePath, storageIdentifier, static_cast<BlackBerry::Platform::WebFileSystem::Type>(type), new PlatformAsyncFileSystemCallbacks(callbacks));
}
-AsyncFileSystemBlackBerry::AsyncFileSystemBlackBerry()
+AsyncFileSystemBlackBerry::AsyncFileSystemBlackBerry(PassOwnPtr<BlackBerry::Platform::WebFileSystem> platformFileSystem)
+ : AsyncFileSystem() // FIXME: type ???
+ , m_platformFileSystem(platformFileSystem)
{
- notImplemented();
}
AsyncFileSystemBlackBerry::~AsyncFileSystemBlackBerry()
{
- notImplemented();
}
void AsyncFileSystemBlackBerry::move(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- UNUSED_PARAM(sourcePath);
- UNUSED_PARAM(destinationPath);
- UNUSED_PARAM(callbacks);
-
- notImplemented();
+ m_platformFileSystem->move(fileSystemURLToPath(sourcePath), fileSystemURLToPath(destinationPath), new PlatformAsyncFileSystemCallbacks(callbacks));
}
void AsyncFileSystemBlackBerry::copy(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- UNUSED_PARAM(sourcePath);
- UNUSED_PARAM(destinationPath);
- UNUSED_PARAM(callbacks);
-
- notImplemented();
+ m_platformFileSystem->copy(fileSystemURLToPath(sourcePath), fileSystemURLToPath(destinationPath), new PlatformAsyncFileSystemCallbacks(callbacks));
}
void AsyncFileSystemBlackBerry::remove(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- UNUSED_PARAM(path);
- UNUSED_PARAM(callbacks);
-
- notImplemented();
+ m_platformFileSystem->remove(fileSystemURLToPath(path), new PlatformAsyncFileSystemCallbacks(callbacks));
}
void AsyncFileSystemBlackBerry::removeRecursively(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- UNUSED_PARAM(path);
- UNUSED_PARAM(callbacks);
-
- notImplemented();
+ m_platformFileSystem->removeRecursively(fileSystemURLToPath(path), new PlatformAsyncFileSystemCallbacks(callbacks));
}
void AsyncFileSystemBlackBerry::readMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- UNUSED_PARAM(path);
- UNUSED_PARAM(callbacks);
-
- notImplemented();
+ m_platformFileSystem->readMetadata(fileSystemURLToPath(path), new PlatformAsyncFileSystemCallbacks(callbacks));
}
void AsyncFileSystemBlackBerry::createFile(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- UNUSED_PARAM(path);
- UNUSED_PARAM(exclusive);
- UNUSED_PARAM(callbacks);
-
- notImplemented();
+ m_platformFileSystem->createFile(fileSystemURLToPath(path), exclusive, new PlatformAsyncFileSystemCallbacks(callbacks));
}
void AsyncFileSystemBlackBerry::createDirectory(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- UNUSED_PARAM(path);
- UNUSED_PARAM(exclusive);
- UNUSED_PARAM(callbacks);
-
- notImplemented();
+ m_platformFileSystem->createDirectory(fileSystemURLToPath(path), exclusive, new PlatformAsyncFileSystemCallbacks(callbacks));
}
void AsyncFileSystemBlackBerry::fileExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- UNUSED_PARAM(path);
- UNUSED_PARAM(callbacks);
-
- notImplemented();
+ m_platformFileSystem->fileExists(fileSystemURLToPath(path), new PlatformAsyncFileSystemCallbacks(callbacks));
}
void AsyncFileSystemBlackBerry::directoryExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- UNUSED_PARAM(path);
- UNUSED_PARAM(callbacks);
-
- notImplemented();
+ m_platformFileSystem->directoryExists(fileSystemURLToPath(path), new PlatformAsyncFileSystemCallbacks(callbacks));
}
void AsyncFileSystemBlackBerry::readDirectory(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- UNUSED_PARAM(path);
- UNUSED_PARAM(callbacks);
-
- notImplemented();
+ m_platformFileSystem->readDirectory(fileSystemURLToPath(path), new PlatformAsyncFileSystemCallbacks(callbacks));
}
-
void AsyncFileSystemBlackBerry::createWriter(AsyncFileWriterClient* client, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- UNUSED_PARAM(client);
- UNUSED_PARAM(path);
- UNUSED_PARAM(callbacks);
-
- notImplemented();
+ BlackBerry::Platform::WebFileWriter::createWriter(m_platformFileSystem.get(), fileSystemURLToPath(path), new PlatformAsyncFileSystemCallbacks(callbacks, client));
}
void AsyncFileSystemBlackBerry::createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- UNUSED_PARAM(path);
- UNUSED_PARAM(callbacks);
+ m_platformFileSystem->createSnapshotFileAndReadMetadata(fileSystemURLToPath(path), new PlatformAsyncFileSystemCallbacks(callbacks));
+}
- notImplemented();
+String AsyncFileSystemBlackBerry::fileSystemURLToPath(const KURL& url)
+{
+ FileSystemType type;
+ String fullPath;
+ bool result = DOMFileSystemBase::crackFileSystemURL(url, type, fullPath);
+ ASSERT_UNUSED(result, result);
+ return fullPath;
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.h (148274 => 148275)
--- trunk/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.h 2013-04-12 13:10:28 UTC (rev 148274)
+++ trunk/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.h 2013-04-12 13:22:16 UTC (rev 148275)
@@ -22,12 +22,33 @@
#if ENABLE(FILE_SYSTEM)
#include "AsyncFileSystem.h"
+#include "FileSystemType.h"
+#include "KURL.h"
+#include <BlackBerryPlatformWebFileSystem.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+template <> inline void deleteOwnedPtr<BlackBerry::Platform::WebFileSystem>(BlackBerry::Platform::WebFileSystem* ptr)
+{
+ BlackBerry::Platform::deleteGuardedObject(ptr);
+}
+
+}
+
namespace WebCore {
class AsyncFileSystemBlackBerry : public AsyncFileSystem {
public:
AsyncFileSystemBlackBerry();
+ static PassOwnPtr<AsyncFileSystemBlackBerry> create(PassOwnPtr<BlackBerry::Platform::WebFileSystem> platformFileSystem)
+ {
+ return adoptPtr(new AsyncFileSystemBlackBerry(platformFileSystem));
+ }
+
+ static void openFileSystem(const KURL& rootURL, const String& basePath, const String& storageIdentifier, FileSystemType, long long size, bool create, int playerId, PassOwnPtr<AsyncFileSystemCallbacks>);
virtual ~AsyncFileSystemBlackBerry();
virtual void move(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>);
virtual void copy(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>);
@@ -41,6 +62,12 @@
virtual void readDirectory(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>);
virtual void createWriter(AsyncFileWriterClient*, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>);
virtual void createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>);
+
+protected:
+ AsyncFileSystemBlackBerry(PassOwnPtr<BlackBerry::Platform::WebFileSystem> platformFileSystem);
+ static String fileSystemURLToPath(const KURL&);
+
+ OwnPtr<BlackBerry::Platform::WebFileSystem> m_platformFileSystem;
};
} // namespace WebCore