summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/bluetooth_manager_client.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromeos/dbus/bluetooth_manager_client.cc')
-rw-r--r--chromeos/dbus/bluetooth_manager_client.cc87
1 files changed, 2 insertions, 85 deletions
diff --git a/chromeos/dbus/bluetooth_manager_client.cc b/chromeos/dbus/bluetooth_manager_client.cc
index b8b3126..f278160 100644
--- a/chromeos/dbus/bluetooth_manager_client.cc
+++ b/chromeos/dbus/bluetooth_manager_client.cc
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "chromeos/dbus/bluetooth_property.h"
+#include "chromeos/dbus/fake_old_bluetooth_manager_client.h"
#include "dbus/bus.h"
#include "dbus/message.h"
#include "dbus/object_path.h"
@@ -270,90 +271,6 @@ class BluetoothManagerClientImpl : public BluetoothManagerClient {
DISALLOW_COPY_AND_ASSIGN(BluetoothManagerClientImpl);
};
-// The BluetoothManagerClient implementation used on Linux desktop, which does
-// nothing.
-class BluetoothManagerClientStubImpl : public BluetoothManagerClient {
- public:
- struct Properties : public BluetoothManagerClient::Properties {
- explicit Properties(const PropertyChangedCallback& callback)
- : BluetoothManagerClient::Properties(NULL, callback) {
- }
-
- virtual ~Properties() {
- }
-
- virtual void Get(dbus::PropertyBase* property,
- dbus::PropertySet::GetCallback callback) OVERRIDE {
- VLOG(1) << "Get " << property->name();
- callback.Run(false);
- }
-
- virtual void GetAll() OVERRIDE {
- VLOG(1) << "GetAll";
- }
-
- virtual void Set(dbus::PropertyBase* property,
- dbus::PropertySet::SetCallback callback) OVERRIDE {
- VLOG(1) << "Set " << property->name();
- callback.Run(false);
- }
- };
-
- BluetoothManagerClientStubImpl() {
- properties_.reset(new Properties(base::Bind(
- &BluetoothManagerClientStubImpl::OnPropertyChanged,
- base::Unretained(this))));
-
- std::vector<dbus::ObjectPath> adapters;
- adapters.push_back(dbus::ObjectPath("/fake/hci0"));
- properties_->adapters.ReplaceValue(adapters);
- }
-
- // BluetoothManagerClient override.
- virtual void AddObserver(Observer* observer) OVERRIDE {
- observers_.AddObserver(observer);
- }
-
- // BluetoothManagerClient override.
- virtual void RemoveObserver(Observer* observer) OVERRIDE {
- observers_.RemoveObserver(observer);
- }
-
- // BluetoothManagerClient override.
- virtual Properties* GetProperties() OVERRIDE {
- VLOG(1) << "GetProperties";
- return properties_.get();
- }
-
- // BluetoothManagerClient override.
- virtual void DefaultAdapter(const AdapterCallback& callback) OVERRIDE {
- VLOG(1) << "DefaultAdapter.";
- callback.Run(dbus::ObjectPath("/fake/hci0"), true);
- }
-
- // BluetoothManagerClient override.
- virtual void FindAdapter(const std::string& address,
- const AdapterCallback& callback) OVERRIDE {
- VLOG(1) << "FindAdapter: " << address;
- if (address == "hci0")
- callback.Run(dbus::ObjectPath("/fake/hci0"), true);
- else
- callback.Run(dbus::ObjectPath(), false);
- }
-
- private:
- void OnPropertyChanged(const std::string& property_name) {
- FOR_EACH_OBSERVER(BluetoothManagerClient::Observer, observers_,
- ManagerPropertyChanged(property_name));
- }
-
- // List of observers interested in event notifications from us.
- ObserverList<Observer> observers_;
-
- // Static properties we return.
- scoped_ptr<Properties> properties_;
-};
-
BluetoothManagerClient::BluetoothManagerClient() {
}
@@ -366,7 +283,7 @@ BluetoothManagerClient* BluetoothManagerClient::Create(
if (type == REAL_DBUS_CLIENT_IMPLEMENTATION)
return new BluetoothManagerClientImpl(bus);
DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type);
- return new BluetoothManagerClientStubImpl();
+ return new FakeOldBluetoothManagerClient();
}
} // namespace chromeos