Add ENABLE_MEDIA_ROUTER define to builds other than Android and iOS.
[chromium-blink-merge.git] / chrome / browser / chromeos / drive / file_system / touch_operation.h
blob15d6849ce13f1543d4378766a05ff4465d83a6f9
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/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/chromeos/drive/file_errors.h"
13 namespace base {
14 class FilePath;
15 class SequencedTaskRunner;
16 class Time;
17 } // namespace base
19 namespace drive {
20 namespace internal {
21 class ResourceMetadata;
22 } // namespace internal
24 class ResourceEntry;
26 namespace file_system {
28 class OperationDelegate;
30 class TouchOperation {
31 public:
32 TouchOperation(base::SequencedTaskRunner* blocking_task_runner,
33 OperationDelegate* delegate,
34 internal::ResourceMetadata* metadata);
35 ~TouchOperation();
37 // Touches the file by updating last access time and last modified time.
38 // Upon completion, invokes |callback|.
39 // |last_access_time|, |last_modified_time| and |callback| must not be null.
40 void TouchFile(const base::FilePath& file_path,
41 const base::Time& last_access_time,
42 const base::Time& last_modified_time,
43 const FileOperationCallback& callback);
45 private:
46 // Part of TouchFile(). Runs after updating the local state.
47 void TouchFileAfterUpdateLocalState(const base::FilePath& file_path,
48 const FileOperationCallback& callback,
49 const ResourceEntry* entry,
50 FileError error);
52 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
53 OperationDelegate* delegate_;
54 internal::ResourceMetadata* metadata_;
56 // Note: This should remain the last member so it'll be destroyed and
57 // invalidate the weak pointers before any other members are destroyed.
58 base::WeakPtrFactory<TouchOperation> weak_ptr_factory_;
59 DISALLOW_COPY_AND_ASSIGN(TouchOperation);
62 } // namespace file_system
63 } // namespace drive
65 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_TOUCH_OPERATION_H_