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 "device/bluetooth/bluetooth_adapter_profile_bluez.h" | 5 #include "device/bluetooth/bluetooth_adapter_profile_bluez.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
12 #include "dbus/bus.h" | 13 #include "dbus/bus.h" |
13 #include "dbus/object_path.h" | 14 #include "dbus/object_path.h" |
14 #include "device/bluetooth/bluetooth_adapter_bluez.h" | 15 #include "device/bluetooth/bluetooth_adapter_bluez.h" |
15 #include "device/bluetooth/bluetooth_uuid.h" | 16 #include "device/bluetooth/bluetooth_uuid.h" |
16 #include "device/bluetooth/dbus/bluetooth_profile_service_provider.h" | 17 #include "device/bluetooth/dbus/bluetooth_profile_service_provider.h" |
17 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 18 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 if (delegates_.find(device_path.value()) == delegates_.end()) | 119 if (delegates_.find(device_path.value()) == delegates_.end()) |
119 delegate_path = dbus::ObjectPath(""); | 120 delegate_path = dbus::ObjectPath(""); |
120 | 121 |
121 if (delegates_.find(delegate_path.value()) == delegates_.end()) { | 122 if (delegates_.find(delegate_path.value()) == delegates_.end()) { |
122 VLOG(1) << object_path_.value() << ": New connection for device " | 123 VLOG(1) << object_path_.value() << ": New connection for device " |
123 << device_path.value() << " which has no delegates!"; | 124 << device_path.value() << " which has no delegates!"; |
124 callback.Run(REJECTED); | 125 callback.Run(REJECTED); |
125 return; | 126 return; |
126 } | 127 } |
127 | 128 |
128 delegates_[delegate_path.value()]->NewConnection(device_path, fd.Pass(), | 129 delegates_[delegate_path.value()]->NewConnection(device_path, std::move(fd), |
129 options, callback); | 130 options, callback); |
130 } | 131 } |
131 | 132 |
132 void BluetoothAdapterProfileBlueZ::RequestDisconnection( | 133 void BluetoothAdapterProfileBlueZ::RequestDisconnection( |
133 const dbus::ObjectPath& device_path, | 134 const dbus::ObjectPath& device_path, |
134 const ConfirmationCallback& callback) { | 135 const ConfirmationCallback& callback) { |
135 dbus::ObjectPath delegate_path = device_path; | 136 dbus::ObjectPath delegate_path = device_path; |
136 | 137 |
137 if (delegates_.find(device_path.value()) == delegates_.end()) | 138 if (delegates_.find(device_path.value()) == delegates_.end()) |
138 delegate_path = dbus::ObjectPath(""); | 139 delegate_path = dbus::ObjectPath(""); |
(...skipping 12 matching lines...) Expand all Loading... |
151 // Cancel() should only go to a delegate accepting connections. | 152 // Cancel() should only go to a delegate accepting connections. |
152 if (delegates_.find("") == delegates_.end()) { | 153 if (delegates_.find("") == delegates_.end()) { |
153 VLOG(1) << object_path_.value() << ": Cancel with no delegate!"; | 154 VLOG(1) << object_path_.value() << ": Cancel with no delegate!"; |
154 return; | 155 return; |
155 } | 156 } |
156 | 157 |
157 delegates_[""]->Cancel(); | 158 delegates_[""]->Cancel(); |
158 } | 159 } |
159 | 160 |
160 } // namespace bluez | 161 } // namespace bluez |
OLD | NEW |