| Index: webkit/fileapi/isolated_file_util.cc
|
| diff --git a/webkit/fileapi/isolated_file_util.cc b/webkit/fileapi/isolated_file_util.cc
|
| index 1d50a56f71c35cfd3e8d8ff8b6c0a04f36880b73..41f55f578fb5a4d8f7c21ef398db3781e5cb1855 100644
|
| --- a/webkit/fileapi/isolated_file_util.cc
|
| +++ b/webkit/fileapi/isolated_file_util.cc
|
| @@ -172,39 +172,31 @@ FilePath RecursiveSetFileEnumerator::Next() {
|
|
|
| } // namespace
|
|
|
| -IsolatedFileUtil::IsolatedFileUtil() {
|
| -}
|
| +//-------------------------------------------------------------------------
|
|
|
| -PlatformFileError IsolatedFileUtil::CreateOrOpen(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& url, int file_flags,
|
| - PlatformFile* file_handle, bool* created) {
|
| - return base::PLATFORM_FILE_ERROR_SECURITY;
|
| -}
|
| +IsolatedFileUtil::IsolatedFileUtil() {}
|
|
|
| -PlatformFileError IsolatedFileUtil::Close(
|
| - FileSystemOperationContext* context,
|
| - PlatformFile file_handle) {
|
| - // We don't allow open thus Close won't be called.
|
| - return base::PLATFORM_FILE_ERROR_SECURITY;
|
| -}
|
| -
|
| -PlatformFileError IsolatedFileUtil::EnsureFileExists(
|
| +PlatformFileError IsolatedFileUtil::GetLocalFilePath(
|
| FileSystemOperationContext* context,
|
| const FileSystemURL& url,
|
| - bool* created) {
|
| - return base::PLATFORM_FILE_ERROR_SECURITY;
|
| + FilePath* local_file_path) {
|
| + DCHECK(local_file_path);
|
| + std::string filesystem_id;
|
| + if (!IsolatedContext::GetInstance()->CrackIsolatedPath(
|
| + url.path(), &filesystem_id, NULL, local_file_path))
|
| + return base::PLATFORM_FILE_ERROR_NOT_FOUND;
|
| + if (local_file_path->empty()) {
|
| + // Root direcory case, which should not be accessed.
|
| + return base::PLATFORM_FILE_ERROR_ACCESS_DENIED;
|
| + }
|
| + return base::PLATFORM_FILE_OK;
|
| }
|
|
|
| -PlatformFileError IsolatedFileUtil::CreateDirectory(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& url,
|
| - bool exclusive,
|
| - bool recursive) {
|
| - return base::PLATFORM_FILE_ERROR_SECURITY;
|
| -}
|
| +//-------------------------------------------------------------------------
|
| +
|
| +DraggedFileUtil::DraggedFileUtil() {}
|
|
|
| -PlatformFileError IsolatedFileUtil::GetFileInfo(
|
| +PlatformFileError DraggedFileUtil::GetFileInfo(
|
| FileSystemOperationContext* context,
|
| const FileSystemURL& url,
|
| PlatformFileInfo* file_info,
|
| @@ -238,7 +230,7 @@ PlatformFileError IsolatedFileUtil::GetFileInfo(
|
| }
|
|
|
| FileSystemFileUtil::AbstractFileEnumerator*
|
| -IsolatedFileUtil::CreateFileEnumerator(
|
| +DraggedFileUtil::CreateFileEnumerator(
|
| FileSystemOperationContext* context,
|
| const FileSystemURL& root,
|
| bool recursive) {
|
| @@ -260,7 +252,7 @@ IsolatedFileUtil::CreateFileEnumerator(
|
|
|
| // Root path case.
|
| std::vector<FileInfo> toplevels;
|
| - IsolatedContext::GetInstance()->GetRegisteredFileInfo(
|
| + IsolatedContext::GetInstance()->GetDraggedFileInfo(
|
| filesystem_id, &toplevels);
|
| if (!recursive)
|
| return new SetFileEnumerator(toplevels, root.path());
|
| @@ -268,38 +260,7 @@ IsolatedFileUtil::CreateFileEnumerator(
|
| virtual_base_path, toplevels, root.path());
|
| }
|
|
|
| -PlatformFileError IsolatedFileUtil::GetLocalFilePath(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& file_system_url,
|
| - FilePath* local_file_path) {
|
| - if (GetPlatformPath(file_system_url, local_file_path))
|
| - return base::PLATFORM_FILE_OK;
|
| - return base::PLATFORM_FILE_ERROR_SECURITY;
|
| -}
|
| -
|
| -PlatformFileError IsolatedFileUtil::Touch(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& url,
|
| - const base::Time& last_access_time,
|
| - const base::Time& last_modified_time) {
|
| - FilePath platform_path;
|
| - if (!GetPlatformPath(url, &platform_path) || platform_path.empty())
|
| - return base::PLATFORM_FILE_ERROR_SECURITY;
|
| - return NativeFileUtil::Touch(
|
| - platform_path, last_access_time, last_modified_time);
|
| -}
|
| -
|
| -PlatformFileError IsolatedFileUtil::Truncate(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& url,
|
| - int64 length) {
|
| - FilePath platform_path;
|
| - if (!GetPlatformPath(url, &platform_path) || platform_path.empty())
|
| - return base::PLATFORM_FILE_ERROR_SECURITY;
|
| - return NativeFileUtil::Truncate(platform_path, length);
|
| -}
|
| -
|
| -bool IsolatedFileUtil::PathExists(
|
| +bool DraggedFileUtil::PathExists(
|
| FileSystemOperationContext* context,
|
| const FileSystemURL& url) {
|
| FilePath platform_path;
|
| @@ -312,7 +273,7 @@ bool IsolatedFileUtil::PathExists(
|
| return NativeFileUtil::PathExists(platform_path);
|
| }
|
|
|
| -bool IsolatedFileUtil::DirectoryExists(
|
| +bool DraggedFileUtil::DirectoryExists(
|
| FileSystemOperationContext* context,
|
| const FileSystemURL& url) {
|
| FilePath platform_path;
|
| @@ -325,7 +286,7 @@ bool IsolatedFileUtil::DirectoryExists(
|
| return NativeFileUtil::DirectoryExists(platform_path);
|
| }
|
|
|
| -bool IsolatedFileUtil::IsDirectoryEmpty(
|
| +bool DraggedFileUtil::IsDirectoryEmpty(
|
| FileSystemOperationContext* context,
|
| const FileSystemURL& url) {
|
| std::string filesystem_id;
|
| @@ -337,7 +298,7 @@ bool IsolatedFileUtil::IsDirectoryEmpty(
|
| if (platform_path.empty()) {
|
| // The root directory case.
|
| std::vector<FileInfo> toplevels;
|
| - bool success = IsolatedContext::GetInstance()->GetRegisteredFileInfo(
|
| + bool success = IsolatedContext::GetInstance()->GetDraggedFileInfo(
|
| filesystem_id, &toplevels);
|
| DCHECK(success);
|
| return toplevels.empty();
|
| @@ -345,46 +306,7 @@ bool IsolatedFileUtil::IsDirectoryEmpty(
|
| return NativeFileUtil::IsDirectoryEmpty(platform_path);
|
| }
|
|
|
| -PlatformFileError IsolatedFileUtil::CopyOrMoveFile(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& src_url,
|
| - const FileSystemURL& dest_url,
|
| - bool copy) {
|
| - return base::PLATFORM_FILE_ERROR_SECURITY;
|
| -}
|
| -
|
| -PlatformFileError IsolatedFileUtil::CopyInForeignFile(
|
| - FileSystemOperationContext* context,
|
| - const FilePath& src_file_path,
|
| - const FileSystemURL& dest_url) {
|
| - return base::PLATFORM_FILE_ERROR_SECURITY;
|
| -}
|
| -
|
| -PlatformFileError IsolatedFileUtil::DeleteFile(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& url) {
|
| - return base::PLATFORM_FILE_ERROR_SECURITY;
|
| -}
|
| -
|
| -PlatformFileError IsolatedFileUtil::DeleteSingleDirectory(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& url) {
|
| - return base::PLATFORM_FILE_ERROR_SECURITY;
|
| -}
|
| -
|
| -scoped_refptr<webkit_blob::ShareableFileReference>
|
| -IsolatedFileUtil::CreateSnapshotFile(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& url,
|
| - base::PlatformFileError* result,
|
| - base::PlatformFileInfo* file_info,
|
| - FilePath* platform_path) {
|
| - DCHECK(result);
|
| - *result = GetFileInfo(context, url, file_info, platform_path);
|
| - return NULL;
|
| -}
|
| -
|
| -bool IsolatedFileUtil::GetPlatformPath(const FileSystemURL& url,
|
| +bool DraggedFileUtil::GetPlatformPath(const FileSystemURL& url,
|
| FilePath* platform_path) const {
|
| DCHECK(platform_path);
|
| std::string filesystem_id;
|
|
|