Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / chromeos / drive / file_system / touch_operation.h
blob7a1cb3183f956de2068c6e91d8c31741ca953f68
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_TOUCH_OPERATION_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_TOUCH_OPERATION_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/chromeos/drive/file_errors.h"
13 #include "google_apis/drive/gdata_errorcode.h"
15 namespace base {
16 class FilePath;
17 class SequencedTaskRunner;
18 class Time;
19 } // namespace base
21 namespace google_apis {
22 class ResourceEntry;
23 } // namespace google_apis
25 namespace drive {
26 namespace internal {
27 class ResourceMetadata;
28 } // namespace internal
30 class ResourceEntry;
32 namespace file_system {
34 class OperationObserver;
36 class TouchOperation {
37 public:
38 TouchOperation(base::SequencedTaskRunner* blocking_task_runner,
39 OperationObserver* observer,
40 internal::ResourceMetadata* metadata);
41 ~TouchOperation();
43 // Touches the file by updating last access time and last modified time.
44 // Upon completion, invokes |callback|.
45 // |last_access_time|, |last_modified_time| and |callback| must not be null.
46 void TouchFile(const base::FilePath& file_path,
47 const base::Time& last_access_time,
48 const base::Time& last_modified_time,
49 const FileOperationCallback& callback);
51 private:
52 // Part of TouchFile(). Runs after updating the local state.
53 void TouchFileAfterUpdateLocalState(const base::FilePath& file_path,
54 const FileOperationCallback& callback,
55 const std::string* local_id,
56 FileError error);
58 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
59 OperationObserver* observer_;
60 internal::ResourceMetadata* metadata_;
62 // Note: This should remain the last member so it'll be destroyed and
63 // invalidate the weak pointers before any other members are destroyed.
64 base::WeakPtrFactory<TouchOperation> weak_ptr_factory_;
65 DISALLOW_COPY_AND_ASSIGN(TouchOperation);
68 } // namespace file_system
69 } // namespace drive
71 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_TOUCH_OPERATION_H_