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_V1_DRIVE_FILE_SYNC_SERVICE
_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_V1_DRIVE_FILE_SYNC_SERVICE
_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_V1_DRIVE_FILE_SYNC_SERVICE
_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_V1_DRIVE_FILE_SYNC_SERVICE
_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 virtual LocalChangeProcessor* GetLocalChangeProcessor() OVERRIDE; | 99 virtual LocalChangeProcessor* GetLocalChangeProcessor() OVERRIDE; |
100 virtual RemoteServiceState GetCurrentState() const OVERRIDE; | 100 virtual RemoteServiceState GetCurrentState() const OVERRIDE; |
101 virtual void GetOriginStatusMap(const StatusMapCallback& callback) OVERRIDE; | 101 virtual void GetOriginStatusMap(const StatusMapCallback& callback) OVERRIDE; |
102 virtual void DumpFiles(const GURL& origin, | 102 virtual void DumpFiles(const GURL& origin, |
103 const ListCallback& callback) OVERRIDE; | 103 const ListCallback& callback) OVERRIDE; |
104 virtual void DumpDatabase(const ListCallback& callback) OVERRIDE; | 104 virtual void DumpDatabase(const ListCallback& callback) OVERRIDE; |
105 virtual void SetSyncEnabled(bool enabled) OVERRIDE; | 105 virtual void SetSyncEnabled(bool enabled) OVERRIDE; |
106 virtual void PromoteDemotedChanges(const base::Closure& callback) OVERRIDE; | 106 virtual void PromoteDemotedChanges(const base::Closure& callback) OVERRIDE; |
107 | 107 |
108 // LocalChangeProcessor overrides. | 108 // LocalChangeProcessor overrides. |
109 virtual void ApplyLocalChange( | 109 virtual void ApplyLocalChange(const FileChange& change, |
110 const FileChange& change, | 110 const base::FilePath& local_file_path, |
111 const base::FilePath& local_file_path, | 111 const SyncFileMetadata& local_file_metadata, |
112 const SyncFileMetadata& local_file_metadata, | 112 const storage::FileSystemURL& url, |
113 const fileapi::FileSystemURL& url, | 113 const SyncStatusCallback& callback) OVERRIDE; |
114 const SyncStatusCallback& callback) OVERRIDE; | |
115 | 114 |
116 // DriveFileSyncClientObserver overrides. | 115 // DriveFileSyncClientObserver overrides. |
117 virtual void OnAuthenticated() OVERRIDE; | 116 virtual void OnAuthenticated() OVERRIDE; |
118 virtual void OnNetworkConnected() OVERRIDE; | 117 virtual void OnNetworkConnected() OVERRIDE; |
119 | 118 |
120 // drive::DriveNotificationObserver implementation. | 119 // drive::DriveNotificationObserver implementation. |
121 virtual void OnNotificationReceived() OVERRIDE; | 120 virtual void OnNotificationReceived() OVERRIDE; |
122 virtual void OnPushNotificationEnabled(bool enabled) OVERRIDE; | 121 virtual void OnPushNotificationEnabled(bool enabled) OVERRIDE; |
123 | 122 |
124 // SyncTaskManager::Client overrides. | 123 // SyncTaskManager::Client overrides. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 void DoDisableOrigin( | 182 void DoDisableOrigin( |
184 const GURL& origin, | 183 const GURL& origin, |
185 const SyncStatusCallback& callback); | 184 const SyncStatusCallback& callback); |
186 void DoUninstallOrigin( | 185 void DoUninstallOrigin( |
187 const GURL& origin, | 186 const GURL& origin, |
188 UninstallFlag flag, | 187 UninstallFlag flag, |
189 const SyncStatusCallback& callback); | 188 const SyncStatusCallback& callback); |
190 void DoProcessRemoteChange( | 189 void DoProcessRemoteChange( |
191 const SyncFileCallback& sync_callback, | 190 const SyncFileCallback& sync_callback, |
192 const SyncStatusCallback& completion_callback); | 191 const SyncStatusCallback& completion_callback); |
193 void DoApplyLocalChange( | 192 void DoApplyLocalChange(const FileChange& change, |
194 const FileChange& change, | 193 const base::FilePath& local_file_path, |
195 const base::FilePath& local_file_path, | 194 const SyncFileMetadata& local_file_metadata, |
196 const SyncFileMetadata& local_file_metadata, | 195 const storage::FileSystemURL& url, |
197 const fileapi::FileSystemURL& url, | 196 const SyncStatusCallback& callback); |
198 const SyncStatusCallback& callback); | |
199 | 197 |
200 void UpdateRegisteredOrigins(); | 198 void UpdateRegisteredOrigins(); |
201 | 199 |
202 void StartBatchSync(const SyncStatusCallback& callback); | 200 void StartBatchSync(const SyncStatusCallback& callback); |
203 void DidGetDriveDirectoryForOrigin(const GURL& origin, | 201 void DidGetDriveDirectoryForOrigin(const GURL& origin, |
204 const SyncStatusCallback& callback, | 202 const SyncStatusCallback& callback, |
205 SyncStatusCode status, | 203 SyncStatusCode status, |
206 const std::string& resource_id); | 204 const std::string& resource_id); |
207 void DidUninstallOrigin(const GURL& origin, | 205 void DidUninstallOrigin(const GURL& origin, |
208 const SyncStatusCallback& callback, | 206 const SyncStatusCallback& callback, |
(...skipping 30 matching lines...) Expand all Loading... |
239 SyncFileType file_type); | 237 SyncFileType file_type); |
240 bool AppendRemoteChangeInternal( | 238 bool AppendRemoteChangeInternal( |
241 const GURL& origin, | 239 const GURL& origin, |
242 const base::FilePath& path, | 240 const base::FilePath& path, |
243 bool is_deleted, | 241 bool is_deleted, |
244 const std::string& resource_id, | 242 const std::string& resource_id, |
245 int64 changestamp, | 243 int64 changestamp, |
246 const std::string& remote_file_md5, | 244 const std::string& remote_file_md5, |
247 const base::Time& updated_time, | 245 const base::Time& updated_time, |
248 SyncFileType file_type); | 246 SyncFileType file_type); |
249 void RemoveRemoteChange(const fileapi::FileSystemURL& url); | 247 void RemoveRemoteChange(const storage::FileSystemURL& url); |
250 | 248 |
251 // TODO(kinuko,tzik): Move this out of DriveFileSyncService. | 249 // TODO(kinuko,tzik): Move this out of DriveFileSyncService. |
252 void MarkConflict( | 250 void MarkConflict(const storage::FileSystemURL& url, |
253 const fileapi::FileSystemURL& url, | 251 DriveMetadata* drive_metadata, |
254 DriveMetadata* drive_metadata, | 252 const SyncStatusCallback& callback); |
255 const SyncStatusCallback& callback); | 253 void NotifyConflict(const storage::FileSystemURL& url, |
256 void NotifyConflict( | 254 const SyncStatusCallback& callback, |
257 const fileapi::FileSystemURL& url, | 255 SyncStatusCode status); |
258 const SyncStatusCallback& callback, | |
259 SyncStatusCode status); | |
260 | 256 |
261 // A wrapper implementation to GDataErrorCodeToSyncStatusCode which returns | 257 // A wrapper implementation to GDataErrorCodeToSyncStatusCode which returns |
262 // authentication error if the user is not signed in. | 258 // authentication error if the user is not signed in. |
263 SyncStatusCode GDataErrorCodeToSyncStatusCodeWrapper( | 259 SyncStatusCode GDataErrorCodeToSyncStatusCodeWrapper( |
264 google_apis::GDataErrorCode error); | 260 google_apis::GDataErrorCode error); |
265 | 261 |
266 base::FilePath temporary_file_dir_; | 262 base::FilePath temporary_file_dir_; |
267 | 263 |
268 // May start batch sync or incremental sync. | 264 // May start batch sync or incremental sync. |
269 // This posts either one of following tasks: | 265 // This posts either one of following tasks: |
270 // - StartBatchSyncForOrigin() if it has any pending batch sync origins, or | 266 // - StartBatchSyncForOrigin() if it has any pending batch sync origins, or |
271 // - FetchChangesForIncrementalSync() otherwise. | 267 // - FetchChangesForIncrementalSync() otherwise. |
272 // | 268 // |
273 // These two methods are called only from this method. | 269 // These two methods are called only from this method. |
274 void MaybeStartFetchChanges(); | 270 void MaybeStartFetchChanges(); |
275 | 271 |
276 void FetchChangesForIncrementalSync(const SyncStatusCallback& callback); | 272 void FetchChangesForIncrementalSync(const SyncStatusCallback& callback); |
277 void DidFetchChangesForIncrementalSync( | 273 void DidFetchChangesForIncrementalSync( |
278 const SyncStatusCallback& callback, | 274 const SyncStatusCallback& callback, |
279 bool has_new_changes, | 275 bool has_new_changes, |
280 google_apis::GDataErrorCode error, | 276 google_apis::GDataErrorCode error, |
281 scoped_ptr<google_apis::ResourceList> changes); | 277 scoped_ptr<google_apis::ResourceList> changes); |
282 bool GetOriginForEntry(const google_apis::ResourceEntry& entry, GURL* origin); | 278 bool GetOriginForEntry(const google_apis::ResourceEntry& entry, GURL* origin); |
283 void NotifyObserversFileStatusChanged(const fileapi::FileSystemURL& url, | 279 void NotifyObserversFileStatusChanged(const storage::FileSystemURL& url, |
284 SyncFileStatus sync_status, | 280 SyncFileStatus sync_status, |
285 SyncAction action_taken, | 281 SyncAction action_taken, |
286 SyncDirection direction); | 282 SyncDirection direction); |
287 | 283 |
288 void EnsureSyncRootDirectory(const ResourceIdCallback& callback); | 284 void EnsureSyncRootDirectory(const ResourceIdCallback& callback); |
289 void DidEnsureSyncRoot(const ResourceIdCallback& callback, | 285 void DidEnsureSyncRoot(const ResourceIdCallback& callback, |
290 google_apis::GDataErrorCode error, | 286 google_apis::GDataErrorCode error, |
291 const std::string& sync_root_resource_id); | 287 const std::string& sync_root_resource_id); |
292 void EnsureOriginRootDirectory(const GURL& origin, | 288 void EnsureOriginRootDirectory(const GURL& origin, |
293 const ResourceIdCallback& callback); | 289 const ResourceIdCallback& callback); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 ConflictResolutionResolver conflict_resolution_resolver_; | 351 ConflictResolutionResolver conflict_resolution_resolver_; |
356 | 352 |
357 OriginOperationQueue pending_origin_operations_; | 353 OriginOperationQueue pending_origin_operations_; |
358 | 354 |
359 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService); | 355 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService); |
360 }; | 356 }; |
361 | 357 |
362 } // namespace sync_file_system | 358 } // namespace sync_file_system |
363 | 359 |
364 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_V1_DRIVE_FILE_SYNC_SERV
ICE_H_ | 360 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_V1_DRIVE_FILE_SYNC_SERV
ICE_H_ |
OLD | NEW |