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 "chrome/browser/sync/glue/local_device_info_provider_impl.h" | 5 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" |
6 | 6 |
7 namespace browser_sync { | 7 namespace browser_sync { |
8 | 8 |
9 LocalDeviceInfoProviderImpl::LocalDeviceInfoProviderImpl() | 9 LocalDeviceInfoProviderImpl::LocalDeviceInfoProviderImpl() |
10 : weak_factory_(this) { | 10 : weak_factory_(this) { |
(...skipping 24 matching lines...) Expand all Loading... |
35 cache_guid_ = cache_guid; | 35 cache_guid_ = cache_guid; |
36 DeviceInfo::CreateLocalDeviceInfo( | 36 DeviceInfo::CreateLocalDeviceInfo( |
37 cache_guid_, | 37 cache_guid_, |
38 signin_scoped_device_id, | 38 signin_scoped_device_id, |
39 base::Bind(&LocalDeviceInfoProviderImpl::InitializeContinuation, | 39 base::Bind(&LocalDeviceInfoProviderImpl::InitializeContinuation, |
40 weak_factory_.GetWeakPtr())); | 40 weak_factory_.GetWeakPtr())); |
41 } | 41 } |
42 | 42 |
43 void LocalDeviceInfoProviderImpl::InitializeContinuation( | 43 void LocalDeviceInfoProviderImpl::InitializeContinuation( |
44 const DeviceInfo& local_info) { | 44 const DeviceInfo& local_info) { |
45 // Copy constructor is disallowed in DeviceInfo, construct a new one from | 45 // Make a copy of |local_info|. |
46 // the fields passed in local_info. | 46 local_device_info_.reset(local_info.Clone()); |
47 local_device_info_.reset( | |
48 new DeviceInfo( | |
49 local_info.guid(), | |
50 local_info.client_name(), | |
51 local_info.chrome_version(), | |
52 local_info.sync_user_agent(), | |
53 local_info.device_type(), | |
54 local_info.signin_scoped_device_id())); | |
55 | |
56 // Notify observers. | 47 // Notify observers. |
57 callback_list_.Notify(); | 48 callback_list_.Notify(); |
58 } | 49 } |
59 | 50 |
60 } // namespace browser_sync | 51 } // namespace browser_sync |
61 | 52 |
OLD | NEW |