Chromium Code Reviews| 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 |