Chromium Code Reviews| Index: webkit/fileapi/file_system_operation.cc |
| =================================================================== |
| --- webkit/fileapi/file_system_operation.cc (revision 82028) |
| +++ webkit/fileapi/file_system_operation.cc (working copy) |
| @@ -232,6 +232,27 @@ |
| &FileSystemOperation::DidFileExists)); |
| } |
| +void FileSystemOperation::GetLocalPath(const GURL& path) { |
| +#ifndef NDEBUG |
| + DCHECK(kOperationNone == pending_operation_); |
| + pending_operation_ = kOperationGetMetadata; |
|
ericu
2011/04/19 20:30:49
kOperationGetLocalPath.
zel
2011/04/19 23:14:00
Done.
|
| +#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 @@ |
| 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 @@ |
| // 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); |
|
ericu
2011/04/19 20:30:49
Why this change? In general, we view an invalid U
zel
2011/04/19 23:14:00
FileSystemURLRequestJob unit tests expected INVALI
ericu
2011/04/19 23:36:19
OK.
|
| return false; |
| } |
| if (!file_system_context()->path_manager()->IsAccessAllowed( |
| @@ -660,7 +691,7 @@ |
| } |
| 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( |