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_event_processor.h" | |
13 | |
14 class SyncData; | |
15 | |
16 typedef std::vector<SyncData> SyncDataList; | |
17 | |
18 class SyncableService : public SyncEventProcessor { | |
19 public: | |
20 SyncableService(); | |
21 virtual ~SyncableService(); | |
22 | |
23 // Informs the service to begin syncing the specified synced datatype |type|. | |
24 // The service should then merge |initial_sync_data| into it's local data, | |
25 // calling |sync_processor|'s ProcessSyncEvents as necessary to reconcile the | |
26 // two. After this, the SyncableService's local data should match the server | |
27 // data, and the service should be ready to receive and process any further | |
28 // SyncEvent's as they occur. | |
29 virtual bool MergeDataAndStartSyncing( | |
30 syncable::ModelType type, | |
akalin
2011/05/19 00:58:45
I'm not a fan of needing to reference the syncable
Nicolas Zea
2011/05/19 21:17:45
I don't think it's anything we can really avoid. T
| |
31 SyncEventProcessor* sync_processor, | |
32 const SyncDataList& initial_sync_data) = 0; | |
akalin
2011/05/19 00:58:45
maybe move initial-sync_data to before the sync_pr
Nicolas Zea
2011/05/19 21:17:45
Done.
| |
33 | |
34 // Stop syncing the specified type and reset state. | |
35 virtual void StopSyncing(syncable::ModelType type) = 0; | |
36 | |
37 // Fills a list of SyncData from the local data. This should create an up | |
38 // to date representation of the SyncableService's view of that datatype, and | |
39 // should match/be a subset of the server's view of that datatype. | |
40 virtual bool GetAllSyncData(syncable::ModelType type, | |
41 SyncDataList* current_data) = 0; | |
42 | |
43 // SyncEventProcessor interface. | |
44 // Process a list of new SyncEvents and update the local data as necessary. | |
45 virtual void ProcessSyncEvents(const SyncEventList& event_list) = 0; | |
46 | |
47 private: | |
48 DISALLOW_COPY_AND_ASSIGN(SyncableService); | |
49 }; | |
50 | |
51 #endif // CHROME_BROWSER_SYNC_API_SYNCABLE_SERVICE_H_ | |
OLD | NEW |