diff options
author | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-16 00:02:53 +0000 |
---|---|---|
committer | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-16 00:02:53 +0000 |
commit | 07c3d212963a1638659c4130f05bd5196957b2f6 (patch) | |
tree | f9fcfd54a7e26b443b1b941f80475725cb4d79cd /webkit/fileapi/file_system_operation.cc | |
parent | 5800f19aa9967928eca31752678ac7d8e4e0cd1d (diff) | |
download | chromium_src-07c3d212963a1638659c4130f05bd5196957b2f6.zip chromium_src-07c3d212963a1638659c4130f05bd5196957b2f6.tar.gz chromium_src-07c3d212963a1638659c4130f05bd5196957b2f6.tar.bz2 |
Let Pepper open FileSystem files again.
TEST=none [existing tests, but they're not currently run automatically]
BUG=none
Review URL: http://codereview.chromium.org/6850027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81837 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_operation.cc')
-rw-r--r-- | webkit/fileapi/file_system_operation.cc | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/webkit/fileapi/file_system_operation.cc b/webkit/fileapi/file_system_operation.cc index 0e258c1..e242e86 100644 --- a/webkit/fileapi/file_system_operation.cc +++ b/webkit/fileapi/file_system_operation.cc @@ -375,6 +375,52 @@ void FileSystemOperation::TouchFile(const GURL& path, callback_factory_.NewCallback(&FileSystemOperation::DidTouchFile)); } +void FileSystemOperation::OpenFile(const GURL& path, + int file_flags, + base::ProcessHandle peer_handle) { +#ifndef NDEBUG + DCHECK(kOperationNone == pending_operation_); + pending_operation_ = kOperationOpenFile; +#endif + + peer_handle_ = peer_handle; + FilePath virtual_path; + GURL origin_url; + FileSystemType type; + if (file_flags & ( + (base::PLATFORM_FILE_ENUMERATE | base::PLATFORM_FILE_TEMPORARY | + base::PLATFORM_FILE_HIDDEN))) { + delete this; + return; + } + if (file_flags & + (base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_OPEN_ALWAYS | + base::PLATFORM_FILE_CREATE_ALWAYS | + base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_WRITE | + base::PLATFORM_FILE_DELETE_ON_CLOSE | base::PLATFORM_FILE_TRUNCATE | + base::PLATFORM_FILE_WRITE_ATTRIBUTES)) { + if (!VerifyFileSystemPathForWrite(path, true /* create */, &origin_url, + &type, &virtual_path)) { + delete this; + return; + } + } else { + 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::CreateOrOpen( + file_system_operation_context_, + proxy_, + virtual_path, + file_flags, + callback_factory_.NewCallback( + &FileSystemOperation::DidOpenFile)); +} + // We can only get here on a write or truncate that's not yet completed. // We don't support cancelling any other operation at this time. void FileSystemOperation::Cancel(FileSystemOperation* cancel_operation_ptr) { @@ -527,6 +573,17 @@ void FileSystemOperation::DidTouchFile(base::PlatformFileError rv) { delete this; } +void FileSystemOperation::DidOpenFile( + base::PlatformFileError rv, + base::PassPlatformFile file, + bool unused) { + if (rv == base::PLATFORM_FILE_OK) + dispatcher_->DidOpenFile(file.ReleaseValue(), peer_handle_); + else + dispatcher_->DidFail(rv); + delete this; +} + void FileSystemOperation::OnFileOpenedForWrite( base::PlatformFileError rv, base::PassPlatformFile file, |