| 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 "components/sync/device_info/device_info_sync_service.h" | 5 #include "components/sync/device_info/device_info_sync_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 std::unique_ptr<DeviceInfo> DeviceInfoSyncService::GetDeviceInfo( | 203 std::unique_ptr<DeviceInfo> DeviceInfoSyncService::GetDeviceInfo( |
| 204 const std::string& client_id) const { | 204 const std::string& client_id) const { |
| 205 SyncDataMap::const_iterator iter = all_data_.find(client_id); | 205 SyncDataMap::const_iterator iter = all_data_.find(client_id); |
| 206 if (iter == all_data_.end()) { | 206 if (iter == all_data_.end()) { |
| 207 return std::unique_ptr<DeviceInfo>(); | 207 return std::unique_ptr<DeviceInfo>(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 return base::WrapUnique(CreateDeviceInfo(iter->second)); | 210 return base::WrapUnique(CreateDeviceInfo(iter->second)); |
| 211 } | 211 } |
| 212 | 212 |
| 213 ScopedVector<DeviceInfo> DeviceInfoSyncService::GetAllDeviceInfo() const { | 213 std::vector<std::unique_ptr<DeviceInfo>> |
| 214 ScopedVector<DeviceInfo> list; | 214 DeviceInfoSyncService::GetAllDeviceInfo() const { |
| 215 std::vector<std::unique_ptr<DeviceInfo>> list; |
| 215 | 216 |
| 216 for (SyncDataMap::const_iterator iter = all_data_.begin(); | 217 for (SyncDataMap::const_iterator iter = all_data_.begin(); |
| 217 iter != all_data_.end(); ++iter) { | 218 iter != all_data_.end(); ++iter) { |
| 218 list.push_back(CreateDeviceInfo(iter->second)); | 219 list.push_back(base::WrapUnique(CreateDeviceInfo(iter->second))); |
| 219 } | 220 } |
| 220 | 221 |
| 221 return list; | 222 return list; |
| 222 } | 223 } |
| 223 | 224 |
| 224 void DeviceInfoSyncService::AddObserver(Observer* observer) { | 225 void DeviceInfoSyncService::AddObserver(Observer* observer) { |
| 225 observers_.AddObserver(observer); | 226 observers_.AddObserver(observer); |
| 226 } | 227 } |
| 227 | 228 |
| 228 void DeviceInfoSyncService::RemoveObserver(Observer* observer) { | 229 void DeviceInfoSyncService::RemoveObserver(Observer* observer) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 return syncer::SyncDataRemote(device_info).GetModifiedTime(); | 327 return syncer::SyncDataRemote(device_info).GetModifiedTime(); |
| 327 } else { | 328 } else { |
| 328 // We shouldn't reach this point for remote data, so this means we're likely | 329 // We shouldn't reach this point for remote data, so this means we're likely |
| 329 // looking at the local device info. Using a long ago time is perfect, since | 330 // looking at the local device info. Using a long ago time is perfect, since |
| 330 // the desired behavior is to update/pulse our data as soon as possible. | 331 // the desired behavior is to update/pulse our data as soon as possible. |
| 331 return Time(); | 332 return Time(); |
| 332 } | 333 } |
| 333 } | 334 } |
| 334 | 335 |
| 335 } // namespace sync_driver | 336 } // namespace sync_driver |
| OLD | NEW |