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 19 matching lines...) Expand all Loading... |
30 class ResourceEntry; | 30 class ResourceEntry; |
31 | 31 |
32 namespace internal { | 32 namespace internal { |
33 class FileCache; | 33 class FileCache; |
34 class ResourceMetadata; | 34 class ResourceMetadata; |
35 } // namespace internal | 35 } // namespace internal |
36 | 36 |
37 namespace file_system { | 37 namespace file_system { |
38 | 38 |
39 class CreateFileOperation; | 39 class CreateFileOperation; |
40 class OperationObserver; | 40 class OperationDelegate; |
41 | 41 |
42 // This class encapsulates the drive Copy function. It is responsible for | 42 // 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 | 43 // sending the request to the drive API, then updating the local state and |
44 // metadata to reflect the new state. | 44 // metadata to reflect the new state. |
45 class CopyOperation { | 45 class CopyOperation { |
46 public: | 46 public: |
47 CopyOperation(base::SequencedTaskRunner* blocking_task_runner, | 47 CopyOperation(base::SequencedTaskRunner* blocking_task_runner, |
48 OperationObserver* observer, | 48 OperationDelegate* delegate, |
49 JobScheduler* scheduler, | 49 JobScheduler* scheduler, |
50 internal::ResourceMetadata* metadata, | 50 internal::ResourceMetadata* metadata, |
51 internal::FileCache* cache, | 51 internal::FileCache* cache, |
52 const ResourceIdCanonicalizer& id_canonicalizer); | 52 const ResourceIdCanonicalizer& id_canonicalizer); |
53 ~CopyOperation(); | 53 ~CopyOperation(); |
54 | 54 |
55 // Performs the copy operation on the file at drive path |src_file_path| | 55 // Performs the copy operation on the file at drive path |src_file_path| |
56 // with a target of |dest_file_path|. | 56 // with a target of |dest_file_path|. |
57 // If |preserve_last_modified| is set to true, this tries to preserve | 57 // 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. | 58 // last modified time stamp. This is supported only on Drive API v2. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // Part of ScheduleTransferRegularFile(). Called after updating local state | 151 // Part of ScheduleTransferRegularFile(). Called after updating local state |
152 // is completed. | 152 // is completed. |
153 void ScheduleTransferRegularFileAfterUpdateLocalState( | 153 void ScheduleTransferRegularFileAfterUpdateLocalState( |
154 const FileOperationCallback& callback, | 154 const FileOperationCallback& callback, |
155 const base::FilePath& remote_dest_path, | 155 const base::FilePath& remote_dest_path, |
156 const ResourceEntry* entry, | 156 const ResourceEntry* entry, |
157 std::string* local_id, | 157 std::string* local_id, |
158 FileError error); | 158 FileError error); |
159 | 159 |
160 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 160 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
161 OperationObserver* observer_; | 161 OperationDelegate* delegate_; |
162 JobScheduler* scheduler_; | 162 JobScheduler* scheduler_; |
163 internal::ResourceMetadata* metadata_; | 163 internal::ResourceMetadata* metadata_; |
164 internal::FileCache* cache_; | 164 internal::FileCache* cache_; |
165 ResourceIdCanonicalizer id_canonicalizer_; | 165 ResourceIdCanonicalizer id_canonicalizer_; |
166 | 166 |
167 // Uploading a new file is internally implemented by creating a dirty file. | 167 // Uploading a new file is internally implemented by creating a dirty file. |
168 scoped_ptr<CreateFileOperation> create_file_operation_; | 168 scoped_ptr<CreateFileOperation> create_file_operation_; |
169 | 169 |
170 // Note: This should remain the last member so it'll be destroyed and | 170 // Note: This should remain the last member so it'll be destroyed and |
171 // invalidate the weak pointers before any other members are destroyed. | 171 // invalidate the weak pointers before any other members are destroyed. |
172 base::WeakPtrFactory<CopyOperation> weak_ptr_factory_; | 172 base::WeakPtrFactory<CopyOperation> weak_ptr_factory_; |
173 DISALLOW_COPY_AND_ASSIGN(CopyOperation); | 173 DISALLOW_COPY_AND_ASSIGN(CopyOperation); |
174 }; | 174 }; |
175 | 175 |
176 } // namespace file_system | 176 } // namespace file_system |
177 } // namespace drive | 177 } // namespace drive |
178 | 178 |
179 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_COPY_OPERATION_H_ | 179 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_COPY_OPERATION_H_ |
OLD | NEW |