| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_TOUCH_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_TOUCH_OPERATION_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_TOUCH_OPERATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_TOUCH_OPERATION_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace drive { | 25 namespace drive { |
| 26 namespace internal { | 26 namespace internal { |
| 27 class ResourceMetadata; | 27 class ResourceMetadata; |
| 28 } // namespace internal | 28 } // namespace internal |
| 29 | 29 |
| 30 class ResourceEntry; | 30 class ResourceEntry; |
| 31 | 31 |
| 32 namespace file_system { | 32 namespace file_system { |
| 33 | 33 |
| 34 class OperationObserver; | 34 class OperationDelegate; |
| 35 | 35 |
| 36 class TouchOperation { | 36 class TouchOperation { |
| 37 public: | 37 public: |
| 38 TouchOperation(base::SequencedTaskRunner* blocking_task_runner, | 38 TouchOperation(base::SequencedTaskRunner* blocking_task_runner, |
| 39 OperationObserver* observer, | 39 OperationDelegate* delegate, |
| 40 internal::ResourceMetadata* metadata); | 40 internal::ResourceMetadata* metadata); |
| 41 ~TouchOperation(); | 41 ~TouchOperation(); |
| 42 | 42 |
| 43 // Touches the file by updating last access time and last modified time. | 43 // Touches the file by updating last access time and last modified time. |
| 44 // Upon completion, invokes |callback|. | 44 // Upon completion, invokes |callback|. |
| 45 // |last_access_time|, |last_modified_time| and |callback| must not be null. | 45 // |last_access_time|, |last_modified_time| and |callback| must not be null. |
| 46 void TouchFile(const base::FilePath& file_path, | 46 void TouchFile(const base::FilePath& file_path, |
| 47 const base::Time& last_access_time, | 47 const base::Time& last_access_time, |
| 48 const base::Time& last_modified_time, | 48 const base::Time& last_modified_time, |
| 49 const FileOperationCallback& callback); | 49 const FileOperationCallback& callback); |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 // Part of TouchFile(). Runs after updating the local state. | 52 // Part of TouchFile(). Runs after updating the local state. |
| 53 void TouchFileAfterUpdateLocalState(const base::FilePath& file_path, | 53 void TouchFileAfterUpdateLocalState(const base::FilePath& file_path, |
| 54 const FileOperationCallback& callback, | 54 const FileOperationCallback& callback, |
| 55 const ResourceEntry* entry, | 55 const ResourceEntry* entry, |
| 56 const std::string* local_id, | 56 const std::string* local_id, |
| 57 FileError error); | 57 FileError error); |
| 58 | 58 |
| 59 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 59 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 60 OperationObserver* observer_; | 60 OperationDelegate* delegate_; |
| 61 internal::ResourceMetadata* metadata_; | 61 internal::ResourceMetadata* metadata_; |
| 62 | 62 |
| 63 // Note: This should remain the last member so it'll be destroyed and | 63 // Note: This should remain the last member so it'll be destroyed and |
| 64 // invalidate the weak pointers before any other members are destroyed. | 64 // invalidate the weak pointers before any other members are destroyed. |
| 65 base::WeakPtrFactory<TouchOperation> weak_ptr_factory_; | 65 base::WeakPtrFactory<TouchOperation> weak_ptr_factory_; |
| 66 DISALLOW_COPY_AND_ASSIGN(TouchOperation); | 66 DISALLOW_COPY_AND_ASSIGN(TouchOperation); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace file_system | 69 } // namespace file_system |
| 70 } // namespace drive | 70 } // namespace drive |
| 71 | 71 |
| 72 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_TOUCH_OPERATION_H_ | 72 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_TOUCH_OPERATION_H_ |
| OLD | NEW |