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 26a48d49a3ca7451d89969acb833c1c05dfb7f78..ef2998e5e093de41ae1636ec5e2b8b58825bad7b 100644 |
| --- a/webkit/browser/fileapi/file_system_context.cc |
| +++ b/webkit/browser/fileapi/file_system_context.cc |
| @@ -27,6 +27,7 @@ |
| #include "webkit/browser/fileapi/test_file_system_backend.h" |
| #include "webkit/browser/quota/quota_manager.h" |
| #include "webkit/browser/quota/special_storage_policy.h" |
| +#include "webkit/common/fileapi/file_system_info.h" |
| #include "webkit/common/fileapi/file_system_util.h" |
| using quota::QuotaClient; |
| @@ -275,6 +276,25 @@ void FileSystemContext::OpenFileSystem( |
| base::Bind(&DidOpenFileSystem, callback)); |
| } |
| +void FileSystemContext::ResolveURL( |
| + const FileSystemURL& url, |
| + const ResolveURLCallback& callback) { |
| + DCHECK(!callback.is_null()); |
|
kinuko
2013/09/09 12:52:23
Can we add DCHECK(io_task_runner_->RunsTasksOnCurr
nhiroki
2013/09/10 06:30:39
Added the check for the ResolveURL.
I'm going to
|
| + |
| + FileSystemBackend* backend = GetFileSystemBackend(url.type()); |
| + if (!backend) { |
| + callback.Run(base::PLATFORM_FILE_ERROR_SECURITY, |
| + FileSystemInfo(), 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, |
| @@ -424,8 +444,7 @@ FileSystemURL FileSystemContext::CrackFileSystemURL( |
| return current; |
| } |
| -void FileSystemContext::RegisterBackend( |
| - FileSystemBackend* backend) { |
| +void FileSystemContext::RegisterBackend(FileSystemBackend* backend) { |
| const FileSystemType mount_types[] = { |
| kFileSystemTypeTemporary, |
| kFileSystemTypePersistent, |
| @@ -452,4 +471,44 @@ 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, FileSystemInfo(), base::FilePath(), false); |
| + return; |
| + } |
| + fileapi::FileSystemInfo info( |
| + filesystem_name, filesystem_root, url.mount_type()); |
| + |
| + // Extract the virtual path not containing a filesystem type part from |url|. |
| + base::FilePath parent = |
| + base::FilePath::FromUTF8Unsafe(filesystem_root.path()); |
| + base::FilePath child = base::FilePath::FromUTF8Unsafe(url.ToGURL().path()); |
| + base::FilePath path; |
| + bool result = parent.AppendRelativePath(child, &path); |
| + DCHECK(result); |
| + |
| + operation_runner()->GetMetadata( |
| + url, |
| + base::Bind(&FileSystemContext::DidGetMetadataForResolveURL, |
| + this, path, callback, info)); |
| +} |
| + |
| +void FileSystemContext::DidGetMetadataForResolveURL( |
|
kinuko
2013/09/09 12:52:23
Does this need to be a method of FSC?
(I guess Di
nhiroki
2013/09/10 06:30:39
Done.
|
| + const base::FilePath& path, |
| + const FileSystemContext::ResolveURLCallback& callback, |
| + const FileSystemInfo& info, |
| + base::PlatformFileError error, |
| + const base::PlatformFileInfo& file_info) { |
| + if (error != base::PLATFORM_FILE_OK) { |
| + callback.Run(error, FileSystemInfo(), base::FilePath(), false); |
| + return; |
| + } |
| + callback.Run(error, info, path, file_info.is_directory); |
| +} |
| + |
| } // namespace fileapi |