| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chromeos/dbus/bluetooth_agent_service_provider.h" | 5 #include "device/bluetooth/dbus/bluetooth_agent_service_provider.h" |
| 6 | |
| 7 | 6 |
| 8 #include "base/bind.h" | 7 #include "base/bind.h" |
| 9 #include "base/logging.h" | 8 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 11 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
| 12 #include "chromeos/dbus/dbus_thread_manager.h" | |
| 13 #include "chromeos/dbus/fake_bluetooth_agent_service_provider.h" | |
| 14 #include "dbus/exported_object.h" | 11 #include "dbus/exported_object.h" |
| 15 #include "dbus/message.h" | 12 #include "dbus/message.h" |
| 13 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 14 #include "device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h" |
| 16 #include "third_party/cros_system_api/dbus/service_constants.h" | 15 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 17 | 16 |
| 18 namespace chromeos { | 17 namespace bluez { |
| 19 | 18 |
| 20 // The BluetoothAgentServiceProvider implementation used in production. | 19 // The BluetoothAgentServiceProvider implementation used in production. |
| 21 class BluetoothAgentServiceProviderImpl | 20 class BluetoothAgentServiceProviderImpl : public BluetoothAgentServiceProvider { |
| 22 : public BluetoothAgentServiceProvider { | |
| 23 public: | 21 public: |
| 24 BluetoothAgentServiceProviderImpl(dbus::Bus* bus, | 22 BluetoothAgentServiceProviderImpl(dbus::Bus* bus, |
| 25 const dbus::ObjectPath& object_path, | 23 const dbus::ObjectPath& object_path, |
| 26 Delegate* delegate) | 24 Delegate* delegate) |
| 27 : origin_thread_id_(base::PlatformThread::CurrentId()), | 25 : origin_thread_id_(base::PlatformThread::CurrentId()), |
| 28 bus_(bus), | 26 bus_(bus), |
| 29 delegate_(delegate), | 27 delegate_(delegate), |
| 30 object_path_(object_path), | 28 object_path_(object_path), |
| 31 weak_ptr_factory_(this) { | 29 weak_ptr_factory_(this) { |
| 32 VLOG(1) << "Creating Bluetooth Agent: " << object_path_.value(); | 30 VLOG(1) << "Creating Bluetooth Agent: " << object_path_.value(); |
| 33 | 31 |
| 34 exported_object_ = bus_->GetExportedObject(object_path_); | 32 exported_object_ = bus_->GetExportedObject(object_path_); |
| 35 | 33 |
| 36 exported_object_->ExportMethod( | 34 exported_object_->ExportMethod( |
| 37 bluetooth_agent::kBluetoothAgentInterface, | 35 bluetooth_agent::kBluetoothAgentInterface, bluetooth_agent::kRelease, |
| 38 bluetooth_agent::kRelease, | |
| 39 base::Bind(&BluetoothAgentServiceProviderImpl::Release, | 36 base::Bind(&BluetoothAgentServiceProviderImpl::Release, |
| 40 weak_ptr_factory_.GetWeakPtr()), | 37 weak_ptr_factory_.GetWeakPtr()), |
| 41 base::Bind(&BluetoothAgentServiceProviderImpl::OnExported, | 38 base::Bind(&BluetoothAgentServiceProviderImpl::OnExported, |
| 42 weak_ptr_factory_.GetWeakPtr())); | 39 weak_ptr_factory_.GetWeakPtr())); |
| 43 | 40 |
| 44 exported_object_->ExportMethod( | 41 exported_object_->ExportMethod( |
| 45 bluetooth_agent::kBluetoothAgentInterface, | 42 bluetooth_agent::kBluetoothAgentInterface, |
| 46 bluetooth_agent::kRequestPinCode, | 43 bluetooth_agent::kRequestPinCode, |
| 47 base::Bind(&BluetoothAgentServiceProviderImpl::RequestPinCode, | 44 base::Bind(&BluetoothAgentServiceProviderImpl::RequestPinCode, |
| 48 weak_ptr_factory_.GetWeakPtr()), | 45 weak_ptr_factory_.GetWeakPtr()), |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 88 |
| 92 exported_object_->ExportMethod( | 89 exported_object_->ExportMethod( |
| 93 bluetooth_agent::kBluetoothAgentInterface, | 90 bluetooth_agent::kBluetoothAgentInterface, |
| 94 bluetooth_agent::kAuthorizeService, | 91 bluetooth_agent::kAuthorizeService, |
| 95 base::Bind(&BluetoothAgentServiceProviderImpl::AuthorizeService, | 92 base::Bind(&BluetoothAgentServiceProviderImpl::AuthorizeService, |
| 96 weak_ptr_factory_.GetWeakPtr()), | 93 weak_ptr_factory_.GetWeakPtr()), |
| 97 base::Bind(&BluetoothAgentServiceProviderImpl::OnExported, | 94 base::Bind(&BluetoothAgentServiceProviderImpl::OnExported, |
| 98 weak_ptr_factory_.GetWeakPtr())); | 95 weak_ptr_factory_.GetWeakPtr())); |
| 99 | 96 |
| 100 exported_object_->ExportMethod( | 97 exported_object_->ExportMethod( |
| 101 bluetooth_agent::kBluetoothAgentInterface, | 98 bluetooth_agent::kBluetoothAgentInterface, bluetooth_agent::kCancel, |
| 102 bluetooth_agent::kCancel, | |
| 103 base::Bind(&BluetoothAgentServiceProviderImpl::Cancel, | 99 base::Bind(&BluetoothAgentServiceProviderImpl::Cancel, |
| 104 weak_ptr_factory_.GetWeakPtr()), | 100 weak_ptr_factory_.GetWeakPtr()), |
| 105 base::Bind(&BluetoothAgentServiceProviderImpl::OnExported, | 101 base::Bind(&BluetoothAgentServiceProviderImpl::OnExported, |
| 106 weak_ptr_factory_.GetWeakPtr())); | 102 weak_ptr_factory_.GetWeakPtr())); |
| 107 } | 103 } |
| 108 | 104 |
| 109 ~BluetoothAgentServiceProviderImpl() override { | 105 ~BluetoothAgentServiceProviderImpl() override { |
| 110 VLOG(1) << "Cleaning up Bluetooth Agent: " << object_path_.value(); | 106 VLOG(1) << "Cleaning up Bluetooth Agent: " << object_path_.value(); |
| 111 | 107 |
| 112 // Unregister the object path so we can reuse with a new agent. | 108 // Unregister the object path so we can reuse with a new agent. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 141 dbus::MessageReader reader(method_call); | 137 dbus::MessageReader reader(method_call); |
| 142 dbus::ObjectPath device_path; | 138 dbus::ObjectPath device_path; |
| 143 if (!reader.PopObjectPath(&device_path)) { | 139 if (!reader.PopObjectPath(&device_path)) { |
| 144 LOG(WARNING) << "RequestPinCode called with incorrect paramters: " | 140 LOG(WARNING) << "RequestPinCode called with incorrect paramters: " |
| 145 << method_call->ToString(); | 141 << method_call->ToString(); |
| 146 return; | 142 return; |
| 147 } | 143 } |
| 148 | 144 |
| 149 Delegate::PinCodeCallback callback = base::Bind( | 145 Delegate::PinCodeCallback callback = base::Bind( |
| 150 &BluetoothAgentServiceProviderImpl::OnPinCode, | 146 &BluetoothAgentServiceProviderImpl::OnPinCode, |
| 151 weak_ptr_factory_.GetWeakPtr(), | 147 weak_ptr_factory_.GetWeakPtr(), method_call, response_sender); |
| 152 method_call, | |
| 153 response_sender); | |
| 154 | 148 |
| 155 delegate_->RequestPinCode(device_path, callback); | 149 delegate_->RequestPinCode(device_path, callback); |
| 156 } | 150 } |
| 157 | 151 |
| 158 // Called by dbus:: when the Bluetooth daemon requires that the user | 152 // Called by dbus:: when the Bluetooth daemon requires that the user |
| 159 // enter a PIN Code into the remote device so that it may be | 153 // enter a PIN Code into the remote device so that it may be |
| 160 // authenticated. | 154 // authenticated. |
| 161 void DisplayPinCode(dbus::MethodCall* method_call, | 155 void DisplayPinCode(dbus::MethodCall* method_call, |
| 162 dbus::ExportedObject::ResponseSender response_sender) { | 156 dbus::ExportedObject::ResponseSender response_sender) { |
| 163 DCHECK(OnOriginThread()); | 157 DCHECK(OnOriginThread()); |
| 164 DCHECK(delegate_); | 158 DCHECK(delegate_); |
| 165 | 159 |
| 166 dbus::MessageReader reader(method_call); | 160 dbus::MessageReader reader(method_call); |
| 167 dbus::ObjectPath device_path; | 161 dbus::ObjectPath device_path; |
| 168 std::string pincode; | 162 std::string pincode; |
| 169 if (!reader.PopObjectPath(&device_path) || | 163 if (!reader.PopObjectPath(&device_path) || !reader.PopString(&pincode)) { |
| 170 !reader.PopString(&pincode)) { | |
| 171 LOG(WARNING) << "DisplayPinCode called with incorrect paramters: " | 164 LOG(WARNING) << "DisplayPinCode called with incorrect paramters: " |
| 172 << method_call->ToString(); | 165 << method_call->ToString(); |
| 173 return; | 166 return; |
| 174 } | 167 } |
| 175 | 168 |
| 176 delegate_->DisplayPinCode(device_path, pincode); | 169 delegate_->DisplayPinCode(device_path, pincode); |
| 177 | 170 |
| 178 response_sender.Run(dbus::Response::FromMethodCall(method_call)); | 171 response_sender.Run(dbus::Response::FromMethodCall(method_call)); |
| 179 } | 172 } |
| 180 | 173 |
| 181 // Called by dbus:: when the Bluetooth daemon requires a Passkey for | 174 // Called by dbus:: when the Bluetooth daemon requires a Passkey for |
| 182 // device authentication. | 175 // device authentication. |
| 183 void RequestPasskey(dbus::MethodCall* method_call, | 176 void RequestPasskey(dbus::MethodCall* method_call, |
| 184 dbus::ExportedObject::ResponseSender response_sender) { | 177 dbus::ExportedObject::ResponseSender response_sender) { |
| 185 DCHECK(OnOriginThread()); | 178 DCHECK(OnOriginThread()); |
| 186 DCHECK(delegate_); | 179 DCHECK(delegate_); |
| 187 | 180 |
| 188 dbus::MessageReader reader(method_call); | 181 dbus::MessageReader reader(method_call); |
| 189 dbus::ObjectPath device_path; | 182 dbus::ObjectPath device_path; |
| 190 if (!reader.PopObjectPath(&device_path)) { | 183 if (!reader.PopObjectPath(&device_path)) { |
| 191 LOG(WARNING) << "RequestPasskey called with incorrect paramters: " | 184 LOG(WARNING) << "RequestPasskey called with incorrect paramters: " |
| 192 << method_call->ToString(); | 185 << method_call->ToString(); |
| 193 return; | 186 return; |
| 194 } | 187 } |
| 195 | 188 |
| 196 Delegate::PasskeyCallback callback = base::Bind( | 189 Delegate::PasskeyCallback callback = base::Bind( |
| 197 &BluetoothAgentServiceProviderImpl::OnPasskey, | 190 &BluetoothAgentServiceProviderImpl::OnPasskey, |
| 198 weak_ptr_factory_.GetWeakPtr(), | 191 weak_ptr_factory_.GetWeakPtr(), method_call, response_sender); |
| 199 method_call, | |
| 200 response_sender); | |
| 201 | 192 |
| 202 delegate_->RequestPasskey(device_path, callback); | 193 delegate_->RequestPasskey(device_path, callback); |
| 203 } | 194 } |
| 204 | 195 |
| 205 // Called by dbus:: when the Bluetooth daemon requires that the user | 196 // Called by dbus:: when the Bluetooth daemon requires that the user |
| 206 // enter a Passkey into the remote device so that it may be | 197 // enter a Passkey into the remote device so that it may be |
| 207 // authenticated. | 198 // authenticated. |
| 208 void DisplayPasskey(dbus::MethodCall* method_call, | 199 void DisplayPasskey(dbus::MethodCall* method_call, |
| 209 dbus::ExportedObject::ResponseSender response_sender) { | 200 dbus::ExportedObject::ResponseSender response_sender) { |
| 210 DCHECK(OnOriginThread()); | 201 DCHECK(OnOriginThread()); |
| 211 DCHECK(delegate_); | 202 DCHECK(delegate_); |
| 212 | 203 |
| 213 dbus::MessageReader reader(method_call); | 204 dbus::MessageReader reader(method_call); |
| 214 dbus::ObjectPath device_path; | 205 dbus::ObjectPath device_path; |
| 215 uint32 passkey; | 206 uint32 passkey; |
| 216 uint16 entered; | 207 uint16 entered; |
| 217 if (!reader.PopObjectPath(&device_path) || | 208 if (!reader.PopObjectPath(&device_path) || !reader.PopUint32(&passkey) || |
| 218 !reader.PopUint32(&passkey) || | |
| 219 !reader.PopUint16(&entered)) { | 209 !reader.PopUint16(&entered)) { |
| 220 LOG(WARNING) << "DisplayPasskey called with incorrect paramters: " | 210 LOG(WARNING) << "DisplayPasskey called with incorrect paramters: " |
| 221 << method_call->ToString(); | 211 << method_call->ToString(); |
| 222 return; | 212 return; |
| 223 } | 213 } |
| 224 | 214 |
| 225 delegate_->DisplayPasskey(device_path, passkey, entered); | 215 delegate_->DisplayPasskey(device_path, passkey, entered); |
| 226 | 216 |
| 227 response_sender.Run(dbus::Response::FromMethodCall(method_call)); | 217 response_sender.Run(dbus::Response::FromMethodCall(method_call)); |
| 228 } | 218 } |
| 229 | 219 |
| 230 // Called by dbus:: when the Bluetooth daemon requires that the user | 220 // Called by dbus:: when the Bluetooth daemon requires that the user |
| 231 // confirm that a Passkey is displayed on the screen of the remote | 221 // confirm that a Passkey is displayed on the screen of the remote |
| 232 // device so that it may be authenticated. | 222 // device so that it may be authenticated. |
| 233 void RequestConfirmation( | 223 void RequestConfirmation( |
| 234 dbus::MethodCall* method_call, | 224 dbus::MethodCall* method_call, |
| 235 dbus::ExportedObject::ResponseSender response_sender) { | 225 dbus::ExportedObject::ResponseSender response_sender) { |
| 236 DCHECK(OnOriginThread()); | 226 DCHECK(OnOriginThread()); |
| 237 DCHECK(delegate_); | 227 DCHECK(delegate_); |
| 238 | 228 |
| 239 dbus::MessageReader reader(method_call); | 229 dbus::MessageReader reader(method_call); |
| 240 dbus::ObjectPath device_path; | 230 dbus::ObjectPath device_path; |
| 241 uint32 passkey; | 231 uint32 passkey; |
| 242 if (!reader.PopObjectPath(&device_path) || | 232 if (!reader.PopObjectPath(&device_path) || !reader.PopUint32(&passkey)) { |
| 243 !reader.PopUint32(&passkey)) { | |
| 244 LOG(WARNING) << "RequestConfirmation called with incorrect paramters: " | 233 LOG(WARNING) << "RequestConfirmation called with incorrect paramters: " |
| 245 << method_call->ToString(); | 234 << method_call->ToString(); |
| 246 return; | 235 return; |
| 247 } | 236 } |
| 248 | 237 |
| 249 Delegate::ConfirmationCallback callback = base::Bind( | 238 Delegate::ConfirmationCallback callback = base::Bind( |
| 250 &BluetoothAgentServiceProviderImpl::OnConfirmation, | 239 &BluetoothAgentServiceProviderImpl::OnConfirmation, |
| 251 weak_ptr_factory_.GetWeakPtr(), | 240 weak_ptr_factory_.GetWeakPtr(), method_call, response_sender); |
| 252 method_call, | |
| 253 response_sender); | |
| 254 | 241 |
| 255 delegate_->RequestConfirmation(device_path, passkey, callback); | 242 delegate_->RequestConfirmation(device_path, passkey, callback); |
| 256 } | 243 } |
| 257 | 244 |
| 258 // Called by dbus:: when the Bluetooth daemon requires that the user | 245 // Called by dbus:: when the Bluetooth daemon requires that the user |
| 259 // confirm an incoming just-works pairing. | 246 // confirm an incoming just-works pairing. |
| 260 void RequestAuthorization( | 247 void RequestAuthorization( |
| 261 dbus::MethodCall* method_call, | 248 dbus::MethodCall* method_call, |
| 262 dbus::ExportedObject::ResponseSender response_sender) { | 249 dbus::ExportedObject::ResponseSender response_sender) { |
| 263 DCHECK(OnOriginThread()); | 250 DCHECK(OnOriginThread()); |
| 264 DCHECK(delegate_); | 251 DCHECK(delegate_); |
| 265 | 252 |
| 266 dbus::MessageReader reader(method_call); | 253 dbus::MessageReader reader(method_call); |
| 267 dbus::ObjectPath device_path; | 254 dbus::ObjectPath device_path; |
| 268 if (!reader.PopObjectPath(&device_path)) { | 255 if (!reader.PopObjectPath(&device_path)) { |
| 269 LOG(WARNING) << "RequestAuthorization called with incorrect paramters: " | 256 LOG(WARNING) << "RequestAuthorization called with incorrect paramters: " |
| 270 << method_call->ToString(); | 257 << method_call->ToString(); |
| 271 return; | 258 return; |
| 272 } | 259 } |
| 273 | 260 |
| 274 Delegate::ConfirmationCallback callback = base::Bind( | 261 Delegate::ConfirmationCallback callback = base::Bind( |
| 275 &BluetoothAgentServiceProviderImpl::OnConfirmation, | 262 &BluetoothAgentServiceProviderImpl::OnConfirmation, |
| 276 weak_ptr_factory_.GetWeakPtr(), | 263 weak_ptr_factory_.GetWeakPtr(), method_call, response_sender); |
| 277 method_call, | |
| 278 response_sender); | |
| 279 | 264 |
| 280 delegate_->RequestAuthorization(device_path, callback); | 265 delegate_->RequestAuthorization(device_path, callback); |
| 281 } | 266 } |
| 282 | 267 |
| 283 // Called by dbus:: when the Bluetooth daemon requires that the user | 268 // Called by dbus:: when the Bluetooth daemon requires that the user |
| 284 // confirm that that a remote device is authorized to connect to a service | 269 // confirm that that a remote device is authorized to connect to a service |
| 285 // UUID. | 270 // UUID. |
| 286 void AuthorizeService(dbus::MethodCall* method_call, | 271 void AuthorizeService(dbus::MethodCall* method_call, |
| 287 dbus::ExportedObject::ResponseSender response_sender) { | 272 dbus::ExportedObject::ResponseSender response_sender) { |
| 288 DCHECK(OnOriginThread()); | 273 DCHECK(OnOriginThread()); |
| 289 DCHECK(delegate_); | 274 DCHECK(delegate_); |
| 290 | 275 |
| 291 dbus::MessageReader reader(method_call); | 276 dbus::MessageReader reader(method_call); |
| 292 dbus::ObjectPath device_path; | 277 dbus::ObjectPath device_path; |
| 293 std::string uuid; | 278 std::string uuid; |
| 294 if (!reader.PopObjectPath(&device_path) || | 279 if (!reader.PopObjectPath(&device_path) || !reader.PopString(&uuid)) { |
| 295 !reader.PopString(&uuid)) { | |
| 296 LOG(WARNING) << "AuthorizeService called with incorrect paramters: " | 280 LOG(WARNING) << "AuthorizeService called with incorrect paramters: " |
| 297 << method_call->ToString(); | 281 << method_call->ToString(); |
| 298 return; | 282 return; |
| 299 } | 283 } |
| 300 | 284 |
| 301 Delegate::ConfirmationCallback callback = base::Bind( | 285 Delegate::ConfirmationCallback callback = base::Bind( |
| 302 &BluetoothAgentServiceProviderImpl::OnConfirmation, | 286 &BluetoothAgentServiceProviderImpl::OnConfirmation, |
| 303 weak_ptr_factory_.GetWeakPtr(), | 287 weak_ptr_factory_.GetWeakPtr(), method_call, response_sender); |
| 304 method_call, | |
| 305 response_sender); | |
| 306 | 288 |
| 307 delegate_->AuthorizeService(device_path, uuid, callback); | 289 delegate_->AuthorizeService(device_path, uuid, callback); |
| 308 } | 290 } |
| 309 | 291 |
| 310 // Called by dbus:: when the request failed before a reply was returned | 292 // Called by dbus:: when the request failed before a reply was returned |
| 311 // from the device. | 293 // from the device. |
| 312 void Cancel(dbus::MethodCall* method_call, | 294 void Cancel(dbus::MethodCall* method_call, |
| 313 dbus::ExportedObject::ResponseSender response_sender) { | 295 dbus::ExportedObject::ResponseSender response_sender) { |
| 314 DCHECK(OnOriginThread()); | 296 DCHECK(OnOriginThread()); |
| 315 DCHECK(delegate_); | 297 DCHECK(delegate_); |
| 316 | 298 |
| 317 delegate_->Cancel(); | 299 delegate_->Cancel(); |
| 318 | 300 |
| 319 response_sender.Run(dbus::Response::FromMethodCall(method_call)); | 301 response_sender.Run(dbus::Response::FromMethodCall(method_call)); |
| 320 } | 302 } |
| 321 | 303 |
| 322 // Called by dbus:: when a method is exported. | 304 // Called by dbus:: when a method is exported. |
| 323 void OnExported(const std::string& interface_name, | 305 void OnExported(const std::string& interface_name, |
| 324 const std::string& method_name, | 306 const std::string& method_name, |
| 325 bool success) { | 307 bool success) { |
| 326 LOG_IF(WARNING, !success) << "Failed to export " | 308 LOG_IF(WARNING, !success) << "Failed to export " << interface_name << "." |
| 327 << interface_name << "." << method_name; | 309 << method_name; |
| 328 } | 310 } |
| 329 | 311 |
| 330 // Called by the Delegate to response to a method requesting a PIN code. | 312 // Called by the Delegate to response to a method requesting a PIN code. |
| 331 void OnPinCode(dbus::MethodCall* method_call, | 313 void OnPinCode(dbus::MethodCall* method_call, |
| 332 dbus::ExportedObject::ResponseSender response_sender, | 314 dbus::ExportedObject::ResponseSender response_sender, |
| 333 Delegate::Status status, | 315 Delegate::Status status, |
| 334 const std::string& pincode) { | 316 const std::string& pincode) { |
| 335 DCHECK(OnOriginThread()); | 317 DCHECK(OnOriginThread()); |
| 336 | 318 |
| 337 switch (status) { | 319 switch (status) { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 418 |
| 437 // Weak pointer factory for generating 'this' pointers that might live longer | 419 // Weak pointer factory for generating 'this' pointers that might live longer |
| 438 // than we do. | 420 // than we do. |
| 439 // Note: This should remain the last member so it'll be destroyed and | 421 // Note: This should remain the last member so it'll be destroyed and |
| 440 // invalidate its weak pointers before any other members are destroyed. | 422 // invalidate its weak pointers before any other members are destroyed. |
| 441 base::WeakPtrFactory<BluetoothAgentServiceProviderImpl> weak_ptr_factory_; | 423 base::WeakPtrFactory<BluetoothAgentServiceProviderImpl> weak_ptr_factory_; |
| 442 | 424 |
| 443 DISALLOW_COPY_AND_ASSIGN(BluetoothAgentServiceProviderImpl); | 425 DISALLOW_COPY_AND_ASSIGN(BluetoothAgentServiceProviderImpl); |
| 444 }; | 426 }; |
| 445 | 427 |
| 446 BluetoothAgentServiceProvider::BluetoothAgentServiceProvider() { | 428 BluetoothAgentServiceProvider::BluetoothAgentServiceProvider() {} |
| 447 } | |
| 448 | 429 |
| 449 BluetoothAgentServiceProvider::~BluetoothAgentServiceProvider() { | 430 BluetoothAgentServiceProvider::~BluetoothAgentServiceProvider() {} |
| 450 } | |
| 451 | 431 |
| 452 // static | 432 // static |
| 453 BluetoothAgentServiceProvider* BluetoothAgentServiceProvider::Create( | 433 BluetoothAgentServiceProvider* BluetoothAgentServiceProvider::Create( |
| 454 dbus::Bus* bus, | 434 dbus::Bus* bus, |
| 455 const dbus::ObjectPath& object_path, | 435 const dbus::ObjectPath& object_path, |
| 456 Delegate* delegate) { | 436 Delegate* delegate) { |
| 457 if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { | 437 if (!bluez::BluezDBusManager::Get()->IsUsingStub()) { |
| 458 return new BluetoothAgentServiceProviderImpl(bus, object_path, delegate); | 438 return new BluetoothAgentServiceProviderImpl(bus, object_path, delegate); |
| 459 } else { | 439 } else { |
| 460 return new FakeBluetoothAgentServiceProvider(object_path, delegate); | 440 return new FakeBluetoothAgentServiceProvider(object_path, delegate); |
| 461 } | 441 } |
| 462 } | 442 } |
| 463 | 443 |
| 464 } // namespace chromeos | 444 } // namespace bluez |
| OLD | NEW |