summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi
diff options
context:
space:
mode:
authordumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-27 21:22:01 +0000
committerdumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-27 21:22:01 +0000
commited7ae173fbca0de5cb95c990fed727ea15172cd4 (patch)
treee94ae0632eec0d649dad8fa1953cf0932c35cbda /webkit/fileapi
parent6783d72a34e5d25655d5c9d054f2700f3d2488ff (diff)
downloadchromium_src-ed7ae173fbca0de5cb95c990fed727ea15172cd4.zip
chromium_src-ed7ae173fbca0de5cb95c990fed727ea15172cd4.tar.gz
chromium_src-ed7ae173fbca0de5cb95c990fed727ea15172cd4.tar.bz2
Adding a TouchFile() operation.
BUG=none TEST=none Review URL: http://codereview.chromium.org/3417018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60710 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi')
-rw-r--r--webkit/fileapi/file_system_operation.cc22
-rw-r--r--webkit/fileapi/file_system_operation.h10
2 files changed, 31 insertions, 1 deletions
diff --git a/webkit/fileapi/file_system_operation.cc b/webkit/fileapi/file_system_operation.cc
index ffe5e5f..140ade4 100644
--- a/webkit/fileapi/file_system_operation.cc
+++ b/webkit/fileapi/file_system_operation.cc
@@ -4,6 +4,7 @@
#include "webkit/fileapi/file_system_operation.h"
+#include "base/time.h"
#include "googleurl/src/gurl.h"
#include "webkit/fileapi/file_system_callback_dispatcher.h"
@@ -126,7 +127,6 @@ void FileSystemOperation::Remove(const FilePath& path) {
&FileSystemOperation::DidFinishFileOperation));
}
-
void FileSystemOperation::Write(
const FilePath&,
const GURL&,
@@ -152,6 +152,19 @@ void FileSystemOperation::Truncate(const FilePath& path, int64 length) {
NOTREACHED();
}
+void FileSystemOperation::TouchFile(const FilePath& path,
+ const base::Time& last_access_time,
+ const base::Time& last_modified_time) {
+#ifndef NDEBUG
+ DCHECK(!operation_pending_);
+ operation_pending_ = true;
+#endif
+
+ base::FileUtilProxy::Touch(
+ proxy_, path, last_access_time, last_modified_time,
+ callback_factory_.NewCallback(&FileSystemOperation::DidTouchFile));
+}
+
void FileSystemOperation::Cancel() {
#ifndef NDEBUG
DCHECK(operation_pending_);
@@ -242,4 +255,11 @@ void FileSystemOperation::DidWrite(
dispatcher_->DidFail(rv);
}
+void FileSystemOperation::DidTouchFile(base::PlatformFileError rv) {
+ if (rv == base::PLATFORM_FILE_OK)
+ dispatcher_->DidSucceed();
+ else
+ dispatcher_->DidFail(rv);
+}
+
} // namespace fileapi
diff --git a/webkit/fileapi/file_system_operation.h b/webkit/fileapi/file_system_operation.h
index e1058a3..1107303 100644
--- a/webkit/fileapi/file_system_operation.h
+++ b/webkit/fileapi/file_system_operation.h
@@ -15,6 +15,10 @@
#include "base/scoped_callback_factory.h"
#include "base/scoped_ptr.h"
+namespace base {
+class Time;
+}
+
class GURL;
namespace fileapi {
@@ -62,6 +66,10 @@ class FileSystemOperation {
void Truncate(const FilePath& path, int64 length);
+ void TouchFile(const FilePath& path,
+ const base::Time& last_access_time,
+ const base::Time& last_modified_time);
+
// Used to attempt to cancel the current operation. This currently does
// nothing for any operation other than Write().
void Cancel();
@@ -100,6 +108,8 @@ class FileSystemOperation {
int64 bytes,
bool complete);
+ void DidTouchFile(base::PlatformFileError rv);
+
scoped_ptr<FileSystemCallbackDispatcher> dispatcher_;
base::ScopedCallbackFactory<FileSystemOperation> callback_factory_;