summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-29 11:50:17 +0000
committerkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-29 11:50:17 +0000
commit47c805890202df8220e4ae8f05e60f1454a5e059 (patch)
tree389a5108296f7c639fc5d5dbab14510c9388f228 /webkit
parent4bc2429fd27a026e66975feeb6f2bf63579b7c19 (diff)
downloadchromium_src-47c805890202df8220e4ae8f05e60f1454a5e059.zip
chromium_src-47c805890202df8220e4ae8f05e60f1454a5e059.tar.gz
chromium_src-47c805890202df8220e4ae8f05e60f1454a5e059.tar.bz2
Implement CreateFile() for GData file system.
This CL is the last piece for implementing the File API getFile(..., {create: true}, ...) for GDataFileSytem. Currently the file creation is implemented as uploading of an empty file to the server. The Drive server assigns the resource_id, and further read or write operation just treats it as a non-pinned file (e.g., when it is read or written it is downloaded to GCache/v1/tmp/<resource_id>.<md5>). BUG=132968 TEST=Manual test. 1) Be sure prerequisites patches (10636053, 10656043, and 10556003) are applied. 2) Edit image files on Google Drive folder by photo editor, and with "overwrite original" unchecked) 3) Verify a new file is created on the Drive. Review URL: https://chromiumcodereview.appspot.com/10568012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144898 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/chromeos/fileapi/remote_file_system_operation.cc5
-rw-r--r--webkit/chromeos/fileapi/remote_file_system_proxy.h9
2 files changed, 13 insertions, 1 deletions
diff --git a/webkit/chromeos/fileapi/remote_file_system_operation.cc b/webkit/chromeos/fileapi/remote_file_system_operation.cc
index d481f05..cfe457e 100644
--- a/webkit/chromeos/fileapi/remote_file_system_operation.cc
+++ b/webkit/chromeos/fileapi/remote_file_system_operation.cc
@@ -80,7 +80,10 @@ void RemoteFileSystemOperation::CreateDirectory(
void RemoteFileSystemOperation::CreateFile(const FileSystemURL& url,
bool exclusive,
const StatusCallback& callback) {
- NOTIMPLEMENTED();
+ DCHECK(SetPendingOperationType(kOperationCreateFile));
+ remote_proxy_->CreateFile(url, exclusive,
+ base::Bind(&RemoteFileSystemOperation::DidFinishFileOperation,
+ base::Owned(this), callback));
}
void RemoteFileSystemOperation::Copy(const FileSystemURL& src_url,
diff --git a/webkit/chromeos/fileapi/remote_file_system_proxy.h b/webkit/chromeos/fileapi/remote_file_system_proxy.h
index fbe3149..b62c036 100644
--- a/webkit/chromeos/fileapi/remote_file_system_proxy.h
+++ b/webkit/chromeos/fileapi/remote_file_system_proxy.h
@@ -62,6 +62,15 @@ class RemoteFileSystemProxyInterface :
bool recursive,
const FileSystemOperationInterface::StatusCallback& callback) = 0;
+ // Creates a file at |url|. If the flag |is_exclusive| is true, an
+ // error is raised when a file already exists at the path. It is
+ // an error if a directory or a hosted document is already present at the
+ // path, or the parent directory of the path is not present yet.
+ virtual void CreateFile(
+ const FileSystemURL& url,
+ bool exclusive,
+ const FileSystemOperationInterface::StatusCallback& callback) = 0;
+
// Changes the length of an existing file at |url| to |length|. If |length|
// is negative, an error is raised. If |length| is more than the current size
// of the file, zero is padded for the extended part.