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_COPY_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_COPY_OPERATION_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_COPY_OPERATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_COPY_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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 class MoveOperation; | 33 class MoveOperation; |
34 class OperationObserver; | 34 class OperationObserver; |
35 | 35 |
36 // This class encapsulates the drive Copy function. It is responsible for | 36 // This class encapsulates the drive Copy function. It is responsible for |
37 // sending the request to the drive API, then updating the local state and | 37 // sending the request to the drive API, then updating the local state and |
38 // metadata to reflect the new state. | 38 // metadata to reflect the new state. |
39 class CopyOperation { | 39 class CopyOperation { |
40 public: | 40 public: |
41 CopyOperation(JobScheduler* job_scheduler, | 41 CopyOperation(JobScheduler* job_scheduler, |
42 DriveFileSystemInterface* drive_file_system, | 42 DriveFileSystemInterface* file_system, |
43 internal::ResourceMetadata* metadata, | 43 internal::ResourceMetadata* metadata, |
44 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, | 44 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, |
45 OperationObserver* observer); | 45 OperationObserver* observer); |
46 virtual ~CopyOperation(); | 46 virtual ~CopyOperation(); |
47 | 47 |
48 // Performs the copy operation on the file at drive path |src_file_path| | 48 // Performs the copy operation on the file at drive path |src_file_path| |
49 // with a target of |dest_file_path|. Invokes |callback| when finished with | 49 // with a target of |dest_file_path|. Invokes |callback| when finished with |
50 // the result of the operation. |callback| must not be null. | 50 // the result of the operation. |callback| must not be null. |
51 virtual void Copy(const base::FilePath& src_file_path, | 51 virtual void Copy(const base::FilePath& src_file_path, |
52 const base::FilePath& dest_file_path, | 52 const base::FilePath& dest_file_path, |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // TransferRegularFile. | 191 // TransferRegularFile. |
192 // | 192 // |
193 // Must be called from *UI* thread. |callback| is run on the calling thread. | 193 // Must be called from *UI* thread. |callback| is run on the calling thread. |
194 // |callback| must not be null. | 194 // |callback| must not be null. |
195 void TransferFileForResourceId(const base::FilePath& local_file_path, | 195 void TransferFileForResourceId(const base::FilePath& local_file_path, |
196 const base::FilePath& remote_dest_file_path, | 196 const base::FilePath& remote_dest_file_path, |
197 const FileOperationCallback& callback, | 197 const FileOperationCallback& callback, |
198 const std::string& resource_id); | 198 const std::string& resource_id); |
199 | 199 |
200 JobScheduler* job_scheduler_; | 200 JobScheduler* job_scheduler_; |
201 DriveFileSystemInterface* drive_file_system_; | 201 DriveFileSystemInterface* file_system_; |
202 internal::ResourceMetadata* metadata_; | 202 internal::ResourceMetadata* metadata_; |
203 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 203 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
204 OperationObserver* observer_; | 204 OperationObserver* observer_; |
205 | 205 |
206 // Copying a hosted document is internally implemented by using a move. | 206 // Copying a hosted document is internally implemented by using a move. |
207 scoped_ptr<MoveOperation> move_operation_; | 207 scoped_ptr<MoveOperation> move_operation_; |
208 | 208 |
209 // WeakPtrFactory bound to the UI thread. | 209 // WeakPtrFactory bound to the UI thread. |
210 // Note: This should remain the last member so it'll be destroyed and | 210 // Note: This should remain the last member so it'll be destroyed and |
211 // invalidate the weak pointers before any other members are destroyed. | 211 // invalidate the weak pointers before any other members are destroyed. |
212 base::WeakPtrFactory<CopyOperation> weak_ptr_factory_; | 212 base::WeakPtrFactory<CopyOperation> weak_ptr_factory_; |
213 | 213 |
214 DISALLOW_COPY_AND_ASSIGN(CopyOperation); | 214 DISALLOW_COPY_AND_ASSIGN(CopyOperation); |
215 }; | 215 }; |
216 | 216 |
217 } // namespace file_system | 217 } // namespace file_system |
218 } // namespace drive | 218 } // namespace drive |
219 | 219 |
220 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_COPY_OPERATION_H_ | 220 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_COPY_OPERATION_H_ |
OLD | NEW |