| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 void DeviceInfoSyncService::RemoveObserver(Observer* observer) { | 218 void DeviceInfoSyncService::RemoveObserver(Observer* observer) { |
| 219 observers_.RemoveObserver(observer); | 219 observers_.RemoveObserver(observer); |
| 220 } | 220 } |
| 221 | 221 |
| 222 int DeviceInfoSyncService::CountActiveDevices() const { | 222 int DeviceInfoSyncService::CountActiveDevices() const { |
| 223 return CountActiveDevices(Time::Now()); | 223 return CountActiveDevices(Time::Now()); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void DeviceInfoSyncService::NotifyObservers() { | 226 void DeviceInfoSyncService::NotifyObservers() { |
| 227 FOR_EACH_OBSERVER(Observer, observers_, OnDeviceInfoChange()); | 227 for (auto& observer : observers_) |
| 228 observer.OnDeviceInfoChange(); |
| 228 } | 229 } |
| 229 | 230 |
| 230 SyncData DeviceInfoSyncService::CreateLocalData(const DeviceInfo* info) { | 231 SyncData DeviceInfoSyncService::CreateLocalData(const DeviceInfo* info) { |
| 231 sync_pb::EntitySpecifics entity; | 232 sync_pb::EntitySpecifics entity; |
| 232 sync_pb::DeviceInfoSpecifics& specifics = *entity.mutable_device_info(); | 233 sync_pb::DeviceInfoSpecifics& specifics = *entity.mutable_device_info(); |
| 233 | 234 |
| 234 specifics.set_cache_guid(info->guid()); | 235 specifics.set_cache_guid(info->guid()); |
| 235 specifics.set_client_name(info->client_name()); | 236 specifics.set_client_name(info->client_name()); |
| 236 specifics.set_chrome_version(info->chrome_version()); | 237 specifics.set_chrome_version(info->chrome_version()); |
| 237 specifics.set_sync_user_agent(info->sync_user_agent()); | 238 specifics.set_sync_user_agent(info->sync_user_agent()); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 return SyncDataRemote(device_info).GetModifiedTime(); | 316 return SyncDataRemote(device_info).GetModifiedTime(); |
| 316 } else { | 317 } else { |
| 317 // We shouldn't reach this point for remote data, so this means we're likely | 318 // We shouldn't reach this point for remote data, so this means we're likely |
| 318 // looking at the local device info. Using a long ago time is perfect, since | 319 // looking at the local device info. Using a long ago time is perfect, since |
| 319 // the desired behavior is to update/pulse our data as soon as possible. | 320 // the desired behavior is to update/pulse our data as soon as possible. |
| 320 return Time(); | 321 return Time(); |
| 321 } | 322 } |
| 322 } | 323 } |
| 323 | 324 |
| 324 } // namespace syncer | 325 } // namespace syncer |
| OLD | NEW |