| 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 #include "sync/engine/get_updates_delegate.h" | 5 #include "sync/engine/get_updates_delegate.h" |
| 6 | 6 |
| 7 #include "sync/engine/directory_update_handler.h" | 7 #include "sync/engine/directory_update_handler.h" |
| 8 #include "sync/engine/get_updates_processor.h" | 8 #include "sync/engine/get_updates_processor.h" |
| 9 #include "sync/internal_api/public/events/configure_get_updates_request_event.h" | 9 #include "sync/internal_api/public/events/configure_get_updates_request_event.h" |
| 10 #include "sync/internal_api/public/events/normal_get_updates_request_event.h" | 10 #include "sync/internal_api/public/events/normal_get_updates_request_event.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 void NormalGetUpdatesDelegate::ApplyUpdates( | 84 void NormalGetUpdatesDelegate::ApplyUpdates( |
| 85 ModelTypeSet gu_types, | 85 ModelTypeSet gu_types, |
| 86 sessions::StatusController* status_controller, | 86 sessions::StatusController* status_controller, |
| 87 UpdateHandlerMap* update_handler_map) const { | 87 UpdateHandlerMap* update_handler_map) const { |
| 88 NonPassiveApplyUpdates(gu_types, status_controller, update_handler_map); | 88 NonPassiveApplyUpdates(gu_types, status_controller, update_handler_map); |
| 89 } | 89 } |
| 90 | 90 |
| 91 scoped_ptr<ProtocolEvent> NormalGetUpdatesDelegate::GetNetworkRequestEvent( | 91 std::unique_ptr<ProtocolEvent> NormalGetUpdatesDelegate::GetNetworkRequestEvent( |
| 92 base::Time timestamp, | 92 base::Time timestamp, |
| 93 const sync_pb::ClientToServerMessage& request) const { | 93 const sync_pb::ClientToServerMessage& request) const { |
| 94 return scoped_ptr<ProtocolEvent>( | 94 return std::unique_ptr<ProtocolEvent>( |
| 95 new NormalGetUpdatesRequestEvent(timestamp, nudge_tracker_, request)); | 95 new NormalGetUpdatesRequestEvent(timestamp, nudge_tracker_, request)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 ConfigureGetUpdatesDelegate::ConfigureGetUpdatesDelegate( | 98 ConfigureGetUpdatesDelegate::ConfigureGetUpdatesDelegate( |
| 99 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) : source_(source) {} | 99 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) : source_(source) {} |
| 100 | 100 |
| 101 ConfigureGetUpdatesDelegate::~ConfigureGetUpdatesDelegate() {} | 101 ConfigureGetUpdatesDelegate::~ConfigureGetUpdatesDelegate() {} |
| 102 | 102 |
| 103 void ConfigureGetUpdatesDelegate::HelpPopulateGuMessage( | 103 void ConfigureGetUpdatesDelegate::HelpPopulateGuMessage( |
| 104 sync_pb::GetUpdatesMessage* get_updates) const { | 104 sync_pb::GetUpdatesMessage* get_updates) const { |
| 105 get_updates->mutable_caller_info()->set_source(source_); | 105 get_updates->mutable_caller_info()->set_source(source_); |
| 106 get_updates->set_get_updates_origin(ConvertConfigureSourceToOrigin(source_)); | 106 get_updates->set_get_updates_origin(ConvertConfigureSourceToOrigin(source_)); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void ConfigureGetUpdatesDelegate::ApplyUpdates( | 109 void ConfigureGetUpdatesDelegate::ApplyUpdates( |
| 110 ModelTypeSet gu_types, | 110 ModelTypeSet gu_types, |
| 111 sessions::StatusController* status_controller, | 111 sessions::StatusController* status_controller, |
| 112 UpdateHandlerMap* update_handler_map) const { | 112 UpdateHandlerMap* update_handler_map) const { |
| 113 PassiveApplyUpdates(gu_types, status_controller, update_handler_map); | 113 PassiveApplyUpdates(gu_types, status_controller, update_handler_map); |
| 114 } | 114 } |
| 115 | 115 |
| 116 scoped_ptr<ProtocolEvent> ConfigureGetUpdatesDelegate::GetNetworkRequestEvent( | 116 std::unique_ptr<ProtocolEvent> |
| 117 ConfigureGetUpdatesDelegate::GetNetworkRequestEvent( |
| 117 base::Time timestamp, | 118 base::Time timestamp, |
| 118 const sync_pb::ClientToServerMessage& request) const { | 119 const sync_pb::ClientToServerMessage& request) const { |
| 119 return scoped_ptr<ProtocolEvent>( | 120 return std::unique_ptr<ProtocolEvent>(new ConfigureGetUpdatesRequestEvent( |
| 120 new ConfigureGetUpdatesRequestEvent( | 121 timestamp, ConvertConfigureSourceToOrigin(source_), request)); |
| 121 timestamp, | |
| 122 ConvertConfigureSourceToOrigin(source_), | |
| 123 request)); | |
| 124 } | 122 } |
| 125 | 123 |
| 126 sync_pb::SyncEnums::GetUpdatesOrigin | 124 sync_pb::SyncEnums::GetUpdatesOrigin |
| 127 ConfigureGetUpdatesDelegate::ConvertConfigureSourceToOrigin( | 125 ConfigureGetUpdatesDelegate::ConvertConfigureSourceToOrigin( |
| 128 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { | 126 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { |
| 129 switch (source) { | 127 switch (source) { |
| 130 // Configurations: | 128 // Configurations: |
| 131 case sync_pb::GetUpdatesCallerInfo::NEWLY_SUPPORTED_DATATYPE: | 129 case sync_pb::GetUpdatesCallerInfo::NEWLY_SUPPORTED_DATATYPE: |
| 132 return sync_pb::SyncEnums::NEWLY_SUPPORTED_DATATYPE; | 130 return sync_pb::SyncEnums::NEWLY_SUPPORTED_DATATYPE; |
| 133 case sync_pb::GetUpdatesCallerInfo::MIGRATION: | 131 case sync_pb::GetUpdatesCallerInfo::MIGRATION: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 158 get_updates->set_get_updates_origin(sync_pb::SyncEnums::PERIODIC); | 156 get_updates->set_get_updates_origin(sync_pb::SyncEnums::PERIODIC); |
| 159 } | 157 } |
| 160 | 158 |
| 161 void PollGetUpdatesDelegate::ApplyUpdates( | 159 void PollGetUpdatesDelegate::ApplyUpdates( |
| 162 ModelTypeSet gu_types, | 160 ModelTypeSet gu_types, |
| 163 sessions::StatusController* status_controller, | 161 sessions::StatusController* status_controller, |
| 164 UpdateHandlerMap* update_handler_map) const { | 162 UpdateHandlerMap* update_handler_map) const { |
| 165 NonPassiveApplyUpdates(gu_types, status_controller, update_handler_map); | 163 NonPassiveApplyUpdates(gu_types, status_controller, update_handler_map); |
| 166 } | 164 } |
| 167 | 165 |
| 168 scoped_ptr<ProtocolEvent> PollGetUpdatesDelegate::GetNetworkRequestEvent( | 166 std::unique_ptr<ProtocolEvent> PollGetUpdatesDelegate::GetNetworkRequestEvent( |
| 169 base::Time timestamp, | 167 base::Time timestamp, |
| 170 const sync_pb::ClientToServerMessage& request) const { | 168 const sync_pb::ClientToServerMessage& request) const { |
| 171 return scoped_ptr<ProtocolEvent>( | 169 return std::unique_ptr<ProtocolEvent>( |
| 172 new PollGetUpdatesRequestEvent(timestamp, request)); | 170 new PollGetUpdatesRequestEvent(timestamp, request)); |
| 173 } | 171 } |
| 174 | 172 |
| 175 } // namespace syncer | 173 } // namespace syncer |
| OLD | NEW |