| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_service.h" | 5 #include "components/sync/device_info/device_info_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 void DeviceInfoService::RemoveObserver(Observer* observer) { | 210 void DeviceInfoService::RemoveObserver(Observer* observer) { |
| 211 observers_.RemoveObserver(observer); | 211 observers_.RemoveObserver(observer); |
| 212 } | 212 } |
| 213 | 213 |
| 214 int DeviceInfoService::CountActiveDevices() const { | 214 int DeviceInfoService::CountActiveDevices() const { |
| 215 return CountActiveDevices(Time::Now()); | 215 return CountActiveDevices(Time::Now()); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void DeviceInfoService::NotifyObservers() { | 218 void DeviceInfoService::NotifyObservers() { |
| 219 FOR_EACH_OBSERVER(Observer, observers_, OnDeviceInfoChange()); | 219 for (auto& observer : observers_) |
| 220 observer.OnDeviceInfoChange(); |
| 220 } | 221 } |
| 221 | 222 |
| 222 // Static. | 223 // Static. |
| 223 std::unique_ptr<DeviceInfoSpecifics> DeviceInfoService::CopyToSpecifics( | 224 std::unique_ptr<DeviceInfoSpecifics> DeviceInfoService::CopyToSpecifics( |
| 224 const DeviceInfo& info) { | 225 const DeviceInfo& info) { |
| 225 std::unique_ptr<DeviceInfoSpecifics> specifics = | 226 std::unique_ptr<DeviceInfoSpecifics> specifics = |
| 226 base::WrapUnique(new DeviceInfoSpecifics); | 227 base::WrapUnique(new DeviceInfoSpecifics); |
| 227 specifics->set_cache_guid(info.guid()); | 228 specifics->set_cache_guid(info.guid()); |
| 228 specifics->set_client_name(info.client_name()); | 229 specifics->set_client_name(info.client_name()); |
| 229 specifics->set_chrome_version(info.chrome_version()); | 230 specifics->set_chrome_version(info.chrome_version()); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 Time DeviceInfoService::GetLastUpdateTime( | 460 Time DeviceInfoService::GetLastUpdateTime( |
| 460 const DeviceInfoSpecifics& specifics) { | 461 const DeviceInfoSpecifics& specifics) { |
| 461 if (specifics.has_last_updated_timestamp()) { | 462 if (specifics.has_last_updated_timestamp()) { |
| 462 return ProtoTimeToTime(specifics.last_updated_timestamp()); | 463 return ProtoTimeToTime(specifics.last_updated_timestamp()); |
| 463 } else { | 464 } else { |
| 464 return Time(); | 465 return Time(); |
| 465 } | 466 } |
| 466 } | 467 } |
| 467 | 468 |
| 468 } // namespace syncer | 469 } // namespace syncer |
| OLD | NEW |