| 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" |
| 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 class Value; | 18 class Value; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace google_apis { | 21 namespace google_apis { |
| 22 class DriveUploaderInterface; | |
| 23 class ResourceEntry; | 22 class ResourceEntry; |
| 24 } | 23 } |
| 25 | 24 |
| 26 namespace drive { | 25 namespace drive { |
| 27 | 26 |
| 28 class DriveEntryProto; | 27 class DriveEntryProto; |
| 29 class DriveFileSystemInterface; | 28 class DriveFileSystemInterface; |
| 30 class DriveScheduler; | 29 class DriveScheduler; |
| 31 | 30 |
| 32 namespace file_system { | 31 namespace file_system { |
| 33 | 32 |
| 34 class MoveOperation; | 33 class MoveOperation; |
| 35 class OperationObserver; | 34 class OperationObserver; |
| 36 | 35 |
| 37 // This class encapsulates the drive Copy function. It is responsible for | 36 // This class encapsulates the drive Copy function. It is responsible for |
| 38 // 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 |
| 39 // metadata to reflect the new state. | 38 // metadata to reflect the new state. |
| 40 class CopyOperation { | 39 class CopyOperation { |
| 41 public: | 40 public: |
| 42 CopyOperation(DriveScheduler* drive_scheduler, | 41 CopyOperation(DriveScheduler* drive_scheduler, |
| 43 DriveFileSystemInterface* drive_file_system, | 42 DriveFileSystemInterface* drive_file_system, |
| 44 DriveResourceMetadata* metadata, | 43 DriveResourceMetadata* metadata, |
| 45 google_apis::DriveUploaderInterface* uploader, | |
| 46 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, | 44 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, |
| 47 OperationObserver* observer); | 45 OperationObserver* observer); |
| 48 virtual ~CopyOperation(); | 46 virtual ~CopyOperation(); |
| 49 | 47 |
| 50 // 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| |
| 51 // 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 |
| 52 // the result of the operation. |callback| must not be null. | 50 // the result of the operation. |callback| must not be null. |
| 53 virtual void Copy(const base::FilePath& src_file_path, | 51 virtual void Copy(const base::FilePath& src_file_path, |
| 54 const base::FilePath& dest_file_path, | 52 const base::FilePath& dest_file_path, |
| 55 const FileOperationCallback& callback); | 53 const FileOperationCallback& callback); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // 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. |
| 196 // |callback| must not be null. | 194 // |callback| must not be null. |
| 197 void TransferFileForResourceId(const base::FilePath& local_file_path, | 195 void TransferFileForResourceId(const base::FilePath& local_file_path, |
| 198 const base::FilePath& remote_dest_file_path, | 196 const base::FilePath& remote_dest_file_path, |
| 199 const FileOperationCallback& callback, | 197 const FileOperationCallback& callback, |
| 200 const std::string& resource_id); | 198 const std::string& resource_id); |
| 201 | 199 |
| 202 DriveScheduler* drive_scheduler_; | 200 DriveScheduler* drive_scheduler_; |
| 203 DriveFileSystemInterface* drive_file_system_; | 201 DriveFileSystemInterface* drive_file_system_; |
| 204 DriveResourceMetadata* metadata_; | 202 DriveResourceMetadata* metadata_; |
| 205 google_apis::DriveUploaderInterface* uploader_; | |
| 206 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 203 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 207 OperationObserver* observer_; | 204 OperationObserver* observer_; |
| 208 | 205 |
| 209 // Copying a hosted document is internally implemented by using a move. | 206 // Copying a hosted document is internally implemented by using a move. |
| 210 scoped_ptr<MoveOperation> move_operation_; | 207 scoped_ptr<MoveOperation> move_operation_; |
| 211 | 208 |
| 212 // WeakPtrFactory bound to the UI thread. | 209 // WeakPtrFactory bound to the UI thread. |
| 213 // 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 |
| 214 // invalidate the weak pointers before any other members are destroyed. | 211 // invalidate the weak pointers before any other members are destroyed. |
| 215 base::WeakPtrFactory<CopyOperation> weak_ptr_factory_; | 212 base::WeakPtrFactory<CopyOperation> weak_ptr_factory_; |
| 216 | 213 |
| 217 DISALLOW_COPY_AND_ASSIGN(CopyOperation); | 214 DISALLOW_COPY_AND_ASSIGN(CopyOperation); |
| 218 }; | 215 }; |
| 219 | 216 |
| 220 } // namespace file_system | 217 } // namespace file_system |
| 221 } // namespace drive | 218 } // namespace drive |
| 222 | 219 |
| 223 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_COPY_OPERATION_H_ | 220 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_COPY_OPERATION_H_ |
| OLD | NEW |