Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / sync / engine / update_handler.h
blobe4c9abc24bb4f699f51ebcf2148c2238d8e2cd40
1 // Copyright 2014 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_ENGINE_UPDATE_HANDLER_H_
6 #define SYNC_ENGINE_UPDATE_HANDLER_H_
8 #include <vector>
10 #include "sync/base/sync_export.h"
11 #include "sync/internal_api/public/util/syncer_error.h"
13 namespace sync_pb {
14 class DataTypeContext;
15 class DataTypeProgressMarker;
16 class SyncEntity;
19 typedef std::vector<const sync_pb::SyncEntity*> SyncEntityList;
21 namespace syncer {
23 namespace sessions {
24 class StatusController;
27 class ModelSafeWorker;
29 // This class represents an entity that can request, receive, and apply updates
30 // from the sync server.
31 class SYNC_EXPORT_PRIVATE UpdateHandler {
32 public:
33 UpdateHandler();
34 virtual ~UpdateHandler() = 0;
36 // Fills the given parameter with the stored progress marker for this type.
37 virtual void GetDownloadProgress(
38 sync_pb::DataTypeProgressMarker* progress_marker) const = 0;
40 // Fills |context| with the per-client datatype context, if one exists. Clears
41 // |context| otherwise.
42 virtual void GetDataTypeContext(sync_pb::DataTypeContext* context) const = 0;
44 // Processes the contents of a GetUpdates response message.
46 // Should be invoked with the progress marker and set of SyncEntities from a
47 // single GetUpdates response message. The progress marker's type must match
48 // this update handler's type, and the set of SyncEntities must include all
49 // entities of this type found in the response message.
51 // In this context, "applicable_updates" means the set of updates belonging to
52 // this type.
54 // Returns SYNCER_OK if the all data was processed successfully, a syncer
55 // error otherwise.
56 virtual SyncerError ProcessGetUpdatesResponse(
57 const sync_pb::DataTypeProgressMarker& progress_marker,
58 const sync_pb::DataTypeContext& mutated_context,
59 const SyncEntityList& applicable_updates,
60 sessions::StatusController* status) = 0;
62 // Called at the end of a non-configure GetUpdates loop to apply any unapplied
63 // updates.
64 virtual void ApplyUpdates(sessions::StatusController* status) = 0;
66 // Called at the end of a configure GetUpdates loop to perform any required
67 // post-initial-download update application.
68 virtual void PassiveApplyUpdates(sessions::StatusController* status) = 0;
71 } // namespace syncer
73 #endif // SYNC_ENGINE_UPDATE_HANDLER_H_