| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/dbus/bluetooth_gatt_application_service_provider.h" | 5 #include "device/bluetooth/dbus/bluetooth_gatt_application_service_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 for (const auto& service : services) { | 109 for (const auto& service : services) { |
| 110 service_providers_.push_back( | 110 service_providers_.push_back( |
| 111 base::WrapUnique(BluetoothGattServiceServiceProvider::Create( | 111 base::WrapUnique(BluetoothGattServiceServiceProvider::Create( |
| 112 bus, service.second->object_path(), | 112 bus, service.second->object_path(), |
| 113 service.second->GetUUID().value(), service.second->IsPrimary(), | 113 service.second->GetUUID().value(), service.second->IsPrimary(), |
| 114 std::vector<dbus::ObjectPath>()))); | 114 std::vector<dbus::ObjectPath>()))); |
| 115 for (const auto& characteristic : service.second->GetCharacteristics()) { | 115 for (const auto& characteristic : service.second->GetCharacteristics()) { |
| 116 characteristic_providers_.push_back( | 116 characteristic_providers_.push_back( |
| 117 base::WrapUnique(BluetoothGattCharacteristicServiceProvider::Create( | 117 base::WrapUnique(BluetoothGattCharacteristicServiceProvider::Create( |
| 118 bus, characteristic.second->object_path(), | 118 bus, characteristic.second->object_path(), |
| 119 base::WrapUnique(new BluetoothGattCharacteristicDelegateWrapper( | 119 base::MakeUnique<BluetoothGattCharacteristicDelegateWrapper>( |
| 120 service.second, characteristic.second.get())), | 120 service.second, characteristic.second.get()), |
| 121 characteristic.second->GetUUID().value(), | 121 characteristic.second->GetUUID().value(), |
| 122 FlagsFromProperties(characteristic.second->GetProperties()), | 122 FlagsFromProperties(characteristic.second->GetProperties()), |
| 123 service.second->object_path()))); | 123 service.second->object_path()))); |
| 124 for (const auto& descriptor : characteristic.second->GetDescriptors()) { | 124 for (const auto& descriptor : characteristic.second->GetDescriptors()) { |
| 125 descriptor_providers_.push_back( | 125 descriptor_providers_.push_back( |
| 126 base::WrapUnique(BluetoothGattDescriptorServiceProvider::Create( | 126 base::WrapUnique(BluetoothGattDescriptorServiceProvider::Create( |
| 127 bus, descriptor->object_path(), | 127 bus, descriptor->object_path(), |
| 128 base::WrapUnique(new BluetoothGattDescriptorDelegateWrapper( | 128 base::MakeUnique<BluetoothGattDescriptorDelegateWrapper>( |
| 129 service.second, descriptor.get())), | 129 service.second, descriptor.get()), |
| 130 descriptor->GetUUID().value(), | 130 descriptor->GetUUID().value(), |
| 131 FlagsFromPermissions(descriptor->GetPermissions()), | 131 FlagsFromPermissions(descriptor->GetPermissions()), |
| 132 characteristic.second->object_path()))); | 132 characteristic.second->object_path()))); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 void BluetoothGattApplicationServiceProvider::SendValueChanged( | 138 void BluetoothGattApplicationServiceProvider::SendValueChanged( |
| 139 const dbus::ObjectPath& characteristic_path, | 139 const dbus::ObjectPath& characteristic_path, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 154 std::unique_ptr<BluetoothGattApplicationServiceProvider> | 154 std::unique_ptr<BluetoothGattApplicationServiceProvider> |
| 155 BluetoothGattApplicationServiceProvider::Create( | 155 BluetoothGattApplicationServiceProvider::Create( |
| 156 dbus::Bus* bus, | 156 dbus::Bus* bus, |
| 157 const dbus::ObjectPath& object_path, | 157 const dbus::ObjectPath& object_path, |
| 158 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>& | 158 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>& |
| 159 services) { | 159 services) { |
| 160 if (!bluez::BluezDBusManager::Get()->IsUsingFakes()) { | 160 if (!bluez::BluezDBusManager::Get()->IsUsingFakes()) { |
| 161 return base::WrapUnique(new BluetoothGattApplicationServiceProviderImpl( | 161 return base::WrapUnique(new BluetoothGattApplicationServiceProviderImpl( |
| 162 bus, object_path, services)); | 162 bus, object_path, services)); |
| 163 } | 163 } |
| 164 return base::WrapUnique( | 164 return base::MakeUnique<FakeBluetoothGattApplicationServiceProvider>( |
| 165 new FakeBluetoothGattApplicationServiceProvider(object_path, services)); | 165 object_path, services); |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace bluez | 168 } // namespace bluez |
| OLD | NEW |