Index: chrome/browser/chromeos/bluetooth/bluetooth_adapter_dbus.cc |
diff --git a/chrome/browser/chromeos/bluetooth/bluetooth_adapter.cc b/chrome/browser/chromeos/bluetooth/bluetooth_adapter_dbus.cc |
similarity index 69% |
rename from chrome/browser/chromeos/bluetooth/bluetooth_adapter.cc |
rename to chrome/browser/chromeos/bluetooth/bluetooth_adapter_dbus.cc |
index bd0cadae5ecf1432cd3cf1a1a9894c803ef280fe..acab362242254c56d9c92d1a464cc895f84c4972 100644 |
--- a/chrome/browser/chromeos/bluetooth/bluetooth_adapter.cc |
+++ b/chrome/browser/chromeos/bluetooth/bluetooth_adapter_dbus.cc |
@@ -2,18 +2,21 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" |
+#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter_dbus.h" |
+ |
+#include <string> |
#include "base/bind.h" |
#include "base/lazy_instance.h" |
#include "base/logging.h" |
#include "base/stl_util.h" |
#include "base/values.h" |
-#include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" |
+#include "chrome/browser/chromeos/bluetooth/bluetooth_device_dbus.h" |
#include "chromeos/dbus/bluetooth_adapter_client.h" |
#include "chromeos/dbus/bluetooth_device_client.h" |
#include "chromeos/dbus/bluetooth_manager_client.h" |
#include "chromeos/dbus/bluetooth_out_of_band_client.h" |
+#include "chromeos/dbus/bluetooth_out_of_band_pairing_data.h" |
#include "chromeos/dbus/dbus_thread_manager.h" |
#include "dbus/object_path.h" |
@@ -23,17 +26,17 @@ namespace { |
// if nobody is using it so use a WeakPtr and create the object when needed; |
// since Google C++ Style (and clang's static analyzer) forbids us having |
// exit-time destructors we use a leaky lazy instance for it. |
-base::LazyInstance<base::WeakPtr<chromeos::BluetoothAdapter> >::Leaky |
+base::LazyInstance<base::WeakPtr<chromeos::BluetoothAdapterDBus> >::Leaky |
default_adapter = LAZY_INSTANCE_INITIALIZER; |
} // namespace |
namespace chromeos { |
-BluetoothAdapter::BluetoothAdapter() : track_default_(false), |
- powered_(false), |
- discovering_(false), |
- weak_ptr_factory_(this) { |
+BluetoothAdapterDBus::BluetoothAdapterDBus() : track_default_(false), |
+ powered_(false), |
+ discovering_(false), |
+ weak_ptr_factory_(this) { |
DBusThreadManager::Get()->GetBluetoothManagerClient()-> |
AddObserver(this); |
DBusThreadManager::Get()->GetBluetoothAdapterClient()-> |
@@ -42,7 +45,7 @@ BluetoothAdapter::BluetoothAdapter() : track_default_(false), |
AddObserver(this); |
} |
-BluetoothAdapter::~BluetoothAdapter() { |
+BluetoothAdapterDBus::~BluetoothAdapterDBus() { |
DBusThreadManager::Get()->GetBluetoothDeviceClient()-> |
RemoveObserver(this); |
DBusThreadManager::Get()->GetBluetoothAdapterClient()-> |
@@ -53,73 +56,82 @@ BluetoothAdapter::~BluetoothAdapter() { |
STLDeleteValues(&devices_); |
} |
-void BluetoothAdapter::AddObserver(Observer* observer) { |
+void BluetoothAdapterDBus::AddObserver(Observer* observer) { |
DCHECK(observer); |
observers_.AddObserver(observer); |
} |
-void BluetoothAdapter::RemoveObserver(Observer* observer) { |
+void BluetoothAdapterDBus::RemoveObserver(Observer* observer) { |
DCHECK(observer); |
observers_.RemoveObserver(observer); |
} |
-bool BluetoothAdapter::IsPresent() const { |
+const std::string& BluetoothAdapterDBus::address() const { |
+ return address_; |
+} |
+ |
+const std::string& BluetoothAdapterDBus::name() const { |
+ return name_; |
+} |
+ |
+bool BluetoothAdapterDBus::IsPresent() const { |
return !object_path_.value().empty(); |
} |
-bool BluetoothAdapter::IsPowered() const { |
+bool BluetoothAdapterDBus::IsPowered() const { |
return powered_; |
} |
-void BluetoothAdapter::SetPowered(bool powered, |
- const base::Closure& callback, |
- const ErrorCallback& error_callback) { |
+void BluetoothAdapterDBus::SetPowered(bool powered, |
+ const base::Closure& callback, |
+ const ErrorCallback& error_callback) { |
DBusThreadManager::Get()->GetBluetoothAdapterClient()-> |
GetProperties(object_path_)->powered.Set( |
powered, |
- base::Bind(&BluetoothAdapter::OnSetPowered, |
+ base::Bind(&BluetoothAdapterDBus::OnSetPowered, |
weak_ptr_factory_.GetWeakPtr(), |
callback, |
error_callback)); |
} |
-bool BluetoothAdapter::IsDiscovering() const { |
+bool BluetoothAdapterDBus::IsDiscovering() const { |
return discovering_; |
} |
-void BluetoothAdapter::SetDiscovering(bool discovering, |
- const base::Closure& callback, |
- const ErrorCallback& error_callback) { |
+void BluetoothAdapterDBus::SetDiscovering(bool discovering, |
+ const base::Closure& callback, |
+ const ErrorCallback& error_callback) { |
if (discovering) { |
DBusThreadManager::Get()->GetBluetoothAdapterClient()-> |
StartDiscovery(object_path_, |
- base::Bind(&BluetoothAdapter::OnStartDiscovery, |
+ base::Bind(&BluetoothAdapterDBus::OnStartDiscovery, |
weak_ptr_factory_.GetWeakPtr(), |
callback, |
error_callback)); |
} else { |
DBusThreadManager::Get()->GetBluetoothAdapterClient()-> |
StopDiscovery(object_path_, |
- base::Bind(&BluetoothAdapter::OnStopDiscovery, |
+ base::Bind(&BluetoothAdapterDBus::OnStopDiscovery, |
weak_ptr_factory_.GetWeakPtr(), |
callback, |
error_callback)); |
} |
} |
-BluetoothAdapter::DeviceList BluetoothAdapter::GetDevices() { |
+BluetoothAdapterDBus::DeviceList BluetoothAdapterDBus::GetDevices() { |
bryeung
2012/09/07 18:35:57
DeviceList is in BluetoothAdapterInterface, not Bl
youngki
2012/09/13 18:05:02
Done.
|
ConstDeviceList const_devices = |
- const_cast<const BluetoothAdapter *>(this)->GetDevices(); |
+ const_cast<const BluetoothAdapterDBus *>(this)->GetDevices(); |
DeviceList devices; |
for (ConstDeviceList::const_iterator i = const_devices.begin(); |
i != const_devices.end(); ++i) |
- devices.push_back(const_cast<BluetoothDevice *>(*i)); |
+ devices.push_back(const_cast<BluetoothDeviceInterface *>(*i)); |
return devices; |
} |
-BluetoothAdapter::ConstDeviceList BluetoothAdapter::GetDevices() const { |
+BluetoothAdapterDBus::ConstDeviceList |
+BluetoothAdapterDBus::GetDevices() const { |
ConstDeviceList devices; |
for (DevicesMap::const_iterator iter = devices_.begin(); |
iter != devices_.end(); ++iter) |
@@ -128,12 +140,13 @@ BluetoothAdapter::ConstDeviceList BluetoothAdapter::GetDevices() const { |
return devices; |
} |
-BluetoothDevice* BluetoothAdapter::GetDevice(const std::string& address) { |
- return const_cast<BluetoothDevice *>( |
- const_cast<const BluetoothAdapter *>(this)->GetDevice(address)); |
+BluetoothDeviceInterface* BluetoothAdapterDBus::GetDevice( |
+ const std::string& address) { |
+ return const_cast<BluetoothDeviceInterface *>( |
+ const_cast<const BluetoothAdapterDBus *>(this)->GetDevice(address)); |
} |
-const BluetoothDevice* BluetoothAdapter::GetDevice( |
+const BluetoothDeviceInterface* BluetoothAdapterDBus::GetDevice( |
const std::string& address) const { |
DevicesMap::const_iterator iter = devices_.find(address); |
if (iter != devices_.end()) |
@@ -142,36 +155,36 @@ const BluetoothDevice* BluetoothAdapter::GetDevice( |
return NULL; |
} |
-void BluetoothAdapter::ReadLocalOutOfBandPairingData( |
+void BluetoothAdapterDBus::ReadLocalOutOfBandPairingData( |
const BluetoothOutOfBandPairingDataCallback& callback, |
const ErrorCallback& error_callback) { |
DBusThreadManager::Get()->GetBluetoothOutOfBandClient()-> |
ReadLocalData(object_path_, |
- base::Bind(&BluetoothAdapter::OnReadLocalData, |
+ base::Bind(&BluetoothAdapterDBus::OnReadLocalData, |
weak_ptr_factory_.GetWeakPtr(), |
callback, |
error_callback)); |
} |
-void BluetoothAdapter::TrackDefaultAdapter() { |
+void BluetoothAdapterDBus::TrackDefaultAdapter() { |
DVLOG(1) << "Tracking default adapter"; |
track_default_ = true; |
DBusThreadManager::Get()->GetBluetoothManagerClient()-> |
- DefaultAdapter(base::Bind(&BluetoothAdapter::AdapterCallback, |
+ DefaultAdapter(base::Bind(&BluetoothAdapterDBus::AdapterCallback, |
weak_ptr_factory_.GetWeakPtr())); |
} |
-void BluetoothAdapter::FindAdapter(const std::string& address) { |
+void BluetoothAdapterDBus::FindAdapter(const std::string& address) { |
DVLOG(1) << "Using adapter " << address; |
track_default_ = false; |
DBusThreadManager::Get()->GetBluetoothManagerClient()-> |
FindAdapter(address, |
- base::Bind(&BluetoothAdapter::AdapterCallback, |
+ base::Bind(&BluetoothAdapterDBus::AdapterCallback, |
weak_ptr_factory_.GetWeakPtr())); |
} |
-void BluetoothAdapter::AdapterCallback(const dbus::ObjectPath& adapter_path, |
- bool success) { |
+void BluetoothAdapterDBus::AdapterCallback( |
+ const dbus::ObjectPath& adapter_path, bool success) { |
if (success) { |
ChangeAdapter(adapter_path); |
} else if (!object_path_.value().empty()) { |
@@ -179,18 +192,20 @@ void BluetoothAdapter::AdapterCallback(const dbus::ObjectPath& adapter_path, |
} |
} |
-void BluetoothAdapter::DefaultAdapterChanged( |
+void BluetoothAdapterDBus::DefaultAdapterChanged( |
const dbus::ObjectPath& adapter_path) { |
if (track_default_) |
ChangeAdapter(adapter_path); |
} |
-void BluetoothAdapter::AdapterRemoved(const dbus::ObjectPath& adapter_path) { |
+void BluetoothAdapterDBus::AdapterRemoved( |
+ const dbus::ObjectPath& adapter_path) { |
if (adapter_path == object_path_) |
RemoveAdapter(); |
} |
-void BluetoothAdapter::ChangeAdapter(const dbus::ObjectPath& adapter_path) { |
+void BluetoothAdapterDBus::ChangeAdapter( |
+ const dbus::ObjectPath& adapter_path) { |
if (adapter_path == object_path_) |
return; |
@@ -225,11 +240,11 @@ void BluetoothAdapter::ChangeAdapter(const dbus::ObjectPath& adapter_path) { |
// Notify observers if we did not have an adapter before, the case of |
// moving from one to another is hidden from layers above. |
if (new_adapter) |
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
+ FOR_EACH_OBSERVER(BluetoothAdapterDBus::Observer, observers_, |
AdapterPresentChanged(this, true)); |
} |
-void BluetoothAdapter::RemoveAdapter() { |
+void BluetoothAdapterDBus::RemoveAdapter() { |
DVLOG(1) << "Adapter lost."; |
PoweredChanged(false); |
DiscoveringChanged(false); |
@@ -239,33 +254,34 @@ void BluetoothAdapter::RemoveAdapter() { |
address_.clear(); |
name_.clear(); |
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
+ FOR_EACH_OBSERVER(BluetoothAdapterDBus::Observer, observers_, |
AdapterPresentChanged(this, false)); |
} |
-void BluetoothAdapter::OnSetPowered(const base::Closure& callback, |
- const ErrorCallback& error_callback, |
- bool success) { |
+void BluetoothAdapterDBus::OnSetPowered(const base::Closure& callback, |
+ const ErrorCallback& error_callback, |
+ bool success) { |
if (success) |
callback.Run(); |
else |
error_callback.Run(); |
} |
-void BluetoothAdapter::PoweredChanged(bool powered) { |
+void BluetoothAdapterDBus::PoweredChanged(bool powered) { |
if (powered == powered_) |
return; |
powered_ = powered; |
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
+ FOR_EACH_OBSERVER(BluetoothAdapterDBus::Observer, observers_, |
AdapterPoweredChanged(this, powered_)); |
} |
-void BluetoothAdapter::OnStartDiscovery(const base::Closure& callback, |
- const ErrorCallback& error_callback, |
- const dbus::ObjectPath& adapter_path, |
- bool success) { |
+void BluetoothAdapterDBus::OnStartDiscovery( |
+ const base::Closure& callback, |
+ const ErrorCallback& error_callback, |
+ const dbus::ObjectPath& adapter_path, |
+ bool success) { |
if (success) { |
DVLOG(1) << object_path_.value() << ": started discovery."; |
@@ -279,10 +295,10 @@ void BluetoothAdapter::OnStartDiscovery(const base::Closure& callback, |
} |
} |
-void BluetoothAdapter::OnStopDiscovery(const base::Closure& callback, |
- const ErrorCallback& error_callback, |
- const dbus::ObjectPath& adapter_path, |
- bool success) { |
+void BluetoothAdapterDBus::OnStopDiscovery(const base::Closure& callback, |
+ const ErrorCallback& error_callback, |
+ const dbus::ObjectPath& adapter_path, |
+ bool success) { |
if (success) { |
DVLOG(1) << object_path_.value() << ": stopped discovery."; |
callback.Run(); |
@@ -294,17 +310,17 @@ void BluetoothAdapter::OnStopDiscovery(const base::Closure& callback, |
} |
} |
-void BluetoothAdapter::DiscoveringChanged(bool discovering) { |
+void BluetoothAdapterDBus::DiscoveringChanged(bool discovering) { |
if (discovering == discovering_) |
return; |
discovering_ = discovering; |
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
+ FOR_EACH_OBSERVER(BluetoothAdapterDBus::Observer, observers_, |
AdapterDiscoveringChanged(this, discovering_)); |
} |
-void BluetoothAdapter::OnReadLocalData( |
+void BluetoothAdapterDBus::OnReadLocalData( |
const BluetoothOutOfBandPairingDataCallback& callback, |
const ErrorCallback& error_callback, |
const BluetoothOutOfBandPairingData& data, |
@@ -315,7 +331,7 @@ void BluetoothAdapter::OnReadLocalData( |
error_callback.Run(); |
} |
-void BluetoothAdapter::AdapterPropertyChanged( |
+void BluetoothAdapterDBus::AdapterPropertyChanged( |
const dbus::ObjectPath& adapter_path, |
const std::string& property_name) { |
if (adapter_path != object_path_) |
@@ -343,13 +359,13 @@ void BluetoothAdapter::AdapterPropertyChanged( |
} |
} |
-void BluetoothAdapter::DevicePropertyChanged( |
+void BluetoothAdapterDBus::DevicePropertyChanged( |
const dbus::ObjectPath& device_path, |
const std::string& property_name) { |
UpdateDevice(device_path); |
} |
-void BluetoothAdapter::UpdateDevice(const dbus::ObjectPath& device_path) { |
+void BluetoothAdapterDBus::UpdateDevice(const dbus::ObjectPath& device_path) { |
BluetoothDeviceClient::Properties* properties = |
DBusThreadManager::Get()->GetBluetoothDeviceClient()-> |
GetProperties(device_path); |
@@ -365,12 +381,12 @@ void BluetoothAdapter::UpdateDevice(const dbus::ObjectPath& device_path) { |
// pairing gaining an object path in the process. In any case, we want |
// to update the existing object, not create a new one. |
DevicesMap::iterator iter = devices_.find(address); |
- BluetoothDevice* device; |
+ BluetoothDeviceDBus* device; |
const bool update_device = (iter != devices_.end()); |
if (update_device) { |
device = iter->second; |
} else { |
- device = BluetoothDevice::Create(this); |
+ device = BluetoothDeviceDBus::Create(this); |
devices_[address] = device; |
} |
@@ -387,44 +403,44 @@ void BluetoothAdapter::UpdateDevice(const dbus::ObjectPath& device_path) { |
// event instead. We always send one event or the other since we always |
// inform observers about paired devices whether or not they're supported. |
if (update_device && (device->IsSupported() || was_paired)) { |
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
+ FOR_EACH_OBSERVER(BluetoothAdapterDBus::Observer, observers_, |
DeviceChanged(this, device)); |
} else { |
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
+ FOR_EACH_OBSERVER(BluetoothAdapterDBus::Observer, observers_, |
DeviceAdded(this, device)); |
} |
} |
-void BluetoothAdapter::ClearDevices() { |
+void BluetoothAdapterDBus::ClearDevices() { |
DevicesMap replace; |
devices_.swap(replace); |
for (DevicesMap::iterator iter = replace.begin(); |
iter != replace.end(); ++iter) { |
- BluetoothDevice* device = iter->second; |
+ BluetoothDeviceDBus* device = iter->second; |
if (device->IsSupported() || device->IsPaired()) |
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
+ FOR_EACH_OBSERVER(BluetoothAdapterDBus::Observer, observers_, |
DeviceRemoved(this, device)); |
delete device; |
} |
} |
-void BluetoothAdapter::DeviceCreated(const dbus::ObjectPath& adapter_path, |
- const dbus::ObjectPath& device_path) { |
+void BluetoothAdapterDBus::DeviceCreated(const dbus::ObjectPath& adapter_path, |
+ const dbus::ObjectPath& device_path) { |
if (adapter_path != object_path_) |
return; |
UpdateDevice(device_path); |
} |
-void BluetoothAdapter::DeviceRemoved(const dbus::ObjectPath& adapter_path, |
- const dbus::ObjectPath& device_path) { |
+void BluetoothAdapterDBus::DeviceRemoved(const dbus::ObjectPath& adapter_path, |
+ const dbus::ObjectPath& device_path) { |
if (adapter_path != object_path_) |
return; |
DevicesMap::iterator iter = devices_.begin(); |
while (iter != devices_.end()) { |
- BluetoothDevice* device = iter->second; |
+ BluetoothDeviceDBus* device = iter->second; |
DevicesMap::iterator temp = iter; |
++iter; |
@@ -435,7 +451,7 @@ void BluetoothAdapter::DeviceRemoved(const dbus::ObjectPath& adapter_path, |
// during discovery has disconnected, but it is still visible to the |
// adapter, so don't remove in that case and only clear the object path. |
if (!device->IsVisible()) { |
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
+ FOR_EACH_OBSERVER(BluetoothAdapterDBus::Observer, observers_, |
DeviceRemoved(this, device)); |
DVLOG(1) << "Removed device " << device->address(); |
@@ -449,33 +465,33 @@ void BluetoothAdapter::DeviceRemoved(const dbus::ObjectPath& adapter_path, |
// If the device is not supported then we want to act as if it was |
// removed, even though it is still visible to the adapter. |
if (!device->IsSupported()) { |
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
+ FOR_EACH_OBSERVER(BluetoothAdapterDBus::Observer, observers_, |
DeviceRemoved(this, device)); |
} else { |
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
+ FOR_EACH_OBSERVER(BluetoothAdapterDBus::Observer, observers_, |
DeviceChanged(this, device)); |
} |
} |
} |
} |
-void BluetoothAdapter::DevicesChanged( |
+void BluetoothAdapterDBus::DevicesChanged( |
const std::vector<dbus::ObjectPath>& devices) { |
for (std::vector<dbus::ObjectPath>::const_iterator iter = |
devices.begin(); iter != devices.end(); ++iter) |
UpdateDevice(*iter); |
} |
-void BluetoothAdapter::ClearDiscoveredDevices() { |
+void BluetoothAdapterDBus::ClearDiscoveredDevices() { |
DevicesMap::iterator iter = devices_.begin(); |
while (iter != devices_.end()) { |
- BluetoothDevice* device = iter->second; |
+ BluetoothDeviceDBus* device = iter->second; |
DevicesMap::iterator temp = iter; |
++iter; |
if (!device->IsPaired()) { |
if (device->IsSupported()) |
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
+ FOR_EACH_OBSERVER(BluetoothAdapterDBus::Observer, observers_, |
DeviceRemoved(this, device)); |
delete device; |
@@ -484,7 +500,7 @@ void BluetoothAdapter::ClearDiscoveredDevices() { |
} |
} |
-void BluetoothAdapter::DeviceFound( |
+void BluetoothAdapterDBus::DeviceFound( |
const dbus::ObjectPath& adapter_path, const std::string& address, |
const BluetoothDeviceClient::Properties& properties) { |
if (adapter_path != object_path_) |
@@ -493,13 +509,13 @@ void BluetoothAdapter::DeviceFound( |
// DeviceFound can also be called to indicate that a device we've |
// paired with is now visible to the adapter during discovery, in which |
// case we want to update the existing object, not create a new one. |
- BluetoothDevice* device; |
+ BluetoothDeviceDBus* device; |
DevicesMap::iterator iter = devices_.find(address); |
const bool update_device = (iter != devices_.end()); |
if (update_device) { |
device = iter->second; |
} else { |
- device = BluetoothDevice::Create(this); |
+ device = BluetoothDeviceDBus::Create(this); |
devices_[address] = device; |
} |
@@ -512,16 +528,16 @@ void BluetoothAdapter::DeviceFound( |
// paired devices, send a changed event instead. We do not inform observers |
// if we find or update an unconnected and unsupported device. |
if (update_device && (device->IsSupported() || device->IsPaired())) { |
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
+ FOR_EACH_OBSERVER(BluetoothAdapterDBus::Observer, observers_, |
DeviceChanged(this, device)); |
} else if (device->IsSupported()) { |
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
+ FOR_EACH_OBSERVER(BluetoothAdapterDBus::Observer, observers_, |
DeviceAdded(this, device)); |
} |
} |
-void BluetoothAdapter::DeviceDisappeared(const dbus::ObjectPath& adapter_path, |
- const std::string& address) { |
+void BluetoothAdapterDBus::DeviceDisappeared( |
+ const dbus::ObjectPath& adapter_path, const std::string& address) { |
if (adapter_path != object_path_) |
return; |
@@ -529,14 +545,14 @@ void BluetoothAdapter::DeviceDisappeared(const dbus::ObjectPath& adapter_path, |
if (iter == devices_.end()) |
return; |
- BluetoothDevice* device = iter->second; |
+ BluetoothDeviceDBus* device = iter->second; |
// DeviceDisappeared can also be called to indicate that a device we've |
// paired with is no longer visible to the adapter, so don't remove |
// in that case and only clear the visible flag. |
if (!device->IsPaired()) { |
if (device->IsSupported()) |
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
+ FOR_EACH_OBSERVER(BluetoothAdapterDBus::Observer, observers_, |
DeviceRemoved(this, device)); |
DVLOG(1) << "Discovered device " << device->address() |
@@ -549,26 +565,27 @@ void BluetoothAdapter::DeviceDisappeared(const dbus::ObjectPath& adapter_path, |
<< " is no longer visible to the adapter"; |
device->SetVisible(false); |
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
+ FOR_EACH_OBSERVER(BluetoothAdapterDBus::Observer, observers_, |
DeviceChanged(this, device)); |
} |
} |
// static |
-scoped_refptr<BluetoothAdapter> BluetoothAdapter::DefaultAdapter() { |
+scoped_refptr<BluetoothAdapterDBus> BluetoothAdapterDBus::DefaultAdapter() { |
if (!default_adapter.Get().get()) { |
- BluetoothAdapter* new_adapter = new BluetoothAdapter; |
+ BluetoothAdapterDBus* new_adapter = new BluetoothAdapterDBus; |
default_adapter.Get() = new_adapter->weak_ptr_factory_.GetWeakPtr(); |
default_adapter.Get()->TrackDefaultAdapter(); |
} |
- return scoped_refptr<BluetoothAdapter>(default_adapter.Get()); |
+ return scoped_refptr<BluetoothAdapterDBus>(default_adapter.Get()); |
} |
// static |
-BluetoothAdapter* BluetoothAdapter::Create(const std::string& address) { |
- BluetoothAdapter* adapter = new BluetoothAdapter; |
+BluetoothAdapterDBus* BluetoothAdapterDBus::Create( |
+ const std::string& address) { |
+ BluetoothAdapterDBus* adapter = new BluetoothAdapterDBus; |
adapter->FindAdapter(address); |
return adapter; |
} |