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