diff options
author | kerz@chromium.org <kerz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-20 22:19:17 +0000 |
---|---|---|
committer | kerz@chromium.org <kerz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-20 22:19:17 +0000 |
commit | eeed85c4662942e0c9e557d36fa0d26a938058e5 (patch) | |
tree | 3e6e267779cd0de15b1dfb8543e399023a4b1342 /webkit/fileapi/file_system_operation.cc | |
parent | fe2534f1d0294dadd3bc915982ef378906a2be57 (diff) | |
download | chromium_src-eeed85c4662942e0c9e557d36fa0d26a938058e5.zip chromium_src-eeed85c4662942e0c9e557d36fa0d26a938058e5.tar.gz chromium_src-eeed85c4662942e0c9e557d36fa0d26a938058e5.tar.bz2 |
Merge 82266 - Fixed file/directory url resolution for external mount point provider.Per Eric's request, refactored FileSystemDirURLRequestJob and FileSystemURLRequestJob classes to resolve local file system through a new operation.BUG=chromium-os:14225TEST=added new test cases to FileSystemPathManagerTest.*, added FileSystemOperationTest.TestGetLocalFilePathSuccessReview URL: http://codereview.chromium.org/6864040
TBR=zelidrag@chromium.org
Review URL: http://codereview.chromium.org/6882102
git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@82372 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_operation.cc')
-rw-r--r-- | webkit/fileapi/file_system_operation.cc | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/webkit/fileapi/file_system_operation.cc b/webkit/fileapi/file_system_operation.cc index 15f8955..046a16f 100644 --- a/webkit/fileapi/file_system_operation.cc +++ b/webkit/fileapi/file_system_operation.cc @@ -60,7 +60,7 @@ void FileSystemOperation::OpenFileSystem( // create an unpredictable directory name. Without that, we could lazily // create the root later on the first filesystem write operation, and just // return GetFileSystemRootURI() here. - file_system_context()->path_manager()->GetFileSystemRootPath( + file_system_context()->path_manager()->ValidateFileSystemRootAndGetURL( origin_url, type, create, callback_factory_.NewCallback(&FileSystemOperation::DidGetRootPath)); } @@ -232,6 +232,27 @@ void FileSystemOperation::FileExists(const GURL& path) { &FileSystemOperation::DidFileExists)); } +void FileSystemOperation::GetLocalPath(const GURL& path) { +#ifndef NDEBUG + DCHECK(kOperationNone == pending_operation_); + pending_operation_ = kOperationGetLocalPath; +#endif + + FilePath virtual_path; + GURL origin_url; + FileSystemType type; + if (!VerifyFileSystemPathForRead(path, &origin_url, &type, &virtual_path)) { + delete this; + return; + } + file_system_operation_context_.set_src_origin_url(origin_url); + file_system_operation_context_.set_src_type(type); + FileSystemFileUtilProxy::GetLocalPath( + file_system_operation_context_, + proxy_, virtual_path, callback_factory_.NewCallback( + &FileSystemOperation::DidGetLocalPath)); +} + void FileSystemOperation::GetMetadata(const GURL& path) { #ifndef NDEBUG DCHECK(kOperationNone == pending_operation_); @@ -531,6 +552,16 @@ void FileSystemOperation::DidFileExists( delete this; } +void FileSystemOperation::DidGetLocalPath( + base::PlatformFileError rv, + const FilePath& local_path) { + if (rv == base::PLATFORM_FILE_OK) + dispatcher_->DidGetLocalPath(local_path); + else + dispatcher_->DidFail(rv); + delete this; +} + void FileSystemOperation::DidGetMetadata( base::PlatformFileError rv, const base::PlatformFileInfo& file_info, @@ -623,7 +654,7 @@ bool FileSystemOperation::VerifyFileSystemPathForRead( // We may want do more checks, but for now it just checks if the given // URL is valid. if (!CrackFileSystemURL(path, origin_url, type, virtual_path)) { - dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_SECURITY); + dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_INVALID_URL); return false; } if (!file_system_context()->path_manager()->IsAccessAllowed( @@ -660,7 +691,7 @@ bool FileSystemOperation::VerifyFileSystemPathForWrite( } if (!CrackFileSystemURL(path, origin_url, type, virtual_path)) { - dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_SECURITY); + dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_INVALID_URL); return false; } if (!file_system_context()->path_manager()->IsAccessAllowed( |