Index: chrome/browser/sync/api/syncable_service.h |
diff --git a/chrome/browser/sync/api/syncable_service.h b/chrome/browser/sync/api/syncable_service.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..abe262778d091e21a807a5c9e6ca1438ffb8ef26 |
--- /dev/null |
+++ b/chrome/browser/sync/api/syncable_service.h |
@@ -0,0 +1,51 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_SYNC_API_SYNCABLE_SERVICE_H_ |
+#define CHROME_BROWSER_SYNC_API_SYNCABLE_SERVICE_H_ |
+#pragma once |
+ |
+#include <vector> |
+ |
+#include "chrome/browser/sync/syncable/model_type.h" |
+#include "chrome/browser/sync/api/sync_event_processor.h" |
+ |
+class SyncData; |
+ |
+typedef std::vector<SyncData> SyncDataList; |
+ |
+class SyncableService : public SyncEventProcessor { |
+ public: |
+ SyncableService(); |
+ virtual ~SyncableService(); |
+ |
+ // Informs the service to begin syncing the specified synced datatype |type|. |
+ // The service should then merge |initial_sync_data| into it's local data, |
+ // calling |sync_processor|'s ProcessSyncEvents as necessary to reconcile the |
+ // two. After this, the SyncableService's local data should match the server |
+ // data, and the service should be ready to receive and process any further |
+ // SyncEvent's as they occur. |
+ virtual bool MergeDataAndStartSyncing( |
+ 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
|
+ SyncEventProcessor* sync_processor, |
+ 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.
|
+ |
+ // Stop syncing the specified type and reset state. |
+ virtual void StopSyncing(syncable::ModelType type) = 0; |
+ |
+ // Fills a list of SyncData from the local data. This should create an up |
+ // to date representation of the SyncableService's view of that datatype, and |
+ // should match/be a subset of the server's view of that datatype. |
+ virtual bool GetAllSyncData(syncable::ModelType type, |
+ SyncDataList* current_data) = 0; |
+ |
+ // SyncEventProcessor interface. |
+ // Process a list of new SyncEvents and update the local data as necessary. |
+ virtual void ProcessSyncEvents(const SyncEventList& event_list) = 0; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(SyncableService); |
+}; |
+ |
+#endif // CHROME_BROWSER_SYNC_API_SYNCABLE_SERVICE_H_ |