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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 << " with ID " << guid; | 270 << " with ID " << guid; |
271 store_->DeleteData(batch, guid); | 271 store_->DeleteData(batch, guid); |
272 all_data_.erase(iter); | 272 all_data_.erase(iter); |
273 return true; | 273 return true; |
274 } else { | 274 } else { |
275 return false; | 275 return false; |
276 } | 276 } |
277 } | 277 } |
278 | 278 |
279 void DeviceInfoService::OnProviderInitialized() { | 279 void DeviceInfoService::OnProviderInitialized() { |
| 280 // Now that the provider has initialized, remove the subscription. The service |
| 281 // should only need to give the processor metadata upon initialization. If |
| 282 // sync is disabled and enabled, our provider will try to retrigger this |
| 283 // event, but we do not want to send any more metadata to the processor. |
| 284 subscription_.reset(); |
| 285 |
280 has_provider_initialized_ = true; | 286 has_provider_initialized_ = true; |
281 LoadMetadataIfReady(); | 287 LoadMetadataIfReady(); |
282 } | 288 } |
283 | 289 |
284 void DeviceInfoService::OnStoreCreated(Result result, | 290 void DeviceInfoService::OnStoreCreated(Result result, |
285 std::unique_ptr<ModelTypeStore> store) { | 291 std::unique_ptr<ModelTypeStore> store) { |
286 if (result == Result::SUCCESS) { | 292 if (result == Result::SUCCESS) { |
287 std::swap(store_, store); | 293 std::swap(store_, store); |
288 store_->ReadAllData( | 294 store_->ReadAllData( |
289 base::Bind(&DeviceInfoService::OnReadAllData, base::AsWeakPtr(this))); | 295 base::Bind(&DeviceInfoService::OnReadAllData, base::AsWeakPtr(this))); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 Time DeviceInfoService::GetLastUpdateTime( | 466 Time DeviceInfoService::GetLastUpdateTime( |
461 const DeviceInfoSpecifics& specifics) { | 467 const DeviceInfoSpecifics& specifics) { |
462 if (specifics.has_last_updated_timestamp()) { | 468 if (specifics.has_last_updated_timestamp()) { |
463 return ProtoTimeToTime(specifics.last_updated_timestamp()); | 469 return ProtoTimeToTime(specifics.last_updated_timestamp()); |
464 } else { | 470 } else { |
465 return Time(); | 471 return Time(); |
466 } | 472 } |
467 } | 473 } |
468 | 474 |
469 } // namespace syncer | 475 } // namespace syncer |
OLD | NEW |