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/drive_backend/sync_task_manager.h" | 15 #include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" |
16 #include "chrome/browser/sync_file_system/remote_change_processor.h" | 16 #include "chrome/browser/sync_file_system/remote_change_processor.h" |
17 #include "chrome/browser/sync_file_system/sync_action.h" | 17 #include "chrome/browser/sync_file_system/sync_action.h" |
18 #include "chrome/browser/sync_file_system/sync_callbacks.h" | 18 #include "chrome/browser/sync_file_system/sync_callbacks.h" |
19 #include "chrome/browser/sync_file_system/sync_file_metadata.h" | 19 #include "chrome/browser/sync_file_system/sync_file_metadata.h" |
20 #include "google_apis/drive/gdata_errorcode.h" | 20 #include "google_apis/drive/drive_api_error_codes.h" |
21 #include "storage/browser/fileapi/file_system_url.h" | 21 #include "storage/browser/fileapi/file_system_url.h" |
22 | 22 |
23 namespace drive { | 23 namespace drive { |
24 class DriveServiceInterface; | 24 class DriveServiceInterface; |
25 } | 25 } |
26 | 26 |
27 namespace google_apis { | 27 namespace google_apis { |
28 class FileList; | 28 class FileList; |
29 class FileResource; | 29 class FileResource; |
30 } | 30 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 const Continuation& continuation); | 109 const Continuation& continuation); |
110 void ContinueAsBackgroundTask(const Continuation& continuation, | 110 void ContinueAsBackgroundTask(const Continuation& continuation, |
111 scoped_ptr<SyncTaskToken> token); | 111 scoped_ptr<SyncTaskToken> token); |
112 | 112 |
113 // Handles missing remote metadata case. | 113 // Handles missing remote metadata case. |
114 // Fetches remote metadata and updates MetadataDatabase by that. The sync | 114 // Fetches remote metadata and updates MetadataDatabase by that. The sync |
115 // operation itself will be deferred to the next sync round. | 115 // operation itself will be deferred to the next sync round. |
116 // Note: if the file is not found, it should be handled as if deleted. | 116 // Note: if the file is not found, it should be handled as if deleted. |
117 void HandleMissingRemoteMetadata(scoped_ptr<SyncTaskToken> token); | 117 void HandleMissingRemoteMetadata(scoped_ptr<SyncTaskToken> token); |
118 void DidGetRemoteMetadata(scoped_ptr<SyncTaskToken> token, | 118 void DidGetRemoteMetadata(scoped_ptr<SyncTaskToken> token, |
119 google_apis::GDataErrorCode error, | 119 google_apis::DriveApiErrorCode error, |
120 scoped_ptr<google_apis::FileResource> entry); | 120 scoped_ptr<google_apis::FileResource> entry); |
121 | 121 |
122 // This implements the body of the HandleNewFile and HandleContentUpdate. | 122 // This implements the body of the HandleNewFile and HandleContentUpdate. |
123 // If the file doesn't have corresponding local file: | 123 // If the file doesn't have corresponding local file: |
124 // - Dispatch to DownloadFile. | 124 // - Dispatch to DownloadFile. |
125 // Else, if the local file doesn't have local change: | 125 // Else, if the local file doesn't have local change: |
126 // - Dispatch to DownloadFile if the local file is a regular file. | 126 // - Dispatch to DownloadFile if the local file is a regular file. |
127 // - If the local file is a folder, handle this case as a conflict. Lower | 127 // - If the local file is a folder, handle this case as a conflict. Lower |
128 // the priority of the tracker, and defer further handling to | 128 // the priority of the tracker, and defer further handling to |
129 // local-to-remote change. | 129 // local-to-remote change. |
(...skipping 28 matching lines...) Expand all Loading... |
158 | 158 |
159 void HandleFileMove(scoped_ptr<SyncTaskToken> token); | 159 void HandleFileMove(scoped_ptr<SyncTaskToken> token); |
160 | 160 |
161 // Handles new file. Needs Prepare() call. | 161 // Handles new file. Needs Prepare() call. |
162 void HandleContentUpdate(scoped_ptr<SyncTaskToken> token); | 162 void HandleContentUpdate(scoped_ptr<SyncTaskToken> token); |
163 | 163 |
164 void ListFolderContent(scoped_ptr<SyncTaskToken> token); | 164 void ListFolderContent(scoped_ptr<SyncTaskToken> token); |
165 void DidListFolderContent( | 165 void DidListFolderContent( |
166 scoped_ptr<SyncTaskToken> token, | 166 scoped_ptr<SyncTaskToken> token, |
167 scoped_ptr<FileIDList> children, | 167 scoped_ptr<FileIDList> children, |
168 google_apis::GDataErrorCode error, | 168 google_apis::DriveApiErrorCode error, |
169 scoped_ptr<google_apis::FileList> file_list); | 169 scoped_ptr<google_apis::FileList> file_list); |
170 | 170 |
171 void SyncCompleted(scoped_ptr<SyncTaskToken> token, SyncStatusCode status); | 171 void SyncCompleted(scoped_ptr<SyncTaskToken> token, SyncStatusCode status); |
172 void FinalizeSync(scoped_ptr<SyncTaskToken> token, SyncStatusCode status); | 172 void FinalizeSync(scoped_ptr<SyncTaskToken> token, SyncStatusCode status); |
173 | 173 |
174 void Prepare(const SyncStatusCallback& callback); | 174 void Prepare(const SyncStatusCallback& callback); |
175 void DidPrepare(const SyncStatusCallback& callback, | 175 void DidPrepare(const SyncStatusCallback& callback, |
176 SyncStatusCode status, | 176 SyncStatusCode status, |
177 const SyncFileMetadata& metadata, | 177 const SyncFileMetadata& metadata, |
178 const FileChangeList& changes); | 178 const FileChangeList& changes); |
179 | 179 |
180 void DeleteLocalFile(scoped_ptr<SyncTaskToken> token); | 180 void DeleteLocalFile(scoped_ptr<SyncTaskToken> token); |
181 void DownloadFile(scoped_ptr<SyncTaskToken> token); | 181 void DownloadFile(scoped_ptr<SyncTaskToken> token); |
182 void DidDownloadFile(scoped_ptr<SyncTaskToken> token, | 182 void DidDownloadFile(scoped_ptr<SyncTaskToken> token, |
183 storage::ScopedFile file, | 183 storage::ScopedFile file, |
184 google_apis::GDataErrorCode error, | 184 google_apis::DriveApiErrorCode error, |
185 const base::FilePath&); | 185 const base::FilePath&); |
186 void DidApplyDownload(scoped_ptr<SyncTaskToken> token, | 186 void DidApplyDownload(scoped_ptr<SyncTaskToken> token, |
187 storage::ScopedFile, | 187 storage::ScopedFile, |
188 SyncStatusCode status); | 188 SyncStatusCode status); |
189 | 189 |
190 void CreateFolder(scoped_ptr<SyncTaskToken> token); | 190 void CreateFolder(scoped_ptr<SyncTaskToken> token); |
191 | 191 |
192 // TODO(tzik): After we convert all callbacks to token-passing style, | 192 // TODO(tzik): After we convert all callbacks to token-passing style, |
193 // drop this function. | 193 // drop this function. |
194 SyncStatusCallback SyncCompletedCallback(scoped_ptr<SyncTaskToken> token); | 194 SyncStatusCallback SyncCompletedCallback(scoped_ptr<SyncTaskToken> token); |
(...skipping 19 matching lines...) Expand all Loading... |
214 | 214 |
215 base::WeakPtrFactory<RemoteToLocalSyncer> weak_ptr_factory_; | 215 base::WeakPtrFactory<RemoteToLocalSyncer> weak_ptr_factory_; |
216 | 216 |
217 DISALLOW_COPY_AND_ASSIGN(RemoteToLocalSyncer); | 217 DISALLOW_COPY_AND_ASSIGN(RemoteToLocalSyncer); |
218 }; | 218 }; |
219 | 219 |
220 } // namespace drive_backend | 220 } // namespace drive_backend |
221 } // namespace sync_file_system | 221 } // namespace sync_file_system |
222 | 222 |
223 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_TO_LOCAL_SYNCER_
H_ | 223 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_TO_LOCAL_SYNCER_
H_ |
OLD | NEW |