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" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/chromeos/drive/file_errors.h" | 12 #include "chrome/browser/chromeos/drive/file_errors.h" |
13 #include "chrome/browser/drive/drive_service_interface.h" | |
14 #include "google_apis/drive/gdata_errorcode.h" | 13 #include "google_apis/drive/gdata_errorcode.h" |
15 | 14 |
16 namespace base { | 15 namespace base { |
17 class FilePath; | 16 class FilePath; |
18 class SequencedTaskRunner; | 17 class SequencedTaskRunner; |
19 class Time; | 18 class Time; |
20 } // namespace base | 19 } // namespace base |
21 | 20 |
22 namespace google_apis { | 21 namespace google_apis { |
23 class AboutResource; | 22 class AboutResource; |
(...skipping 17 matching lines...) Expand all Loading... |
41 | 40 |
42 // This class encapsulates the drive Copy function. It is responsible for | 41 // This class encapsulates the drive Copy function. It is responsible for |
43 // sending the request to the drive API, then updating the local state and | 42 // sending the request to the drive API, then updating the local state and |
44 // metadata to reflect the new state. | 43 // metadata to reflect the new state. |
45 class CopyOperation { | 44 class CopyOperation { |
46 public: | 45 public: |
47 CopyOperation(base::SequencedTaskRunner* blocking_task_runner, | 46 CopyOperation(base::SequencedTaskRunner* blocking_task_runner, |
48 OperationDelegate* delegate, | 47 OperationDelegate* delegate, |
49 JobScheduler* scheduler, | 48 JobScheduler* scheduler, |
50 internal::ResourceMetadata* metadata, | 49 internal::ResourceMetadata* metadata, |
51 internal::FileCache* cache, | 50 internal::FileCache* cache); |
52 const ResourceIdCanonicalizer& id_canonicalizer); | |
53 ~CopyOperation(); | 51 ~CopyOperation(); |
54 | 52 |
55 // Performs the copy operation on the file at drive path |src_file_path| | 53 // Performs the copy operation on the file at drive path |src_file_path| |
56 // with a target of |dest_file_path|. | 54 // with a target of |dest_file_path|. |
57 // If |preserve_last_modified| is set to true, this tries to preserve | 55 // If |preserve_last_modified| is set to true, this tries to preserve |
58 // last modified time stamp. This is supported only on Drive API v2. | 56 // last modified time stamp. This is supported only on Drive API v2. |
59 // Invokes |callback| when finished with the result of the operation. | 57 // Invokes |callback| when finished with the result of the operation. |
60 // |callback| must not be null. | 58 // |callback| must not be null. |
61 void Copy(const base::FilePath& src_file_path, | 59 void Copy(const base::FilePath& src_file_path, |
62 const base::FilePath& dest_file_path, | 60 const base::FilePath& dest_file_path, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 const base::FilePath& remote_dest_path, | 153 const base::FilePath& remote_dest_path, |
156 const ResourceEntry* entry, | 154 const ResourceEntry* entry, |
157 std::string* local_id, | 155 std::string* local_id, |
158 FileError error); | 156 FileError error); |
159 | 157 |
160 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 158 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
161 OperationDelegate* delegate_; | 159 OperationDelegate* delegate_; |
162 JobScheduler* scheduler_; | 160 JobScheduler* scheduler_; |
163 internal::ResourceMetadata* metadata_; | 161 internal::ResourceMetadata* metadata_; |
164 internal::FileCache* cache_; | 162 internal::FileCache* cache_; |
165 ResourceIdCanonicalizer id_canonicalizer_; | |
166 | 163 |
167 // Uploading a new file is internally implemented by creating a dirty file. | 164 // Uploading a new file is internally implemented by creating a dirty file. |
168 scoped_ptr<CreateFileOperation> create_file_operation_; | 165 scoped_ptr<CreateFileOperation> create_file_operation_; |
169 | 166 |
170 // Note: This should remain the last member so it'll be destroyed and | 167 // Note: This should remain the last member so it'll be destroyed and |
171 // invalidate the weak pointers before any other members are destroyed. | 168 // invalidate the weak pointers before any other members are destroyed. |
172 base::WeakPtrFactory<CopyOperation> weak_ptr_factory_; | 169 base::WeakPtrFactory<CopyOperation> weak_ptr_factory_; |
173 DISALLOW_COPY_AND_ASSIGN(CopyOperation); | 170 DISALLOW_COPY_AND_ASSIGN(CopyOperation); |
174 }; | 171 }; |
175 | 172 |
176 } // namespace file_system | 173 } // namespace file_system |
177 } // namespace drive | 174 } // namespace drive |
178 | 175 |
179 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_COPY_OPERATION_H_ | 176 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_COPY_OPERATION_H_ |
OLD | NEW |