summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/drive/file_system/touch_operation.h
diff options
context:
space:
mode:
authorhidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-23 19:37:34 +0000
committerhidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-23 19:37:34 +0000
commit2bc873488477f2267b634fa85dbc22182e4d1bc3 (patch)
treefd9288d38f2fcf44fefcf5262c89eb56cc332d17 /chrome/browser/chromeos/drive/file_system/touch_operation.h
parent83a119ed7897be7b7d6122a5908c90d3e81d8e79 (diff)
downloadchromium_src-2bc873488477f2267b634fa85dbc22182e4d1bc3.zip
chromium_src-2bc873488477f2267b634fa85dbc22182e4d1bc3.tar.gz
chromium_src-2bc873488477f2267b634fa85dbc22182e4d1bc3.tar.bz2
Implement TouchFile on drive::FileSystem.
This CL implements FileSystem::TouchFile for PPAPI. The method doesn't run yet in prod, because it is not accessed from FileSystemProxy. It'll be done in a following CL. BUG=144369 TEST=Ran unit_tests Review URL: https://chromiumcodereview.appspot.com/15728006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201860 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/drive/file_system/touch_operation.h')
-rw-r--r--chrome/browser/chromeos/drive/file_system/touch_operation.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/drive/file_system/touch_operation.h b/chrome/browser/chromeos/drive/file_system/touch_operation.h
new file mode 100644
index 0000000..48a3590
--- /dev/null
+++ b/chrome/browser/chromeos/drive/file_system/touch_operation.h
@@ -0,0 +1,89 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_TOUCH_OPERATION_H_
+#define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_TOUCH_OPERATION_H_
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/chromeos/drive/file_errors.h"
+#include "chrome/browser/google_apis/gdata_errorcode.h"
+
+namespace base {
+class FilePath;
+class SequencedTaskRunner;
+class Time;
+} // namespace base
+
+namespace google_apis {
+class ResourceEntry;
+} // namespace google_apis
+
+namespace drive {
+namespace internal {
+class ResourceMetadata;
+} // namespace internal
+
+class JobScheduler;
+class ResourceEntry;
+
+namespace file_system {
+
+class OperationObserver;
+
+class TouchOperation {
+ public:
+ TouchOperation(base::SequencedTaskRunner* blocking_task_runner,
+ OperationObserver* observer,
+ JobScheduler* scheduler,
+ internal::ResourceMetadata* metadata);
+ ~TouchOperation();
+
+ // Touches the file by updating last access time and last modified time.
+ // Upon completion, invokes |callback|.
+ // |last_access_time|, |last_modified_time| and |callback| must not be null.
+ void TouchFile(const base::FilePath& file_path,
+ const base::Time& last_access_time,
+ const base::Time& last_modified_time,
+ const FileOperationCallback& callback);
+
+ private:
+ // Part of TouchFile(). Runs after GetResourceEntry is completed.
+ void TouchFileAfterGetResourceEntry(const base::FilePath& file_path,
+ const base::Time& last_access_time,
+ const base::Time& last_modified_time,
+ const FileOperationCallback& callback,
+ ResourceEntry* entry,
+ FileError error);
+
+ // Part of TouchFile(). Runs after the server side update for last access time
+ // and last modified time is completed.
+ void TouchFileAfterServerTimeStampUpdated(
+ const base::FilePath& file_path,
+ const FileOperationCallback& callback,
+ google_apis::GDataErrorCode gdata_error,
+ scoped_ptr<google_apis::ResourceEntry> resource_entry);
+
+ // Part of TouchFile(). Runs after refreshing the local metadata is completed.
+ void TouchFileAfterRefreshMetadata(const base::FilePath& file_path,
+ const FileOperationCallback& callback,
+ FileError error);
+
+ scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
+ OperationObserver* observer_;
+ JobScheduler* scheduler_;
+ internal::ResourceMetadata* metadata_;
+
+ // Note: This should remain the last member so it'll be destroyed and
+ // invalidate the weak pointers before any other members are destroyed.
+ base::WeakPtrFactory<TouchOperation> weak_ptr_factory_;
+ DISALLOW_COPY_AND_ASSIGN(TouchOperation);
+};
+
+} // namespace file_system
+} // namespace drive
+
+#endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_TOUCH_OPERATION_H_