summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/chromium/src/LocalFileSystemChromium.cpp')
-rw-r--r--Source/WebKit/chromium/src/LocalFileSystemChromium.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp
index 35e4de8..b377bdb 100644
--- a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp
+++ b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp
@@ -57,29 +57,40 @@ LocalFileSystem& LocalFileSystem::localFileSystem()
return *localFileSystem;
}
-void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
-{
- ASSERT(context && context->isDocument());
- Document* document = static_cast<Document*>(context);
- WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
- webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), 0, false, new WebFileSystemCallbacksImpl(callbacks, type));
-}
+namespace {
-void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous)
+enum CreationFlag {
+ OpenExisting,
+ CreateIfNotPresent
+};
+
+} // namespace
+
+static void openFileSystemHelper(ScriptExecutionContext* context, AsyncFileSystem::Type type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous, long long size, CreationFlag create)
{
ASSERT(context);
if (context->isDocument()) {
Document* document = static_cast<Document*>(context);
WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
- webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), size, true, new WebFileSystemCallbacksImpl(callbacks, type));
+ webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks, type));
} else {
WorkerContext* workerContext = static_cast<WorkerContext*>(context);
WorkerLoaderProxy* workerLoaderProxy = &workerContext->thread()->workerLoaderProxy();
WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy);
- webWorker->openFileSystemForWorker(static_cast<WebFileSystem::Type>(type), size, new WebFileSystemCallbacksImpl(callbacks, type, context, synchronous), synchronous);
+ webWorker->openFileSystemForWorker(static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks, type, context, synchronous), synchronous);
}
}
+void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous)
+{
+ openFileSystemHelper(context, type, callbacks, synchronous, 0, OpenExisting);
+}
+
+void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous)
+{
+ openFileSystemHelper(context, type, callbacks, synchronous, size, CreateIfNotPresent);
+}
+
} // namespace WebCore
#endif // ENABLE(FILE_SYSTEM)