| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef SYNC_ENGINE_UPDATE_HANDLER_H_ | |
| 6 #define SYNC_ENGINE_UPDATE_HANDLER_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "sync/base/sync_export.h" | |
| 11 #include "sync/internal_api/public/util/syncer_error.h" | |
| 12 | |
| 13 namespace sync_pb { | |
| 14 class DataTypeContext; | |
| 15 class DataTypeProgressMarker; | |
| 16 class SyncEntity; | |
| 17 } | |
| 18 | |
| 19 typedef std::vector<const sync_pb::SyncEntity*> SyncEntityList; | |
| 20 | |
| 21 namespace syncer { | |
| 22 | |
| 23 namespace sessions { | |
| 24 class StatusController; | |
| 25 } | |
| 26 | |
| 27 class ModelSafeWorker; | |
| 28 | |
| 29 // This class represents an entity that can request, receive, and apply updates | |
| 30 // from the sync server. | |
| 31 class SYNC_EXPORT UpdateHandler { | |
| 32 public: | |
| 33 UpdateHandler(); | |
| 34 virtual ~UpdateHandler() = 0; | |
| 35 | |
| 36 // Returns true if initial sync was performed for this type. | |
| 37 virtual bool IsInitialSyncEnded() const = 0; | |
| 38 | |
| 39 // Fills the given parameter with the stored progress marker for this type. | |
| 40 virtual void GetDownloadProgress( | |
| 41 sync_pb::DataTypeProgressMarker* progress_marker) const = 0; | |
| 42 | |
| 43 // Fills |context| with the per-client datatype context, if one exists. Clears | |
| 44 // |context| otherwise. | |
| 45 virtual void GetDataTypeContext(sync_pb::DataTypeContext* context) const = 0; | |
| 46 | |
| 47 // Processes the contents of a GetUpdates response message. | |
| 48 // | |
| 49 // Should be invoked with the progress marker and set of SyncEntities from a | |
| 50 // single GetUpdates response message. The progress marker's type must match | |
| 51 // this update handler's type, and the set of SyncEntities must include all | |
| 52 // entities of this type found in the response message. | |
| 53 // | |
| 54 // In this context, "applicable_updates" means the set of updates belonging to | |
| 55 // this type. | |
| 56 // | |
| 57 // Returns SYNCER_OK if the all data was processed successfully, a syncer | |
| 58 // error otherwise. | |
| 59 virtual SyncerError ProcessGetUpdatesResponse( | |
| 60 const sync_pb::DataTypeProgressMarker& progress_marker, | |
| 61 const sync_pb::DataTypeContext& mutated_context, | |
| 62 const SyncEntityList& applicable_updates, | |
| 63 sessions::StatusController* status) = 0; | |
| 64 | |
| 65 // Called at the end of a non-configure GetUpdates loop to apply any unapplied | |
| 66 // updates. | |
| 67 virtual void ApplyUpdates(sessions::StatusController* status) = 0; | |
| 68 | |
| 69 // Called at the end of a configure GetUpdates loop to perform any required | |
| 70 // post-initial-download update application. | |
| 71 virtual void PassiveApplyUpdates(sessions::StatusController* status) = 0; | |
| 72 }; | |
| 73 | |
| 74 } // namespace syncer | |
| 75 | |
| 76 #endif // SYNC_ENGINE_UPDATE_HANDLER_H_ | |
| OLD | NEW |