Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp

Issue 23537011: FileAPI: Add WebFileSystem::resolveURL (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp
diff --git a/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp b/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp
index 5e32339cc81b115efa17ef1bd18c71c5030f7b46..0f9e22f1aef0aa507e94b7ff4ccdc61f172f0fca 100644
--- a/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp
+++ b/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp
@@ -95,14 +95,12 @@ void WorkerGlobalScopeFileSystem::webkitResolveLocalFileSystemURL(WorkerGlobalSc
return;
}
- FileSystemType type;
- String filePath;
- if (!completedURL.isValid() || !DOMFileSystemBase::crackFileSystemURL(completedURL, type, filePath)) {
+ if (!completedURL.isValid()) {
DOMFileSystem::scheduleCallback(worker, errorCallback, FileError::create(FileError::ENCODING_ERR));
return;
}
- WorkerLocalFileSystem::from(worker)->readFileSystem(worker, type, ResolveURICallbacks::create(successCallback, errorCallback, worker, type, filePath));
+ WorkerLocalFileSystem::from(worker)->resolveURL(worker, completedURL, ResolveURICallbacks::create(successCallback, errorCallback, worker));
}
PassRefPtr<EntrySync> WorkerGlobalScopeFileSystem::webkitResolveLocalFileSystemSyncURL(WorkerGlobalScope* worker, const String& url, ExceptionState& es)
@@ -114,28 +112,20 @@ PassRefPtr<EntrySync> WorkerGlobalScopeFileSystem::webkitResolveLocalFileSystemS
return 0;
}
- FileSystemType type;
- String filePath;
- if (!completedURL.isValid() || !DOMFileSystemBase::crackFileSystemURL(completedURL, type, filePath)) {
+ if (!completedURL.isValid()) {
es.throwDOMException(EncodingError, ExceptionMessages::failedToExecute("webkitResolveLocalFileSystemSyncURL", "WorkerGlobalScopeFileSystem", "the URL '" + url + "' is invalid."));
return 0;
}
- FileSystemSyncCallbackHelper readFileSystemHelper;
- OwnPtr<AsyncFileSystemCallbacks> callbacks = FileSystemCallbacks::create(readFileSystemHelper.successCallback(), readFileSystemHelper.errorCallback(), worker, type);
+ EntrySyncCallbackHelper resolveURLHelper;
+ OwnPtr<AsyncFileSystemCallbacks> callbacks = ResolveURICallbacks::create(resolveURLHelper.successCallback(), resolveURLHelper.errorCallback(), worker);
callbacks->setShouldBlockUntilCompletion(true);
- WorkerLocalFileSystem::from(worker)->readFileSystem(worker, type, callbacks.release());
- RefPtr<DOMFileSystemSync> fileSystem = readFileSystemHelper.getResult(es);
- if (!fileSystem)
- return 0;
-
- RefPtr<EntrySync> entry = fileSystem->root()->getDirectory(filePath, Dictionary(), es);
- if (es.code() == TypeMismatchError) {
- es.clearException();
- return fileSystem->root()->getFile(filePath, Dictionary(), es);
- }
+ WorkerLocalFileSystem::from(worker)->resolveURL(worker, completedURL, callbacks.release());
+ RefPtr<EntrySync> entry = resolveURLHelper.getResult(es);
+ if (!entry)
+ return 0;
return entry.release();
}
« Source/modules/filesystem/LocalFileSystem.h ('K') | « Source/modules/filesystem/LocalFileSystem.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698