1 // Copyright 2012 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.
5 #ifndef SYNC_API_SYNC_CHANGE_PROCESSOR_H_
6 #define SYNC_API_SYNC_CHANGE_PROCESSOR_H_
10 #include "sync/api/sync_data.h"
11 #include "sync/api/sync_error.h"
12 #include "sync/base/sync_export.h"
13 #include "sync/internal_api/public/base/model_type.h"
15 namespace tracked_objects {
17 } // namespace tracked_objects
23 typedef std::vector<SyncChange> SyncChangeList;
25 // An interface for services that handle receiving SyncChanges.
26 class SYNC_EXPORT SyncChangeProcessor {
28 SyncChangeProcessor();
29 virtual ~SyncChangeProcessor();
31 // Process a list of SyncChanges.
32 // Returns: A default SyncError (IsSet() == false) if no errors were
33 // encountered, and a filled SyncError (IsSet() == true)
36 // |from_here|: allows tracking of where sync changes originate.
37 // |change_list|: is the list of sync changes in need of processing.
38 virtual SyncError ProcessSyncChanges(
39 const tracked_objects::Location& from_here,
40 const SyncChangeList& change_list) = 0;
42 // Fills a list of SyncData. This should create an up to date representation
43 // of all the data known to the ChangeProcessor for |datatype|, and
44 // should match/be a subset of the server's view of that datatype.
46 // WARNING: This can be a potentially slow & memory intensive operation and
47 // should only be used when absolutely necessary / sparingly.
48 virtual SyncDataList GetAllSyncData(ModelType type) const = 0;
53 #endif // SYNC_API_SYNC_CHANGE_PROCESSOR_H_