OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "device/bluetooth/bluetooth_device_win.h" | 5 #include "device/bluetooth/bluetooth_device_win.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 paired_ != device_state.authenticated) { | 232 paired_ != device_state.authenticated) { |
233 return false; | 233 return false; |
234 } | 234 } |
235 | 235 |
236 // Checks service collection | 236 // Checks service collection |
237 UUIDSet new_services; | 237 UUIDSet new_services; |
238 std::unordered_map<std::string, std::unique_ptr<BluetoothServiceRecordWin>> | 238 std::unordered_map<std::string, std::unique_ptr<BluetoothServiceRecordWin>> |
239 new_service_records; | 239 new_service_records; |
240 for (auto iter = device_state.service_record_states.begin(); | 240 for (auto iter = device_state.service_record_states.begin(); |
241 iter != device_state.service_record_states.end(); ++iter) { | 241 iter != device_state.service_record_states.end(); ++iter) { |
242 std::unique_ptr<BluetoothServiceRecordWin> service_record = | 242 auto service_record = base::MakeUnique<BluetoothServiceRecordWin>( |
243 base::MakeUnique<BluetoothServiceRecordWin>( | 243 address_, (*iter)->name, (*iter)->sdp_bytes, (*iter)->gatt_uuid); |
244 address_, (*iter)->name, (*iter)->sdp_bytes, (*iter)->gatt_uuid); | |
245 new_services.insert(service_record->uuid()); | 244 new_services.insert(service_record->uuid()); |
246 new_service_records[service_record->uuid().canonical_value()] = | 245 new_service_records[service_record->uuid().canonical_value()] = |
247 std::move(service_record); | 246 std::move(service_record); |
248 } | 247 } |
249 | 248 |
250 // Check that no new services have been added or removed. | 249 // Check that no new services have been added or removed. |
251 if (uuids_ != new_services) { | 250 if (uuids_ != new_services) { |
252 return false; | 251 return false; |
253 } | 252 } |
254 | 253 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 gatt_services_[primary_service->GetIdentifier()] = | 376 gatt_services_[primary_service->GetIdentifier()] = |
378 base::WrapUnique(primary_service); | 377 base::WrapUnique(primary_service); |
379 adapter_->NotifyGattServiceAdded(primary_service); | 378 adapter_->NotifyGattServiceAdded(primary_service); |
380 } | 379 } |
381 } | 380 } |
382 | 381 |
383 adapter_->NotifyGattServicesDiscovered(this); | 382 adapter_->NotifyGattServicesDiscovered(this); |
384 } | 383 } |
385 | 384 |
386 } // namespace device | 385 } // namespace device |
OLD | NEW |