OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_SYNC_API_SYNCABLE_SERVICE_H_ | |
6 #define CHROME_BROWSER_SYNC_API_SYNCABLE_SERVICE_H_ | |
7 #pragma once | |
8 | |
9 #include <vector> | |
10 | |
11 #include "chrome/browser/sync/syncable/model_type.h" | |
12 #include "chrome/browser/sync/api/sync_change_processor.h" | |
13 #include "chrome/browser/sync/api/sync_data.h" | |
14 | |
15 class SyncData; | |
16 | |
17 typedef std::vector<SyncData> SyncDataList; | |
18 | |
19 class SyncableService : public SyncChangeProcessor { | |
20 public: | |
21 // Informs the service to begin syncing the specified synced datatype |type|. | |
22 // The service should then merge |initial_sync_data| into it's local data, | |
23 // calling |sync_processor|'s ProcessSyncChanges as necessary to reconcile the | |
24 // two. After this, the SyncableService's local data should match the server | |
25 // data, and the service should be ready to receive and process any further | |
26 // SyncChange's as they occur. | |
27 virtual bool MergeDataAndStartSyncing( | |
28 syncable::ModelType type, | |
29 const SyncDataList& initial_sync_data, | |
30 SyncChangeProcessor* sync_processor) = 0; | |
31 | |
32 // Stop syncing the specified type and reset state. | |
33 virtual void StopSyncing(syncable::ModelType type) = 0; | |
34 | |
35 // Fills a list of SyncData from the local data. This should create an up | |
36 // to date representation of the SyncableService's view of that datatype, and | |
37 // should match/be a subset of the server's view of that datatype. | |
38 virtual SyncDataList GetAllSyncData(syncable::ModelType type) = 0; | |
akalin
2011/05/21 00:57:58
What do you think about making this function const
Nicolas Zea
2011/05/23 18:13:27
Done.
| |
39 | |
40 // SyncChangeProcessor interface. | |
41 // Process a list of new SyncChanges and update the local data as necessary. | |
42 virtual void ProcessSyncChanges(const SyncChangeList& change_list) = 0; | |
43 | |
44 protected: | |
45 virtual ~SyncableService(); | |
46 }; | |
47 | |
48 #endif // CHROME_BROWSER_SYNC_API_SYNCABLE_SERVICE_H_ | |
OLD | NEW |