| 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_GET_UPDATES_DELEGATE_H_ | 5 #ifndef SYNC_ENGINE_GET_UPDATES_DELEGATE_H_ |
| 6 #define SYNC_ENGINE_GET_UPDATES_DELEGATE_H_ | 6 #define SYNC_ENGINE_GET_UPDATES_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "sync/internal_api/public/events/protocol_event.h" | 8 #include "sync/internal_api/public/events/protocol_event.h" |
| 9 #include "sync/protocol/sync.pb.h" | 9 #include "sync/protocol/sync.pb.h" |
| 10 #include "sync/sessions/model_type_registry.h" | 10 #include "sync/sessions/model_type_registry.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // Functionality specific to the normal GetUpdate request. | 42 // Functionality specific to the normal GetUpdate request. |
| 43 class SYNC_EXPORT_PRIVATE NormalGetUpdatesDelegate : public GetUpdatesDelegate { | 43 class SYNC_EXPORT_PRIVATE NormalGetUpdatesDelegate : public GetUpdatesDelegate { |
| 44 public: | 44 public: |
| 45 NormalGetUpdatesDelegate(const sessions::NudgeTracker& nudge_tracker); | 45 NormalGetUpdatesDelegate(const sessions::NudgeTracker& nudge_tracker); |
| 46 virtual ~NormalGetUpdatesDelegate(); | 46 virtual ~NormalGetUpdatesDelegate(); |
| 47 | 47 |
| 48 // Uses the member NudgeTracker to populate some fields of this GU message. | 48 // Uses the member NudgeTracker to populate some fields of this GU message. |
| 49 virtual void HelpPopulateGuMessage( | 49 virtual void HelpPopulateGuMessage( |
| 50 sync_pb::GetUpdatesMessage* get_updates) const OVERRIDE; | 50 sync_pb::GetUpdatesMessage* get_updates) const override; |
| 51 | 51 |
| 52 // Applies pending updates on the appropriate data type threads. | 52 // Applies pending updates on the appropriate data type threads. |
| 53 virtual void ApplyUpdates( | 53 virtual void ApplyUpdates( |
| 54 ModelTypeSet gu_types, | 54 ModelTypeSet gu_types, |
| 55 sessions::StatusController* status, | 55 sessions::StatusController* status, |
| 56 UpdateHandlerMap* update_handler_map) const OVERRIDE; | 56 UpdateHandlerMap* update_handler_map) const override; |
| 57 | 57 |
| 58 virtual scoped_ptr<ProtocolEvent> GetNetworkRequestEvent( | 58 virtual scoped_ptr<ProtocolEvent> GetNetworkRequestEvent( |
| 59 base::Time timestamp, | 59 base::Time timestamp, |
| 60 const sync_pb::ClientToServerMessage& request) const OVERRIDE; | 60 const sync_pb::ClientToServerMessage& request) const override; |
| 61 private: | 61 private: |
| 62 DISALLOW_COPY_AND_ASSIGN(NormalGetUpdatesDelegate); | 62 DISALLOW_COPY_AND_ASSIGN(NormalGetUpdatesDelegate); |
| 63 | 63 |
| 64 const sessions::NudgeTracker& nudge_tracker_; | 64 const sessions::NudgeTracker& nudge_tracker_; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 // Functionality specific to the configure GetUpdate request. | 67 // Functionality specific to the configure GetUpdate request. |
| 68 class SYNC_EXPORT_PRIVATE ConfigureGetUpdatesDelegate | 68 class SYNC_EXPORT_PRIVATE ConfigureGetUpdatesDelegate |
| 69 : public GetUpdatesDelegate { | 69 : public GetUpdatesDelegate { |
| 70 public: | 70 public: |
| 71 ConfigureGetUpdatesDelegate( | 71 ConfigureGetUpdatesDelegate( |
| 72 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); | 72 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); |
| 73 virtual ~ConfigureGetUpdatesDelegate(); | 73 virtual ~ConfigureGetUpdatesDelegate(); |
| 74 | 74 |
| 75 // Sets the 'source' and 'origin' fields for this request. | 75 // Sets the 'source' and 'origin' fields for this request. |
| 76 virtual void HelpPopulateGuMessage( | 76 virtual void HelpPopulateGuMessage( |
| 77 sync_pb::GetUpdatesMessage* get_updates) const OVERRIDE; | 77 sync_pb::GetUpdatesMessage* get_updates) const override; |
| 78 | 78 |
| 79 // Applies updates passively (ie. on the sync thread). | 79 // Applies updates passively (ie. on the sync thread). |
| 80 // | 80 // |
| 81 // This is safe only if the ChangeProcessor is not listening to changes at | 81 // This is safe only if the ChangeProcessor is not listening to changes at |
| 82 // this time. | 82 // this time. |
| 83 virtual void ApplyUpdates( | 83 virtual void ApplyUpdates( |
| 84 ModelTypeSet gu_types, | 84 ModelTypeSet gu_types, |
| 85 sessions::StatusController* status, | 85 sessions::StatusController* status, |
| 86 UpdateHandlerMap* update_handler_map) const OVERRIDE; | 86 UpdateHandlerMap* update_handler_map) const override; |
| 87 | 87 |
| 88 virtual scoped_ptr<ProtocolEvent> GetNetworkRequestEvent( | 88 virtual scoped_ptr<ProtocolEvent> GetNetworkRequestEvent( |
| 89 base::Time timestamp, | 89 base::Time timestamp, |
| 90 const sync_pb::ClientToServerMessage& request) const OVERRIDE; | 90 const sync_pb::ClientToServerMessage& request) const override; |
| 91 private: | 91 private: |
| 92 DISALLOW_COPY_AND_ASSIGN(ConfigureGetUpdatesDelegate); | 92 DISALLOW_COPY_AND_ASSIGN(ConfigureGetUpdatesDelegate); |
| 93 | 93 |
| 94 static sync_pb::SyncEnums::GetUpdatesOrigin ConvertConfigureSourceToOrigin( | 94 static sync_pb::SyncEnums::GetUpdatesOrigin ConvertConfigureSourceToOrigin( |
| 95 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); | 95 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); |
| 96 | 96 |
| 97 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source_; | 97 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source_; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 // Functionality specific to the poll GetUpdate request. | 100 // Functionality specific to the poll GetUpdate request. |
| 101 class SYNC_EXPORT_PRIVATE PollGetUpdatesDelegate : public GetUpdatesDelegate { | 101 class SYNC_EXPORT_PRIVATE PollGetUpdatesDelegate : public GetUpdatesDelegate { |
| 102 public: | 102 public: |
| 103 PollGetUpdatesDelegate(); | 103 PollGetUpdatesDelegate(); |
| 104 virtual ~PollGetUpdatesDelegate(); | 104 virtual ~PollGetUpdatesDelegate(); |
| 105 | 105 |
| 106 // Sets the 'source' and 'origin' to indicate this is a poll request. | 106 // Sets the 'source' and 'origin' to indicate this is a poll request. |
| 107 virtual void HelpPopulateGuMessage( | 107 virtual void HelpPopulateGuMessage( |
| 108 sync_pb::GetUpdatesMessage* get_updates) const OVERRIDE; | 108 sync_pb::GetUpdatesMessage* get_updates) const override; |
| 109 | 109 |
| 110 // Applies updates on the appropriate data type thread. | 110 // Applies updates on the appropriate data type thread. |
| 111 virtual void ApplyUpdates( | 111 virtual void ApplyUpdates( |
| 112 ModelTypeSet gu_types, | 112 ModelTypeSet gu_types, |
| 113 sessions::StatusController* status, | 113 sessions::StatusController* status, |
| 114 UpdateHandlerMap* update_handler_map) const OVERRIDE; | 114 UpdateHandlerMap* update_handler_map) const override; |
| 115 | 115 |
| 116 virtual scoped_ptr<ProtocolEvent> GetNetworkRequestEvent( | 116 virtual scoped_ptr<ProtocolEvent> GetNetworkRequestEvent( |
| 117 base::Time timestamp, | 117 base::Time timestamp, |
| 118 const sync_pb::ClientToServerMessage& request) const OVERRIDE; | 118 const sync_pb::ClientToServerMessage& request) const override; |
| 119 private: | 119 private: |
| 120 DISALLOW_COPY_AND_ASSIGN(PollGetUpdatesDelegate); | 120 DISALLOW_COPY_AND_ASSIGN(PollGetUpdatesDelegate); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 } // namespace syncer | 123 } // namespace syncer |
| 124 | 124 |
| 125 #endif // SYNC_ENGINE_GET_UPDATES_DELEGATE_H_ | 125 #endif // SYNC_ENGINE_GET_UPDATES_DELEGATE_H_ |
| OLD | NEW |