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

Unified Diff: webkit/browser/fileapi/file_system_context.cc

Issue 23856002: SyncFS: Support resolveLocalFileSystemURL on SyncFileSystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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: webkit/browser/fileapi/file_system_context.cc
diff --git a/webkit/browser/fileapi/file_system_context.cc b/webkit/browser/fileapi/file_system_context.cc
index 2053cb153b42b9aeabe43a9b42aff022f9784004..90ab0ade496f7b19bc4e307c2afc6b00cb550c0d 100644
--- a/webkit/browser/fileapi/file_system_context.cc
+++ b/webkit/browser/fileapi/file_system_context.cc
@@ -272,6 +272,32 @@ void FileSystemContext::OpenFileSystem(
base::Bind(&DidOpenFileSystem, callback));
}
+void FileSystemContext::ResolveURL(
+ const GURL& filesystem_url,
+ const ResolveURLCallback& callback) {
+ DCHECK(!callback.is_null());
+
+ FileSystemURL url = CrackURL(GURL(filesystem_url));
tzik 2013/09/05 09:30:26 extra GURL()?
nhiroki 2013/09/09 09:51:05 Done.
+ if (!url.is_valid()) {
+ callback.Run(base::PLATFORM_FILE_ERROR_SECURITY,
+ std::string(), GURL(), base::FilePath(), false);
+ return;
+ }
+
+ FileSystemBackend* backend = GetFileSystemBackend(url.type());
+ if (!backend) {
+ callback.Run(base::PLATFORM_FILE_ERROR_SECURITY,
+ std::string(), GURL(), base::FilePath(), false);
+ return;
+ }
+
+ backend->OpenFileSystem(
+ url.origin(), url.type(),
+ OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT,
+ base::Bind(&FileSystemContext::DidOpenFileSystemForResolveURL,
+ this, url, callback));
+}
+
void FileSystemContext::DeleteFileSystem(
const GURL& origin_url,
FileSystemType type,
@@ -437,4 +463,35 @@ void FileSystemContext::RegisterBackend(
}
}
+void FileSystemContext::DidOpenFileSystemForResolveURL(
+ const FileSystemURL& url,
+ const FileSystemContext::ResolveURLCallback& callback,
+ const GURL& filesystem_root,
+ const std::string& filesystem_name,
+ base::PlatformFileError error) {
+ if (error != base::PLATFORM_FILE_OK) {
+ callback.Run(error, std::string(), GURL(), base::FilePath(), false);
+ return;
+ }
+ operation_runner()->GetMetadata(
+ url,
+ base::Bind(&FileSystemContext::DidGetMetadataForResolveURL,
+ this, url, callback, filesystem_root, filesystem_name));
+}
+
+void FileSystemContext::DidGetMetadataForResolveURL(
+ const FileSystemURL& url,
+ const FileSystemContext::ResolveURLCallback& callback,
+ const GURL& filesystem_root,
+ const std::string& filesystem_name,
+ base::PlatformFileError error,
+ const base::PlatformFileInfo& file_info) {
+ if (error != base::PLATFORM_FILE_OK) {
+ callback.Run(error, std::string(), GURL(), base::FilePath(), false);
+ return;
+ }
+ callback.Run(error, filesystem_name, filesystem_root, url.path(),
+ file_info.is_directory);
+}
+
} // namespace fileapi
« content/child/fileapi/webfilesystem_impl.h ('K') | « webkit/browser/fileapi/file_system_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698