summaryrefslogtreecommitdiffstats
path: root/webkit/chromeos
diff options
context:
space:
mode:
authorzelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-14 10:25:02 +0000
committerzelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-14 10:25:02 +0000
commit42a9cf8ecbcd24ff9cac4d3c7b3fd4220d25acf6 (patch)
tree10bec9fddb1a62c80a9b724ed2cd1e442712f4e0 /webkit/chromeos
parente252cc688c57ea656e76df5110b6847574a4a991 (diff)
downloadchromium_src-42a9cf8ecbcd24ff9cac4d3c7b3fd4220d25acf6.zip
chromium_src-42a9cf8ecbcd24ff9cac4d3c7b3fd4220d25acf6.tar.gz
chromium_src-42a9cf8ecbcd24ff9cac4d3c7b3fd4220d25acf6.tar.bz2
Added support for opening Drive files in read-only mode from NaCl.
BUG=132236 TEST=make sure we can open files from Drive with QuickOffice viewer Review URL: https://chromiumcodereview.appspot.com/10543132 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142120 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/chromeos')
-rw-r--r--webkit/chromeos/fileapi/remote_file_system_operation.cc26
-rw-r--r--webkit/chromeos/fileapi/remote_file_system_operation.h5
-rw-r--r--webkit/chromeos/fileapi/remote_file_system_proxy.h7
3 files changed, 37 insertions, 1 deletions
diff --git a/webkit/chromeos/fileapi/remote_file_system_operation.cc b/webkit/chromeos/fileapi/remote_file_system_operation.cc
index 7bbf8e1..9e38541 100644
--- a/webkit/chromeos/fileapi/remote_file_system_operation.cc
+++ b/webkit/chromeos/fileapi/remote_file_system_operation.cc
@@ -147,7 +147,23 @@ void RemoteFileSystemOperation::OpenFile(const GURL& path,
int file_flags,
base::ProcessHandle peer_handle,
const OpenFileCallback& callback) {
- NOTIMPLEMENTED();
+ // TODO(zelidrag): Implement file write operations.
+ if ((file_flags & base::PLATFORM_FILE_CREATE) ||
+ (file_flags & base::PLATFORM_FILE_WRITE) ||
+ (file_flags & base::PLATFORM_FILE_EXCLUSIVE_WRITE) ||
+ (file_flags & base::PLATFORM_FILE_CREATE_ALWAYS) ||
+ (file_flags & base::PLATFORM_FILE_OPEN_TRUNCATED) ||
+ (file_flags & base::PLATFORM_FILE_DELETE_ON_CLOSE)) {
+ NOTIMPLEMENTED() << "File write operations not supported " << path.spec();
+ return;
+ }
+ DCHECK(SetPendingOperationType(kOperationOpenFile));
+ remote_proxy_->OpenFile(
+ path,
+ file_flags,
+ peer_handle,
+ base::Bind(&RemoteFileSystemOperation::DidOpenFile,
+ base::Owned(this), callback));
}
fileapi::FileSystemOperation*
@@ -234,4 +250,12 @@ void RemoteFileSystemOperation::DidCreateSnapshotFile(
callback.Run(result, file_info, platform_path, file_ref);
}
+void RemoteFileSystemOperation::DidOpenFile(
+ const OpenFileCallback& callback,
+ base::PlatformFileError result,
+ base::PlatformFile file,
+ base::ProcessHandle peer_handle) {
+ callback.Run(result, file, peer_handle);
+}
+
} // namespace chromeos
diff --git a/webkit/chromeos/fileapi/remote_file_system_operation.h b/webkit/chromeos/fileapi/remote_file_system_operation.h
index 388ca5e..706848d 100644
--- a/webkit/chromeos/fileapi/remote_file_system_operation.h
+++ b/webkit/chromeos/fileapi/remote_file_system_operation.h
@@ -110,6 +110,11 @@ class RemoteFileSystemOperation : public fileapi::FileSystemOperationInterface {
const base::PlatformFileInfo& file_info,
const FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref);
+ void DidOpenFile(
+ const OpenFileCallback& callback,
+ base::PlatformFileError result,
+ base::PlatformFile file,
+ base::ProcessHandle peer_handle);
scoped_refptr<fileapi::RemoteFileSystemProxyInterface> remote_proxy_;
diff --git a/webkit/chromeos/fileapi/remote_file_system_proxy.h b/webkit/chromeos/fileapi/remote_file_system_proxy.h
index cecfcaa..214b624 100644
--- a/webkit/chromeos/fileapi/remote_file_system_proxy.h
+++ b/webkit/chromeos/fileapi/remote_file_system_proxy.h
@@ -79,6 +79,13 @@ class RemoteFileSystemProxyInterface :
const GURL& path,
const WritableSnapshotFile& callback) = 0;
+ // Opens file for a give |path| with specified |flags| (see
+ // base::PlatformFileFlags for details).
+ virtual void OpenFile(
+ const GURL& path,
+ int flags,
+ base::ProcessHandle peer_handle,
+ const FileSystemOperationInterface::OpenFileCallback& callback) = 0;
// TODO(zelidrag): More methods to follow as we implement other parts of FSO.
};