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_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 virtual bool IsConflicting(const fileapi::FileSystemURL& url) OVERRIDE; | 78 virtual bool IsConflicting(const fileapi::FileSystemURL& url) OVERRIDE; |
79 virtual void GetRemoteFileMetadata( | 79 virtual void GetRemoteFileMetadata( |
80 const fileapi::FileSystemURL& url, | 80 const fileapi::FileSystemURL& url, |
81 const fileapi::SyncFileMetadataCallback& callback) OVERRIDE; | 81 const fileapi::SyncFileMetadataCallback& callback) OVERRIDE; |
82 virtual RemoteServiceState GetCurrentState() const OVERRIDE; | 82 virtual RemoteServiceState GetCurrentState() const OVERRIDE; |
83 virtual const char* GetServiceName() const OVERRIDE; | 83 virtual const char* GetServiceName() const OVERRIDE; |
84 virtual void SetSyncEnabled(bool enabled) OVERRIDE; | 84 virtual void SetSyncEnabled(bool enabled) OVERRIDE; |
85 | 85 |
86 // LocalChangeProcessor overrides. | 86 // LocalChangeProcessor overrides. |
87 virtual void ApplyLocalChange( | 87 virtual void ApplyLocalChange( |
88 const fileapi::FileChange& change, | 88 const FileChange& change, |
89 const base::FilePath& local_file_path, | 89 const base::FilePath& local_file_path, |
90 const fileapi::FileSystemURL& url, | 90 const fileapi::FileSystemURL& url, |
91 const fileapi::SyncStatusCallback& callback) OVERRIDE; | 91 const fileapi::SyncStatusCallback& callback) OVERRIDE; |
92 | 92 |
93 // DriveFileSyncClientObserver overrides. | 93 // DriveFileSyncClientObserver overrides. |
94 virtual void OnAuthenticated() OVERRIDE; | 94 virtual void OnAuthenticated() OVERRIDE; |
95 virtual void OnNetworkConnected() OVERRIDE; | 95 virtual void OnNetworkConnected() OVERRIDE; |
96 | 96 |
97 // syncer::InvalidationHandler implementation. | 97 // syncer::InvalidationHandler implementation. |
98 virtual void OnInvalidatorStateChange( | 98 virtual void OnInvalidatorStateChange( |
(...skipping 29 matching lines...) Expand all Loading... |
128 }; | 128 }; |
129 | 129 |
130 typedef std::set<ChangeQueueItem, ChangeQueueComparator> PendingChangeQueue; | 130 typedef std::set<ChangeQueueItem, ChangeQueueComparator> PendingChangeQueue; |
131 | 131 |
132 struct RemoteChange { | 132 struct RemoteChange { |
133 int64 changestamp; | 133 int64 changestamp; |
134 std::string resource_id; | 134 std::string resource_id; |
135 std::string md5_checksum; | 135 std::string md5_checksum; |
136 RemoteSyncType sync_type; | 136 RemoteSyncType sync_type; |
137 fileapi::FileSystemURL url; | 137 fileapi::FileSystemURL url; |
138 fileapi::FileChange change; | 138 FileChange change; |
139 PendingChangeQueue::iterator position_in_queue; | 139 PendingChangeQueue::iterator position_in_queue; |
140 | 140 |
141 RemoteChange(); | 141 RemoteChange(); |
142 RemoteChange(int64 changestamp, | 142 RemoteChange(int64 changestamp, |
143 const std::string& resource_id, | 143 const std::string& resource_id, |
144 const std::string& md5_checksum, | 144 const std::string& md5_checksum, |
145 RemoteSyncType sync_type, | 145 RemoteSyncType sync_type, |
146 const fileapi::FileSystemURL& url, | 146 const fileapi::FileSystemURL& url, |
147 const fileapi::FileChange& change, | 147 const FileChange& change, |
148 PendingChangeQueue::iterator position_in_queue); | 148 PendingChangeQueue::iterator position_in_queue); |
149 ~RemoteChange(); | 149 ~RemoteChange(); |
150 }; | 150 }; |
151 | 151 |
152 struct RemoteChangeComparator { | 152 struct RemoteChangeComparator { |
153 bool operator()(const RemoteChange& left, const RemoteChange& right); | 153 bool operator()(const RemoteChange& left, const RemoteChange& right); |
154 }; | 154 }; |
155 | 155 |
156 // TODO(tzik): Consider using std::pair<base::FilePath, FileType> as the key | 156 // TODO(tzik): Consider using std::pair<base::FilePath, FileType> as the key |
157 // below to support directories and custom conflict handling. | 157 // below to support directories and custom conflict handling. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 void UpdateServiceState(); | 196 void UpdateServiceState(); |
197 base::WeakPtr<DriveFileSyncService> AsWeakPtr(); | 197 base::WeakPtr<DriveFileSyncService> AsWeakPtr(); |
198 | 198 |
199 void DidGetRemoteFileMetadata( | 199 void DidGetRemoteFileMetadata( |
200 const fileapi::SyncFileMetadataCallback& callback, | 200 const fileapi::SyncFileMetadataCallback& callback, |
201 google_apis::GDataErrorCode error, | 201 google_apis::GDataErrorCode error, |
202 scoped_ptr<google_apis::ResourceEntry> entry); | 202 scoped_ptr<google_apis::ResourceEntry> entry); |
203 | 203 |
204 // Local synchronization related methods. | 204 // Local synchronization related methods. |
205 LocalSyncOperationType ResolveLocalSyncOperationType( | 205 LocalSyncOperationType ResolveLocalSyncOperationType( |
206 const fileapi::FileChange& local_file_change, | 206 const FileChange& local_file_change, |
207 const fileapi::FileSystemURL& url); | 207 const fileapi::FileSystemURL& url); |
208 void DidApplyLocalChange( | 208 void DidApplyLocalChange( |
209 scoped_ptr<TaskToken> token, | 209 scoped_ptr<TaskToken> token, |
210 const fileapi::FileSystemURL& url, | 210 const fileapi::FileSystemURL& url, |
211 const google_apis::GDataErrorCode error, | 211 const google_apis::GDataErrorCode error, |
212 const fileapi::SyncStatusCallback& callback, | 212 const fileapi::SyncStatusCallback& callback, |
213 fileapi::SyncStatusCode status); | 213 fileapi::SyncStatusCode status); |
214 void DidResolveConflictToRemoteChange( | 214 void DidResolveConflictToRemoteChange( |
215 scoped_ptr<TaskToken> token, | 215 scoped_ptr<TaskToken> token, |
216 const fileapi::FileSystemURL& url, | 216 const fileapi::FileSystemURL& url, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 void DidRemoveOriginOnMetadataStore( | 277 void DidRemoveOriginOnMetadataStore( |
278 scoped_ptr<TaskToken> token, | 278 scoped_ptr<TaskToken> token, |
279 const fileapi::SyncStatusCallback& callback, | 279 const fileapi::SyncStatusCallback& callback, |
280 fileapi::SyncStatusCode status); | 280 fileapi::SyncStatusCode status); |
281 | 281 |
282 // Remote synchronization related methods. | 282 // Remote synchronization related methods. |
283 void DidPrepareForProcessRemoteChange( | 283 void DidPrepareForProcessRemoteChange( |
284 scoped_ptr<ProcessRemoteChangeParam> param, | 284 scoped_ptr<ProcessRemoteChangeParam> param, |
285 fileapi::SyncStatusCode status, | 285 fileapi::SyncStatusCode status, |
286 const fileapi::SyncFileMetadata& metadata, | 286 const fileapi::SyncFileMetadata& metadata, |
287 const fileapi::FileChangeList& changes); | 287 const FileChangeList& changes); |
288 void DidResolveConflictToLocalChange( | 288 void DidResolveConflictToLocalChange( |
289 scoped_ptr<ProcessRemoteChangeParam> param, | 289 scoped_ptr<ProcessRemoteChangeParam> param, |
290 fileapi::SyncStatusCode status); | 290 fileapi::SyncStatusCode status); |
291 void DownloadForRemoteSync( | 291 void DownloadForRemoteSync( |
292 scoped_ptr<ProcessRemoteChangeParam> param); | 292 scoped_ptr<ProcessRemoteChangeParam> param); |
293 void DidGetTemporaryFileForDownload( | 293 void DidGetTemporaryFileForDownload( |
294 scoped_ptr<ProcessRemoteChangeParam> param, | 294 scoped_ptr<ProcessRemoteChangeParam> param, |
295 bool success); | 295 bool success); |
296 void DidDownloadFileForRemoteSync( | 296 void DidDownloadFileForRemoteSync( |
297 scoped_ptr<ProcessRemoteChangeParam> param, | 297 scoped_ptr<ProcessRemoteChangeParam> param, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 // Use WeakPtrFactory instead of SupportsWeakPtr to revoke the weak pointer | 433 // Use WeakPtrFactory instead of SupportsWeakPtr to revoke the weak pointer |
434 // in |token_|. | 434 // in |token_|. |
435 base::WeakPtrFactory<DriveFileSyncService> weak_factory_; | 435 base::WeakPtrFactory<DriveFileSyncService> weak_factory_; |
436 | 436 |
437 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService); | 437 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService); |
438 }; | 438 }; |
439 | 439 |
440 } // namespace sync_file_system | 440 } // namespace sync_file_system |
441 | 441 |
442 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ | 442 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ |
OLD | NEW |