| 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 "chrome/browser/chromeos/bluetooth/bluetooth_device.h" | 5 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 // to generate it as we only support one pairing attempt at a time for | 242 // to generate it as we only support one pairing attempt at a time for |
| 243 // a given bluetooth device. | 243 // a given bluetooth device. |
| 244 DCHECK(agent_.get() == NULL); | 244 DCHECK(agent_.get() == NULL); |
| 245 | 245 |
| 246 std::string agent_path_basename; | 246 std::string agent_path_basename; |
| 247 ReplaceChars(address_, ":", "_", &agent_path_basename); | 247 ReplaceChars(address_, ":", "_", &agent_path_basename); |
| 248 dbus::ObjectPath agent_path("/org/chromium/bluetooth_agent/" + | 248 dbus::ObjectPath agent_path("/org/chromium/bluetooth_agent/" + |
| 249 agent_path_basename); | 249 agent_path_basename); |
| 250 | 250 |
| 251 dbus::Bus* system_bus = DBusThreadManager::Get()->GetSystemBus(); | 251 dbus::Bus* system_bus = DBusThreadManager::Get()->GetSystemBus(); |
| 252 agent_.reset(BluetoothAgentServiceProvider::Create(system_bus, | 252 if (system_bus) { |
| 253 agent_path, | 253 agent_.reset(BluetoothAgentServiceProvider::Create(system_bus, |
| 254 this)); | 254 agent_path, |
| 255 this)); |
| 256 } else { |
| 257 agent_.reset(NULL); |
| 258 } |
| 255 | 259 |
| 256 DVLOG(1) << "Pairing: " << address_; | 260 DVLOG(1) << "Pairing: " << address_; |
| 257 DBusThreadManager::Get()->GetBluetoothAdapterClient()-> | 261 DBusThreadManager::Get()->GetBluetoothAdapterClient()-> |
| 258 CreatePairedDevice(adapter_->object_path_, | 262 CreatePairedDevice(adapter_->object_path_, |
| 259 address_, | 263 address_, |
| 260 agent_path, | 264 agent_path, |
| 261 bluetooth_agent::kDisplayYesNoCapability, | 265 bluetooth_agent::kDisplayYesNoCapability, |
| 262 base::Bind(&BluetoothDevice::ConnectCallback, | 266 base::Bind(&BluetoothDevice::ConnectCallback, |
| 263 weak_ptr_factory_.GetWeakPtr(), | 267 weak_ptr_factory_.GetWeakPtr(), |
| 264 callback, | 268 callback, |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 pairing_delegate_->DismissDisplayOrConfirm(); | 766 pairing_delegate_->DismissDisplayOrConfirm(); |
| 763 } | 767 } |
| 764 | 768 |
| 765 | 769 |
| 766 // static | 770 // static |
| 767 BluetoothDevice* BluetoothDevice::Create(BluetoothAdapter* adapter) { | 771 BluetoothDevice* BluetoothDevice::Create(BluetoothAdapter* adapter) { |
| 768 return new BluetoothDevice(adapter); | 772 return new BluetoothDevice(adapter); |
| 769 } | 773 } |
| 770 | 774 |
| 771 } // namespace chromeos | 775 } // namespace chromeos |
| OLD | NEW |