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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" | 11 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" |
12 #include "chrome/browser/google_apis/gdata_errorcode.h" | 12 #include "chrome/browser/google_apis/gdata_errorcode.h" |
13 | 13 |
14 class GURL; | 14 class GURL; |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class FilePath; | 17 class FilePath; |
18 } | 18 } |
19 | 19 |
20 namespace drive { | 20 namespace drive { |
21 | 21 |
22 class DriveCache; | 22 class DriveCache; |
23 class DriveEntryProto; | 23 class DriveEntryProto; |
24 class DriveResourceMetadata; | 24 class DriveResourceMetadata; |
25 class DriveScheduler; | 25 class JobScheduler; |
26 | 26 |
27 namespace file_system { | 27 namespace file_system { |
28 | 28 |
29 class OperationObserver; | 29 class OperationObserver; |
30 | 30 |
31 // This class encapsulates the drive Move function. It is responsible for | 31 // This class encapsulates the drive Move function. It is responsible for |
32 // sending the request to the drive API, then updating the local state and | 32 // sending the request to the drive API, then updating the local state and |
33 // metadata to reflect the new state. | 33 // metadata to reflect the new state. |
34 class MoveOperation { | 34 class MoveOperation { |
35 public: | 35 public: |
36 MoveOperation(DriveScheduler* drive_scheduler, | 36 MoveOperation(JobScheduler* job_scheduler, |
37 DriveResourceMetadata* metadata, | 37 DriveResourceMetadata* metadata, |
38 OperationObserver* observer); | 38 OperationObserver* observer); |
39 virtual ~MoveOperation(); | 39 virtual ~MoveOperation(); |
40 | 40 |
41 // Performs the move operation on the file at drive path |src_file_path| | 41 // Performs the move operation on the file at drive path |src_file_path| |
42 // with a target of |dest_file_path|. Invokes |callback| when finished with | 42 // with a target of |dest_file_path|. Invokes |callback| when finished with |
43 // the result of the operation. |callback| must not be null. | 43 // the result of the operation. |callback| must not be null. |
44 virtual void Move(const base::FilePath& src_file_path, | 44 virtual void Move(const base::FilePath& src_file_path, |
45 const base::FilePath& dest_file_path, | 45 const base::FilePath& dest_file_path, |
46 const FileOperationCallback& callback); | 46 const FileOperationCallback& callback); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 // Removes a resource |resource_id| from |directory_resource_id|. | 112 // Removes a resource |resource_id| from |directory_resource_id|. |
113 void RemoveFromDirectory(const std::string& resource_id, | 113 void RemoveFromDirectory(const std::string& resource_id, |
114 const std::string& directory_resource_id, | 114 const std::string& directory_resource_id, |
115 const FileOperationCallback& callback); | 115 const FileOperationCallback& callback); |
116 | 116 |
117 // Called in RemoveFromDirectory(). | 117 // Called in RemoveFromDirectory(). |
118 void RemoveFromDirectoryCompleted(const FileOperationCallback& callback, | 118 void RemoveFromDirectoryCompleted(const FileOperationCallback& callback, |
119 google_apis::GDataErrorCode status); | 119 google_apis::GDataErrorCode status); |
120 | 120 |
121 DriveScheduler* drive_scheduler_; | 121 JobScheduler* job_scheduler_; |
122 DriveResourceMetadata* metadata_; | 122 DriveResourceMetadata* metadata_; |
123 OperationObserver* observer_; | 123 OperationObserver* observer_; |
124 | 124 |
125 // WeakPtrFactory bound to the UI thread. | 125 // WeakPtrFactory bound to the UI thread. |
126 // Note: This should remain the last member so it'll be destroyed and | 126 // Note: This should remain the last member so it'll be destroyed and |
127 // invalidate the weak pointers before any other members are destroyed. | 127 // invalidate the weak pointers before any other members are destroyed. |
128 base::WeakPtrFactory<MoveOperation> weak_ptr_factory_; | 128 base::WeakPtrFactory<MoveOperation> weak_ptr_factory_; |
129 DISALLOW_COPY_AND_ASSIGN(MoveOperation); | 129 DISALLOW_COPY_AND_ASSIGN(MoveOperation); |
130 }; | 130 }; |
131 | 131 |
132 } // namespace file_system | 132 } // namespace file_system |
133 } // namespace drive | 133 } // namespace drive |
134 | 134 |
135 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_MOVE_OPERATION_H_ | 135 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_MOVE_OPERATION_H_ |
OLD | NEW |