OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_TO_LOCAL_SYNCER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_TO_LOCAL_SYNCER_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_TO_LOCAL_SYNCER_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_TO_LOCAL_SYNCER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h" | 13 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h" |
14 #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" | 14 #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" |
15 #include "chrome/browser/sync_file_system/remote_change_processor.h" | 15 #include "chrome/browser/sync_file_system/remote_change_processor.h" |
16 #include "chrome/browser/sync_file_system/sync_action.h" | 16 #include "chrome/browser/sync_file_system/sync_action.h" |
17 #include "chrome/browser/sync_file_system/sync_callbacks.h" | 17 #include "chrome/browser/sync_file_system/sync_callbacks.h" |
18 #include "chrome/browser/sync_file_system/sync_file_metadata.h" | 18 #include "chrome/browser/sync_file_system/sync_file_metadata.h" |
19 #include "google_apis/drive/gdata_errorcode.h" | 19 #include "google_apis/drive/gdata_errorcode.h" |
20 #include "webkit/browser/fileapi/file_system_url.h" | 20 #include "storage/browser/fileapi/file_system_url.h" |
21 | 21 |
22 namespace drive { | 22 namespace drive { |
23 class DriveServiceInterface; | 23 class DriveServiceInterface; |
24 } | 24 } |
25 | 25 |
26 namespace google_apis { | 26 namespace google_apis { |
27 class FileList; | 27 class FileList; |
28 class FileResource; | 28 class FileResource; |
29 class ResourceEntry; | 29 class ResourceEntry; |
30 } | 30 } |
31 | 31 |
32 namespace webkit_blob { | 32 namespace storage { |
33 class ScopedFile; | 33 class ScopedFile; |
34 } | 34 } |
35 | 35 |
36 namespace sync_file_system { | 36 namespace sync_file_system { |
37 namespace drive_backend { | 37 namespace drive_backend { |
38 | 38 |
39 class MetadataDatabase; | 39 class MetadataDatabase; |
40 class SyncEngineContext; | 40 class SyncEngineContext; |
41 | 41 |
42 class RemoteToLocalSyncer : public SyncTask { | 42 class RemoteToLocalSyncer : public SyncTask { |
43 public: | 43 public: |
44 // Conflicting trackers will have low priority for RemoteToLocalSyncer so that | 44 // Conflicting trackers will have low priority for RemoteToLocalSyncer so that |
45 // it should be resolved by LocatToRemoteSyncer. | 45 // it should be resolved by LocatToRemoteSyncer. |
46 explicit RemoteToLocalSyncer(SyncEngineContext* sync_context); | 46 explicit RemoteToLocalSyncer(SyncEngineContext* sync_context); |
47 virtual ~RemoteToLocalSyncer(); | 47 virtual ~RemoteToLocalSyncer(); |
48 | 48 |
49 virtual void RunPreflight(scoped_ptr<SyncTaskToken> token) OVERRIDE; | 49 virtual void RunPreflight(scoped_ptr<SyncTaskToken> token) OVERRIDE; |
50 void RunExclusive(scoped_ptr<SyncTaskToken> token); | 50 void RunExclusive(scoped_ptr<SyncTaskToken> token); |
51 | 51 |
52 const fileapi::FileSystemURL& url() const { return url_; } | 52 const storage::FileSystemURL& url() const { return url_; } |
53 SyncAction sync_action() const { return sync_action_; } | 53 SyncAction sync_action() const { return sync_action_; } |
54 | 54 |
55 bool is_sync_root_deletion() const { return sync_root_deletion_; } | 55 bool is_sync_root_deletion() const { return sync_root_deletion_; } |
56 | 56 |
57 private: | 57 private: |
58 typedef std::vector<std::string> FileIDList; | 58 typedef std::vector<std::string> FileIDList; |
59 | 59 |
60 // TODO(tzik): Update documentation here. | 60 // TODO(tzik): Update documentation here. |
61 // | 61 // |
62 // Dispatches remote change to handlers or to SyncCompleted() directly. | 62 // Dispatches remote change to handlers or to SyncCompleted() directly. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 void Prepare(const SyncStatusCallback& callback); | 168 void Prepare(const SyncStatusCallback& callback); |
169 void DidPrepare(const SyncStatusCallback& callback, | 169 void DidPrepare(const SyncStatusCallback& callback, |
170 SyncStatusCode status, | 170 SyncStatusCode status, |
171 const SyncFileMetadata& metadata, | 171 const SyncFileMetadata& metadata, |
172 const FileChangeList& changes); | 172 const FileChangeList& changes); |
173 | 173 |
174 void DeleteLocalFile(scoped_ptr<SyncTaskToken> token); | 174 void DeleteLocalFile(scoped_ptr<SyncTaskToken> token); |
175 void DownloadFile(scoped_ptr<SyncTaskToken> token); | 175 void DownloadFile(scoped_ptr<SyncTaskToken> token); |
176 void DidDownloadFile(scoped_ptr<SyncTaskToken> token, | 176 void DidDownloadFile(scoped_ptr<SyncTaskToken> token, |
177 webkit_blob::ScopedFile file, | 177 storage::ScopedFile file, |
178 google_apis::GDataErrorCode error, | 178 google_apis::GDataErrorCode error, |
179 const base::FilePath&); | 179 const base::FilePath&); |
180 void DidApplyDownload(scoped_ptr<SyncTaskToken> token, | 180 void DidApplyDownload(scoped_ptr<SyncTaskToken> token, |
181 webkit_blob::ScopedFile, | 181 storage::ScopedFile, |
182 SyncStatusCode status); | 182 SyncStatusCode status); |
183 | 183 |
184 void CreateFolder(scoped_ptr<SyncTaskToken> token); | 184 void CreateFolder(scoped_ptr<SyncTaskToken> token); |
185 | 185 |
186 // TODO(tzik): After we convert all callbacks to token-passing style, | 186 // TODO(tzik): After we convert all callbacks to token-passing style, |
187 // drop this function. | 187 // drop this function. |
188 SyncStatusCallback SyncCompletedCallback(scoped_ptr<SyncTaskToken> token); | 188 SyncStatusCallback SyncCompletedCallback(scoped_ptr<SyncTaskToken> token); |
189 | 189 |
190 drive::DriveServiceInterface* drive_service(); | 190 drive::DriveServiceInterface* drive_service(); |
191 MetadataDatabase* metadata_database(); | 191 MetadataDatabase* metadata_database(); |
192 RemoteChangeProcessor* remote_change_processor(); | 192 RemoteChangeProcessor* remote_change_processor(); |
193 | 193 |
194 SyncEngineContext* sync_context_; // Not owned. | 194 SyncEngineContext* sync_context_; // Not owned. |
195 | 195 |
196 scoped_ptr<FileTracker> dirty_tracker_; | 196 scoped_ptr<FileTracker> dirty_tracker_; |
197 scoped_ptr<FileMetadata> remote_metadata_; | 197 scoped_ptr<FileMetadata> remote_metadata_; |
198 | 198 |
199 fileapi::FileSystemURL url_; | 199 storage::FileSystemURL url_; |
200 SyncAction sync_action_; | 200 SyncAction sync_action_; |
201 | 201 |
202 bool prepared_; | 202 bool prepared_; |
203 bool sync_root_deletion_; | 203 bool sync_root_deletion_; |
204 | 204 |
205 scoped_ptr<SyncFileMetadata> local_metadata_; | 205 scoped_ptr<SyncFileMetadata> local_metadata_; |
206 scoped_ptr<FileChangeList> local_changes_; | 206 scoped_ptr<FileChangeList> local_changes_; |
207 | 207 |
208 base::WeakPtrFactory<RemoteToLocalSyncer> weak_ptr_factory_; | 208 base::WeakPtrFactory<RemoteToLocalSyncer> weak_ptr_factory_; |
209 | 209 |
210 DISALLOW_COPY_AND_ASSIGN(RemoteToLocalSyncer); | 210 DISALLOW_COPY_AND_ASSIGN(RemoteToLocalSyncer); |
211 }; | 211 }; |
212 | 212 |
213 } // namespace drive_backend | 213 } // namespace drive_backend |
214 } // namespace sync_file_system | 214 } // namespace sync_file_system |
215 | 215 |
216 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_TO_LOCAL_SYNCER_
H_ | 216 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_TO_LOCAL_SYNCER_
H_ |
OLD | NEW |