summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi/file_system_operation.cc
diff options
context:
space:
mode:
authorzelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-20 09:05:52 +0000
committerzelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-20 09:05:52 +0000
commit24dceafb754bd1b9c80ad5c2c989746dd72705e4 (patch)
tree1bb0166649e403aa6dc2fd01362be5f3007aedb5 /webkit/fileapi/file_system_operation.cc
parentaf6c3fc4b98a7248c8081275c42b5ffdc621452c (diff)
downloadchromium_src-24dceafb754bd1b9c80ad5c2c989746dd72705e4.zip
chromium_src-24dceafb754bd1b9c80ad5c2c989746dd72705e4.tar.gz
chromium_src-24dceafb754bd1b9c80ad5c2c989746dd72705e4.tar.bz2
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:14225 TEST=added new test cases to FileSystemPathManagerTest.*, added FileSystemOperationTest.TestGetLocalFilePathSuccess Review URL: http://codereview.chromium.org/6864040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82266 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_operation.cc')
-rw-r--r--webkit/fileapi/file_system_operation.cc37
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(