OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_MOVE_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_MOVE_OPERATION_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_MOVE_OPERATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_MOVE_OPERATION_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 class FileChange; | 28 class FileChange; |
29 class ResourceEntry; | 29 class ResourceEntry; |
30 | 30 |
31 namespace internal { | 31 namespace internal { |
32 class ResourceMetadata; | 32 class ResourceMetadata; |
33 } // namespace internal | 33 } // namespace internal |
34 | 34 |
35 namespace file_system { | 35 namespace file_system { |
36 | 36 |
37 class OperationObserver; | 37 class OperationDelegate; |
38 | 38 |
39 // This class encapsulates the drive Move function. It is responsible for | 39 // This class encapsulates the drive Move function. It is responsible for |
40 // updating the local metadata entry. | 40 // updating the local metadata entry. |
41 class MoveOperation { | 41 class MoveOperation { |
42 public: | 42 public: |
43 MoveOperation(base::SequencedTaskRunner* blocking_task_runner, | 43 MoveOperation(base::SequencedTaskRunner* blocking_task_runner, |
44 OperationObserver* observer, | 44 OperationDelegate* delegate, |
45 internal::ResourceMetadata* metadata); | 45 internal::ResourceMetadata* metadata); |
46 ~MoveOperation(); | 46 ~MoveOperation(); |
47 | 47 |
48 // Performs the move operation on the file at drive path |src_file_path| | 48 // Performs the move operation on the file at drive path |src_file_path| |
49 // with a target of |dest_file_path|. | 49 // with a target of |dest_file_path|. |
50 // Invokes |callback| when finished with the result of the operation. | 50 // Invokes |callback| when finished with the result of the operation. |
51 // |callback| must not be null. | 51 // |callback| must not be null. |
52 void Move(const base::FilePath& src_file_path, | 52 void Move(const base::FilePath& src_file_path, |
53 const base::FilePath& dest_file_path, | 53 const base::FilePath& dest_file_path, |
54 const FileOperationCallback& callback); | 54 const FileOperationCallback& callback); |
55 | 55 |
56 private: | 56 private: |
57 // Part of Move(). Called after updating the local state. | 57 // Part of Move(). Called after updating the local state. |
58 void MoveAfterUpdateLocalState(const FileOperationCallback& callback, | 58 void MoveAfterUpdateLocalState(const FileOperationCallback& callback, |
59 const FileChange* changed_file, | 59 const FileChange* changed_file, |
60 const std::string* local_id, | 60 const std::string* local_id, |
61 FileError error); | 61 FileError error); |
62 | 62 |
63 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 63 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
64 OperationObserver* observer_; | 64 OperationDelegate* delegate_; |
65 internal::ResourceMetadata* metadata_; | 65 internal::ResourceMetadata* metadata_; |
66 | 66 |
67 // Note: This should remain the last member so it'll be destroyed and | 67 // Note: This should remain the last member so it'll be destroyed and |
68 // invalidate the weak pointers before any other members are destroyed. | 68 // invalidate the weak pointers before any other members are destroyed. |
69 base::WeakPtrFactory<MoveOperation> weak_ptr_factory_; | 69 base::WeakPtrFactory<MoveOperation> weak_ptr_factory_; |
70 DISALLOW_COPY_AND_ASSIGN(MoveOperation); | 70 DISALLOW_COPY_AND_ASSIGN(MoveOperation); |
71 }; | 71 }; |
72 | 72 |
73 } // namespace file_system | 73 } // namespace file_system |
74 } // namespace drive | 74 } // namespace drive |
75 | 75 |
76 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_MOVE_OPERATION_H_ | 76 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_MOVE_OPERATION_H_ |
OLD | NEW |