| 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/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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 const base::FilePath& temporary_file_directory); | 53 const base::FilePath& temporary_file_directory); |
| 54 ~CopyOperation(); | 54 ~CopyOperation(); |
| 55 | 55 |
| 56 // Performs the copy operation on the file at drive path |src_file_path| | 56 // Performs the copy operation on the file at drive path |src_file_path| |
| 57 // with a target of |dest_file_path|. Invokes |callback| when finished with | 57 // with a target of |dest_file_path|. Invokes |callback| when finished with |
| 58 // the result of the operation. |callback| must not be null. | 58 // the result of the operation. |callback| must not be null. |
| 59 void Copy(const base::FilePath& src_file_path, | 59 void Copy(const base::FilePath& src_file_path, |
| 60 const base::FilePath& dest_file_path, | 60 const base::FilePath& dest_file_path, |
| 61 const FileOperationCallback& callback); | 61 const FileOperationCallback& callback); |
| 62 | 62 |
| 63 // Initiates transfer of |remote_src_file_path| to |local_dest_file_path|. | |
| 64 // |remote_src_file_path| is the virtual source path on the Drive file system. | |
| 65 // |local_dest_file_path| is the destination path on the local file system. | |
| 66 // | |
| 67 // |callback| must not be null. | |
| 68 void TransferFileFromRemoteToLocal(const base::FilePath& remote_src_file_path, | |
| 69 const base::FilePath& local_dest_file_path, | |
| 70 const FileOperationCallback& callback); | |
| 71 | |
| 72 // Initiates transfer of |local_src_file_path| to |remote_dest_file_path|. | 63 // Initiates transfer of |local_src_file_path| to |remote_dest_file_path|. |
| 73 // |local_src_file_path| must be a file from the local file system. | 64 // |local_src_file_path| must be a file from the local file system. |
| 74 // |remote_dest_file_path| is the virtual destination path within Drive file | 65 // |remote_dest_file_path| is the virtual destination path within Drive file |
| 75 // system. | 66 // system. |
| 76 // | 67 // |
| 77 // |callback| must not be null. | 68 // |callback| must not be null. |
| 78 void TransferFileFromLocalToRemote( | 69 void TransferFileFromLocalToRemote( |
| 79 const base::FilePath& local_src_file_path, | 70 const base::FilePath& local_src_file_path, |
| 80 const base::FilePath& remote_dest_file_path, | 71 const base::FilePath& remote_dest_file_path, |
| 81 const FileOperationCallback& callback); | 72 const FileOperationCallback& callback); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 94 void ScheduleTransferRegularFileAfterGetResourceEntry( | 85 void ScheduleTransferRegularFileAfterGetResourceEntry( |
| 95 const base::FilePath& local_file_path, | 86 const base::FilePath& local_file_path, |
| 96 const FileOperationCallback& callback, | 87 const FileOperationCallback& callback, |
| 97 FileError error, | 88 FileError error, |
| 98 scoped_ptr<ResourceEntry> entry); | 89 scoped_ptr<ResourceEntry> entry); |
| 99 void ScheduleTransferRegularFileAfterStore( | 90 void ScheduleTransferRegularFileAfterStore( |
| 100 scoped_ptr<ResourceEntry> entry, | 91 scoped_ptr<ResourceEntry> entry, |
| 101 const FileOperationCallback& callback, | 92 const FileOperationCallback& callback, |
| 102 FileError error); | 93 FileError error); |
| 103 | 94 |
| 104 // Invoked upon completion of GetFileByPath initiated by | |
| 105 // TransferFileFromRemoteToLocal. If GetFileByPath reports no error, calls | |
| 106 // CopyLocalFileOnBlockingPool to copy |local_file_path| to | |
| 107 // |local_dest_file_path|. | |
| 108 void OnGetFileCompleteForTransferFile( | |
| 109 const base::FilePath& local_dest_file_path, | |
| 110 const FileOperationCallback& callback, | |
| 111 FileError error, | |
| 112 const base::FilePath& local_file_path, | |
| 113 scoped_ptr<ResourceEntry> entry); | |
| 114 | |
| 115 // Copies a hosted document with |resource_id| to the directory at |dir_path| | 95 // Copies a hosted document with |resource_id| to the directory at |dir_path| |
| 116 // and names the copied document as |new_name|. | 96 // and names the copied document as |new_name|. |
| 117 void CopyHostedDocumentToDirectory(const base::FilePath& dir_path, | 97 void CopyHostedDocumentToDirectory(const base::FilePath& dir_path, |
| 118 const std::string& resource_id, | 98 const std::string& resource_id, |
| 119 const base::FilePath::StringType& new_name, | 99 const base::FilePath::StringType& new_name, |
| 120 const FileOperationCallback& callback); | 100 const FileOperationCallback& callback); |
| 121 | 101 |
| 122 // Callback for handling document copy attempt. | 102 // Callback for handling document copy attempt. |
| 123 void OnCopyHostedDocumentCompleted( | 103 void OnCopyHostedDocumentCompleted( |
| 124 const base::FilePath& dir_path, | 104 const base::FilePath& dir_path, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // Note: This should remain the last member so it'll be destroyed and | 183 // Note: This should remain the last member so it'll be destroyed and |
| 204 // invalidate the weak pointers before any other members are destroyed. | 184 // invalidate the weak pointers before any other members are destroyed. |
| 205 base::WeakPtrFactory<CopyOperation> weak_ptr_factory_; | 185 base::WeakPtrFactory<CopyOperation> weak_ptr_factory_; |
| 206 DISALLOW_COPY_AND_ASSIGN(CopyOperation); | 186 DISALLOW_COPY_AND_ASSIGN(CopyOperation); |
| 207 }; | 187 }; |
| 208 | 188 |
| 209 } // namespace file_system | 189 } // namespace file_system |
| 210 } // namespace drive | 190 } // namespace drive |
| 211 | 191 |
| 212 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_COPY_OPERATION_H_ | 192 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_COPY_OPERATION_H_ |
| OLD | NEW |