| 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_driver/device_info_service.h" | 5 #include "components/sync_driver/device_info_service.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "sync/api/model_type_change_processor.h" | 10 #include "sync/api/model_type_change_processor.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 return make_scoped_ptr(new DeviceInfo( | 172 return make_scoped_ptr(new DeviceInfo( |
| 173 specifics.cache_guid(), specifics.client_name(), | 173 specifics.cache_guid(), specifics.client_name(), |
| 174 specifics.chrome_version(), specifics.sync_user_agent(), | 174 specifics.chrome_version(), specifics.sync_user_agent(), |
| 175 specifics.device_type(), specifics.signin_scoped_device_id())); | 175 specifics.device_type(), specifics.signin_scoped_device_id())); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void DeviceInfoService::StoreSpecifics( | 178 void DeviceInfoService::StoreSpecifics( |
| 179 scoped_ptr<DeviceInfoSpecifics> specifics) { | 179 scoped_ptr<DeviceInfoSpecifics> specifics) { |
| 180 DVLOG(1) << "Storing DEVICE_INFO for " << specifics->client_name() | 180 DVLOG(1) << "Storing DEVICE_INFO for " << specifics->client_name() |
| 181 << " with ID " << specifics->cache_guid(); | 181 << " with ID " << specifics->cache_guid(); |
| 182 const std::string& key = specifics->cache_guid(); | 182 all_data_[specifics->cache_guid()] = std::move(specifics); |
| 183 all_data_.set(key, specifics.Pass()); | |
| 184 } | 183 } |
| 185 | 184 |
| 186 void DeviceInfoService::DeleteSpecifics(const std::string& client_id) { | 185 void DeviceInfoService::DeleteSpecifics(const std::string& client_id) { |
| 187 ClientIdToSpecifics::const_iterator iter = all_data_.find(client_id); | 186 ClientIdToSpecifics::const_iterator iter = all_data_.find(client_id); |
| 188 if (iter != all_data_.end()) { | 187 if (iter != all_data_.end()) { |
| 189 DVLOG(1) << "Deleting DEVICE_INFO for " << iter->second->client_name() | 188 DVLOG(1) << "Deleting DEVICE_INFO for " << iter->second->client_name() |
| 190 << " with ID " << client_id; | 189 << " with ID " << client_id; |
| 191 all_data_.erase(iter); | 190 all_data_.erase(iter); |
| 192 } | 191 } |
| 193 } | 192 } |
| 194 | 193 |
| 195 void DeviceInfoService::OnProviderInitialized() { | 194 void DeviceInfoService::OnProviderInitialized() { |
| 196 // TODO(skym): Do we need this? | 195 // TODO(skym): Do we need this? |
| 197 } | 196 } |
| 198 | 197 |
| 199 } // namespace sync_driver_v2 | 198 } // namespace sync_driver_v2 |
| OLD | NEW |