summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 05:34:57 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 05:34:57 +0000
commit823096af8023d2c24a480deb01b2d1a8f5226257 (patch)
tree5be70135934e4245a168b891c90d772237585822 /webkit
parentc9380b5821393db13991fd9185c023a6496492b7 (diff)
downloadchromium_src-823096af8023d2c24a480deb01b2d1a8f5226257.zip
chromium_src-823096af8023d2c24a480deb01b2d1a8f5226257.tar.gz
chromium_src-823096af8023d2c24a480deb01b2d1a8f5226257.tar.bz2
gdata: Implement CreateSnapshotFile() for files on gdata.
With this implemented, snapshot files are created on-the-fly when files on gdata are accessed via File API. The files on gdata are downloaded if not cached locally. BUG=chromium-os:23516 TEST=click on large jpg files on gdata from the file manager, and they are displayed, with the following line in metadata_provider.js commented out, per kaznacheev's suggestion: contentURL: (result.contentUrl || '').replace(/\?.*$/gi, ''), Review URL: https://chromiumcodereview.appspot.com/9692026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126572 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/chromeos/fileapi/remote_file_system_operation.cc16
-rw-r--r--webkit/chromeos/fileapi/remote_file_system_operation.h7
-rw-r--r--webkit/chromeos/fileapi/remote_file_system_proxy.h7
-rw-r--r--webkit/fileapi/file_system_operation_interface.h1
4 files changed, 29 insertions, 2 deletions
diff --git a/webkit/chromeos/fileapi/remote_file_system_operation.cc b/webkit/chromeos/fileapi/remote_file_system_operation.cc
index b84818a..83fcd5e 100644
--- a/webkit/chromeos/fileapi/remote_file_system_operation.cc
+++ b/webkit/chromeos/fileapi/remote_file_system_operation.cc
@@ -140,8 +140,11 @@ RemoteFileSystemOperation::AsFileSystemOperation() {
void RemoteFileSystemOperation::CreateSnapshotFile(
const GURL& path,
const SnapshotFileCallback& callback) {
- LOG(WARNING) << "No implementation for " << path.spec();
- NOTIMPLEMENTED();
+ DCHECK(SetPendingOperationType(kOperationCreateSnapshotFile));
+ remote_proxy_->CreateSnapshotFile(
+ path,
+ base::Bind(&RemoteFileSystemOperation::DidCreateSnapshotFile,
+ base::Owned(this), callback));
}
bool RemoteFileSystemOperation::SetPendingOperationType(OperationType type) {
@@ -193,4 +196,13 @@ void RemoteFileSystemOperation::DidFinishFileOperation(
callback.Run(rv);
}
+void RemoteFileSystemOperation::DidCreateSnapshotFile(
+ const SnapshotFileCallback& callback,
+ base::PlatformFileError result,
+ const base::PlatformFileInfo& file_info,
+ const FilePath& platform_path,
+ const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
+ callback.Run(result, file_info, platform_path, file_ref);
+}
+
} // namespace chromeos
diff --git a/webkit/chromeos/fileapi/remote_file_system_operation.h b/webkit/chromeos/fileapi/remote_file_system_operation.h
index 3cbd665..b167527 100644
--- a/webkit/chromeos/fileapi/remote_file_system_operation.h
+++ b/webkit/chromeos/fileapi/remote_file_system_operation.h
@@ -99,6 +99,13 @@ class RemoteFileSystemOperation : public fileapi::FileSystemOperationInterface {
bool has_more);
void DidFinishFileOperation(const StatusCallback& callback,
base::PlatformFileError rv);
+ void DidCreateSnapshotFile(
+ const SnapshotFileCallback& callback,
+ base::PlatformFileError result,
+ const base::PlatformFileInfo& file_info,
+ const FilePath& platform_path,
+ const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref);
+
scoped_refptr<fileapi::RemoteFileSystemProxyInterface> remote_proxy_;
// A flag to make sure we call operation only once per instance.
diff --git a/webkit/chromeos/fileapi/remote_file_system_proxy.h b/webkit/chromeos/fileapi/remote_file_system_proxy.h
index d683282..c749982 100644
--- a/webkit/chromeos/fileapi/remote_file_system_proxy.h
+++ b/webkit/chromeos/fileapi/remote_file_system_proxy.h
@@ -58,6 +58,13 @@ class RemoteFileSystemProxyInterface :
bool recursive,
const FileSystemOperationInterface::StatusCallback& callback) = 0;
+ // Creates a local snapshot file for a given |path| and returns the
+ // metadata and platform path of the snapshot file via |callback|.
+ // See also FileSystemOperationInterface::CreateSnapshotFile().
+ virtual void CreateSnapshotFile(
+ const GURL& path,
+ const FileSystemOperationInterface::SnapshotFileCallback& callback) = 0;
+
// TODO(zelidrag): More methods to follow as we implement other parts of FSO.
};
diff --git a/webkit/fileapi/file_system_operation_interface.h b/webkit/fileapi/file_system_operation_interface.h
index 163f402..3bb785c 100644
--- a/webkit/fileapi/file_system_operation_interface.h
+++ b/webkit/fileapi/file_system_operation_interface.h
@@ -245,6 +245,7 @@ class FileSystemOperationInterface {
kOperationNone,
kOperationCreateFile,
kOperationCreateDirectory,
+ kOperationCreateSnapshotFile,
kOperationCopy,
kOperationMove,
kOperationDirectoryExists,