diff options
10 files changed, 94 insertions, 121 deletions
diff --git a/chrome/browser/chromeos/bluetooth/bluetooth_adapter.cc b/chrome/browser/chromeos/bluetooth/bluetooth_adapter.cc index 78058b4..daa50fc 100644 --- a/chrome/browser/chromeos/bluetooth/bluetooth_adapter.cc +++ b/chrome/browser/chromeos/bluetooth/bluetooth_adapter.cc @@ -30,37 +30,38 @@ class BluetoothAdapterImpl : public BluetoothAdapter, bluetooth_adapter_client_->RemoveObserver(this); } - virtual void AddObserver(BluetoothAdapter::Observer* observer) { - VLOG(1) << id_ << ": AddObserver"; + // BluetoothAdapter override. + virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE { DCHECK(observer); observers_.AddObserver(observer); } - virtual void RemoveObserver(BluetoothAdapter::Observer* observer) { - VLOG(1) << id_ << ": RemoveObserver"; + // BluetoothAdapter override. + virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE { DCHECK(observer); observers_.RemoveObserver(observer); } - virtual const std::string& Id() const { + // BluetoothAdapter override. + virtual const std::string& Id() const OVERRIDE { return id_; } - virtual void StartDiscovery() { - VLOG(1) << id_ << ": StartDiscovery"; + // BluetoothAdapter override. + virtual void StartDiscovery() OVERRIDE { DCHECK(bluetooth_adapter_client_); bluetooth_adapter_client_->StartDiscovery(dbus::ObjectPath(id_)); } - virtual void StopDiscovery() { - VLOG(1) << id_ << ": StopDiscovery"; + // BluetoothAdapter override. + virtual void StopDiscovery() OVERRIDE { DCHECK(bluetooth_adapter_client_); bluetooth_adapter_client_->StopDiscovery(dbus::ObjectPath(id_)); } // BluetoothAdapterClient::Observer override. virtual void PropertyChanged(const dbus::ObjectPath& object_path, - const std::string& property_name) { + const std::string& property_name) OVERRIDE { if (object_path.value() != id_) return; @@ -90,8 +91,6 @@ class BluetoothAdapterImpl : public BluetoothAdapter, const std::string& address, const BluetoothDeviceClient::Properties& properties) OVERRIDE { - DVLOG(1) << id_ << ": object_path = " << object_path.value() - << ", Device found: " << address; if (object_path.value() != id_) { return; } @@ -113,9 +112,7 @@ class BluetoothAdapterImpl : public BluetoothAdapter, // BluetoothAdapterClient::Observer override. virtual void DeviceDisappeared(const dbus::ObjectPath& object_path, - const std::string& address) { - VLOG(1) << id_ << ": object_path = " << object_path.value() - << ", Device disappeared: " << address; + const std::string& address) OVERRIDE { if (object_path.value() != id_) { return; } diff --git a/chrome/browser/chromeos/bluetooth/bluetooth_manager.cc b/chrome/browser/chromeos/bluetooth/bluetooth_manager.cc index ef362f0..34687fb 100644 --- a/chrome/browser/chromeos/bluetooth/bluetooth_manager.cc +++ b/chrome/browser/chromeos/bluetooth/bluetooth_manager.cc @@ -33,26 +33,25 @@ class BluetoothManagerImpl : public BluetoothManager, weak_ptr_factory_.GetWeakPtr())); } - virtual void AddObserver(BluetoothManager::Observer* observer) { - VLOG(1) << "BluetoothManager::AddObserver"; + // BluetoothManager override. + virtual void AddObserver(BluetoothManager::Observer* observer) OVERRIDE { DCHECK(observer); observers_.AddObserver(observer); } - virtual void RemoveObserver(BluetoothManager::Observer* observer) { - VLOG(1) << "BluetoothManager::RemoveObserver"; + // BluetoothManager override. + virtual void RemoveObserver(BluetoothManager::Observer* observer) OVERRIDE { DCHECK(observer); observers_.RemoveObserver(observer); } - virtual BluetoothAdapter* DefaultAdapter() { - VLOG(1) << "BluetoothManager::DefaultAdapter"; + // BluetoothManager override. + virtual BluetoothAdapter* DefaultAdapter() OVERRIDE { return default_adapter_.get(); } // BluetoothManagerClient::Observer override. - virtual void AdapterRemoved(const dbus::ObjectPath& adapter) { - VLOG(1) << "AdapterRemoved: " << adapter.value(); + virtual void AdapterRemoved(const dbus::ObjectPath& adapter) OVERRIDE { if (default_adapter_.get() == NULL || default_adapter_->Id() != adapter.value()) { return; @@ -64,8 +63,7 @@ class BluetoothManagerImpl : public BluetoothManager, } // BluetoothManagerClient::Observer override. - virtual void DefaultAdapterChanged(const dbus::ObjectPath& adapter) { - VLOG(1) << "DefaultAdapterChanged: " << adapter.value(); + virtual void DefaultAdapterChanged(const dbus::ObjectPath& adapter) OVERRIDE { OnNewDefaultAdapter(adapter); } @@ -76,7 +74,6 @@ class BluetoothManagerImpl : public BluetoothManager, // We have updated info about the default adapter. void OnNewDefaultAdapter(const dbus::ObjectPath& adapter) { - VLOG(1) << "OnNewDefaultAdapter: " << adapter.value(); if (default_adapter_.get() != NULL && default_adapter_->Id() == adapter.value()) { return; @@ -94,7 +91,6 @@ class BluetoothManagerImpl : public BluetoothManager, LOG(ERROR) << "OnDefaultAdapter: failed."; return; } - VLOG(1) << "OnDefaultAdapter: " << adapter.value(); OnNewDefaultAdapter(adapter); } diff --git a/chrome/browser/chromeos/dbus/bluetooth_adapter_client.cc b/chrome/browser/chromeos/dbus/bluetooth_adapter_client.cc index 62d0411..c2db6e6 100644 --- a/chrome/browser/chromeos/dbus/bluetooth_adapter_client.cc +++ b/chrome/browser/chromeos/dbus/bluetooth_adapter_client.cc @@ -21,7 +21,7 @@ namespace chromeos { -BluetoothAdapterClient::Properties::Properties(dbus::ObjectProxy *object_proxy, +BluetoothAdapterClient::Properties::Properties(dbus::ObjectProxy* object_proxy, PropertyChangedCallback callback) : BluetoothPropertySet(object_proxy, bluetooth_adapter::kBluetoothAdapterInterface, @@ -53,7 +53,7 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient, BluetoothManagerClient* manager_client) : weak_ptr_factory_(this), bus_(bus) { - VLOG(1) << "Creating BluetoothAdapterClientImpl"; + DVLOG(1) << "Creating BluetoothAdapterClientImpl"; DCHECK(manager_client); manager_client->AddObserver(this); @@ -70,35 +70,34 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient, } // BluetoothAdapterClient override. - virtual void AddObserver(BluetoothAdapterClient::Observer* observer) { - VLOG(1) << "AddObserver"; + virtual void AddObserver(BluetoothAdapterClient::Observer* observer) + OVERRIDE { DCHECK(observer); observers_.AddObserver(observer); } // BluetoothAdapterClient override. - virtual void RemoveObserver(BluetoothAdapterClient::Observer* observer) { - VLOG(1) << "RemoveObserver"; + virtual void RemoveObserver(BluetoothAdapterClient::Observer* observer) + OVERRIDE { DCHECK(observer); observers_.RemoveObserver(observer); } // BluetoothAdapterClient override. - virtual Properties* GetProperties(const dbus::ObjectPath& object_path) { + virtual Properties* GetProperties(const dbus::ObjectPath& object_path) + OVERRIDE { return GetObject(object_path).second; } // BluetoothAdapterClient override. - virtual void StartDiscovery(const dbus::ObjectPath& object_path) { - VLOG(1) << "StartDiscovery: " << object_path.value(); - + virtual void StartDiscovery(const dbus::ObjectPath& object_path) OVERRIDE { dbus::MethodCall method_call( bluetooth_adapter::kBluetoothAdapterInterface, bluetooth_adapter::kStartDiscovery); - dbus::ObjectProxy* adapter_proxy = GetObjectProxy(object_path); + dbus::ObjectProxy* object_proxy = GetObjectProxy(object_path); - adapter_proxy->CallMethod( + object_proxy->CallMethod( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, base::Bind(&BluetoothAdapterClientImpl::OnStartDiscovery, @@ -106,16 +105,14 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient, } // BluetoothAdapterClient override. - virtual void StopDiscovery(const dbus::ObjectPath& object_path) { - VLOG(1) << "StopDiscovery: " << object_path.value(); - + virtual void StopDiscovery(const dbus::ObjectPath& object_path) OVERRIDE { dbus::MethodCall method_call( bluetooth_adapter::kBluetoothAdapterInterface, bluetooth_adapter::kStopDiscovery); - dbus::ObjectProxy* adapter_proxy = GetObjectProxy(object_path); + dbus::ObjectProxy* object_proxy = GetObjectProxy(object_path); - adapter_proxy->CallMethod( + object_proxy->CallMethod( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, base::Bind(&BluetoothAdapterClientImpl::OnStopDiscovery, @@ -131,12 +128,10 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient, // BluetoothManagerClient::Observer override. virtual void AdapterAdded(const dbus::ObjectPath& object_path) OVERRIDE { - VLOG(1) << "AdapterAdded: " << object_path.value(); } // BluetoothManagerClient::Observer override. virtual void AdapterRemoved(const dbus::ObjectPath& object_path) OVERRIDE { - VLOG(1) << "AdapterRemoved: " << object_path.value(); RemoveObject(object_path); } @@ -144,8 +139,6 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient, // an adapter with object path |object_path|, creating it if not and // storing in our |object_map_| map. Object GetObject(const dbus::ObjectPath& object_path) { - VLOG(1) << "GetObject: " << object_path.value(); - ObjectMap::iterator iter = object_map_.find(object_path); if (iter != object_map_.end()) return iter->second; @@ -204,8 +197,6 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient, // Removes the dbus object proxy and properties for the adapter with // dbus object path |object_path| from our |object_map_| map. void RemoveObject(const dbus::ObjectPath& object_path) { - VLOG(1) << "RemoveObject: " << object_path.value(); - ObjectMap::iterator iter = object_map_.find(object_path); if (iter != object_map_.end()) { // Clean up the Properties structure. @@ -219,8 +210,7 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient, // Returns a pointer to the object proxy for |object_path|, creating // it if necessary. - virtual dbus::ObjectProxy* GetObjectProxy( - const dbus::ObjectPath& object_path) { + dbus::ObjectProxy* GetObjectProxy(const dbus::ObjectPath& object_path) { return GetObject(object_path).first; } @@ -245,9 +235,9 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient, << signal->ToString(); return; } - VLOG(1) << object_path.value() << ": Device created: " - << device_path.value(); + DVLOG(1) << object_path.value() << ": Device created: " + << device_path.value(); FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, DeviceCreated(object_path, device_path)); } @@ -273,9 +263,9 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient, << signal->ToString(); return; } - VLOG(1) << object_path.value() << ": Device removed: " - << device_path.value(); + DVLOG(1) << object_path.value() << ": Device removed: " + << device_path.value(); FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, DeviceRemoved(object_path, device_path)); } @@ -301,7 +291,6 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient, << signal->ToString(); return; } - VLOG(1) << object_path.value() << ": Device found: " << address; // Create device properties structure without an attached object_proxy // and a NULL callback; value() functions will work on this, but not @@ -315,6 +304,7 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient, return; } + DVLOG(1) << object_path.value() << ": Device found: " << address; FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, DeviceFound(object_path, address, device_properties)); } @@ -340,7 +330,8 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient, << signal->ToString(); return; } - VLOG(1) << object_path.value() << ": Device disappeared: " << address; + + DVLOG(1) << object_path.value() << ": Device disappeared: " << address; FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, DeviceDisappeared(object_path, address)); } @@ -358,7 +349,6 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient, // Called when a response for StartDiscovery() is received. void OnStartDiscovery(const dbus::ObjectPath& object_path, dbus::Response* response) { - VLOG(1) << "OnStartDiscovery: " << object_path.value(); LOG_IF(WARNING, !response) << object_path.value() << ": OnStartDiscovery: failed."; } @@ -366,7 +356,6 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient, // Called when a response for StopDiscovery() is received. void OnStopDiscovery(const dbus::ObjectPath& object_path, dbus::Response* response) { - VLOG(1) << "OnStopDiscovery: " << object_path.value(); LOG_IF(WARNING, !response) << object_path.value() << ": OnStopDiscovery: failed."; } @@ -388,28 +377,27 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient, class BluetoothAdapterClientStubImpl : public BluetoothAdapterClient { public: // BluetoothAdapterClient override. - virtual void AddObserver(Observer* observer) { - VLOG(1) << "AddObserver"; + virtual void AddObserver(Observer* observer) OVERRIDE { } // BluetoothAdapterClient override. - virtual void RemoveObserver(Observer* observer) { - VLOG(1) << "RemoveObserver"; + virtual void RemoveObserver(Observer* observer) OVERRIDE { } // BluetoothAdapterClient override. - virtual Properties* GetProperties(const dbus::ObjectPath& object_path) { + virtual Properties* GetProperties(const dbus::ObjectPath& object_path) + OVERRIDE { VLOG(1) << "GetProperties: " << object_path.value(); return NULL; } // BluetoothAdapterClient override. - virtual void StartDiscovery(const dbus::ObjectPath& object_path) { + virtual void StartDiscovery(const dbus::ObjectPath& object_path) OVERRIDE { VLOG(1) << "StartDiscovery: " << object_path.value(); } // BluetoothAdapterClient override. - virtual void StopDiscovery(const dbus::ObjectPath& object_path) { + virtual void StopDiscovery(const dbus::ObjectPath& object_path) OVERRIDE { VLOG(1) << "StopDiscovery: " << object_path.value(); } }; diff --git a/chrome/browser/chromeos/dbus/bluetooth_adapter_client.h b/chrome/browser/chromeos/dbus/bluetooth_adapter_client.h index da65a95..ea45dc1 100644 --- a/chrome/browser/chromeos/dbus/bluetooth_adapter_client.h +++ b/chrome/browser/chromeos/dbus/bluetooth_adapter_client.h @@ -70,10 +70,11 @@ class BluetoothAdapterClient { // List of object paths of known Bluetooth devices, known devices are // those that have previously been connected or paired or are currently - // connected or paired. + // connected or paired. Read-only. BluetoothProperty<std::vector<dbus::ObjectPath> > devices; // List of 128-bit UUIDs that represent the available local services. + // Read-only. BluetoothProperty<std::vector<std::string> > uuids; Properties(dbus::ObjectProxy* object_proxy, @@ -91,11 +92,13 @@ class BluetoothAdapterClient { virtual void PropertyChanged(const dbus::ObjectPath& object_path, const std::string& property_name) {} - // Called when a new known device has been created. + // Called when the adapter with object path |object_path| has a + // new known device with object path |object_path|. virtual void DeviceCreated(const dbus::ObjectPath& object_path, const dbus::ObjectPath& device_path) {} - // Called when a previously known device is removed. + // Called when the adapter with object path |object_path| removes + // the known device with object path |object_path|. virtual void DeviceRemoved(const dbus::ObjectPath& object_path, const dbus::ObjectPath& device_path) {} @@ -118,8 +121,9 @@ class BluetoothAdapterClient { virtual ~BluetoothAdapterClient(); - // Adds and removes observers for events on the adapter with object path - // |object_path|. + // Adds and removes observers for events on all local bluetooth + // adapters. Check the |object_path| parameter of observer methods to + // determine which adapter is issuing the event. virtual void AddObserver(Observer* observer) = 0; virtual void RemoveObserver(Observer* observer) = 0; diff --git a/chrome/browser/chromeos/dbus/bluetooth_device_client.cc b/chrome/browser/chromeos/dbus/bluetooth_device_client.cc index e9929a0..2dd903d 100644 --- a/chrome/browser/chromeos/dbus/bluetooth_device_client.cc +++ b/chrome/browser/chromeos/dbus/bluetooth_device_client.cc @@ -56,7 +56,7 @@ class BluetoothDeviceClientImpl: public BluetoothDeviceClient, BluetoothAdapterClient* adapter_client) : weak_ptr_factory_(this), bus_(bus) { - VLOG(1) << "Creating BluetoothDeviceClientImpl"; + DVLOG(1) << "Creating BluetoothDeviceClientImpl"; DCHECK(adapter_client); adapter_client->AddObserver(this); @@ -75,7 +75,6 @@ class BluetoothDeviceClientImpl: public BluetoothDeviceClient, // BluetoothDeviceClient override. virtual void AddObserver(BluetoothDeviceClient::Observer* observer) OVERRIDE { - VLOG(1) << "AddObserver"; DCHECK(observer); observers_.AddObserver(observer); } @@ -83,13 +82,13 @@ class BluetoothDeviceClientImpl: public BluetoothDeviceClient, // BluetoothDeviceClient override. virtual void RemoveObserver(BluetoothDeviceClient::Observer* observer) OVERRIDE { - VLOG(1) << "RemoveObserver"; DCHECK(observer); observers_.RemoveObserver(observer); } // BluetoothDeviceClient override. - virtual Properties* GetProperties(const dbus::ObjectPath& object_path) { + virtual Properties* GetProperties(const dbus::ObjectPath& object_path) + OVERRIDE { return GetObject(object_path).second; } @@ -103,13 +102,11 @@ class BluetoothDeviceClientImpl: public BluetoothDeviceClient, // BluetoothAdapterClient::Observer override. virtual void DeviceCreated(const dbus::ObjectPath& adapter_path, const dbus::ObjectPath& object_path) OVERRIDE { - VLOG(1) << "DeviceCreated: " << object_path.value(); } // BluetoothAdapterClient::Observer override. virtual void DeviceRemoved(const dbus::ObjectPath& adapter_path, const dbus::ObjectPath& object_path) OVERRIDE { - VLOG(1) << "DeviceRemoved: " << object_path.value(); RemoveObject(object_path); } @@ -117,8 +114,6 @@ class BluetoothDeviceClientImpl: public BluetoothDeviceClient, // a device with object path |object_path|, creating it if not and // storing it in our |object_map_| map. Object GetObject(const dbus::ObjectPath& object_path) { - VLOG(1) << "GetObject: " << object_path.value(); - ObjectMap::iterator iter = object_map_.find(object_path); if (iter != object_map_.end()) return iter->second; @@ -145,8 +140,6 @@ class BluetoothDeviceClientImpl: public BluetoothDeviceClient, // Removes the dbus object proxy and properties for the device with // dbus object path |object_path| from our |object_map_| map. void RemoveObject(const dbus::ObjectPath& object_path) { - VLOG(1) << "RemoveObject: " << object_path.value(); - ObjectMap::iterator iter = object_map_.find(object_path); if (iter != object_map_.end()) { // Clean up the Properties structure. @@ -160,8 +153,7 @@ class BluetoothDeviceClientImpl: public BluetoothDeviceClient, // Returns a pointer to the object proxy for |object_path|, creating // it if necessary. - virtual dbus::ObjectProxy* GetObjectProxy( - const dbus::ObjectPath& object_path) { + dbus::ObjectProxy* GetObjectProxy(const dbus::ObjectPath& object_path) { return GetObject(object_path).first; } @@ -192,16 +184,15 @@ class BluetoothDeviceClientStubImpl : public BluetoothDeviceClient { public: // BluetoothDeviceClient override. virtual void AddObserver(Observer* observer) OVERRIDE { - VLOG(1) << "AddObserver"; } // BluetoothDeviceClient override. virtual void RemoveObserver(Observer* observer) OVERRIDE { - VLOG(1) << "RemoveObserver"; } // BluetoothDeviceClient override. - virtual Properties* GetProperties(const dbus::ObjectPath& object_path) { + virtual Properties* GetProperties(const dbus::ObjectPath& object_path) + OVERRIDE { VLOG(1) << "GetProperties: " << object_path.value(); return NULL; } diff --git a/chrome/browser/chromeos/dbus/bluetooth_device_client.h b/chrome/browser/chromeos/dbus/bluetooth_device_client.h index dc3035d..0506c47 100644 --- a/chrome/browser/chromeos/dbus/bluetooth_device_client.h +++ b/chrome/browser/chromeos/dbus/bluetooth_device_client.h @@ -23,8 +23,8 @@ namespace chromeos { class BluetoothAdapterClient; -// BluetoothDeviceClient is used to communicate with the bluez Device -// and Input interfaces. +// BluetoothDeviceClient is used to communicate with a bluetooth Device +// interface. class BluetoothDeviceClient { public: // Structure of properties associated with bluetooth devices. @@ -106,8 +106,9 @@ class BluetoothDeviceClient { virtual ~BluetoothDeviceClient(); - // Adds and removes observers for events on the device with object path - // |device_path|. + // Adds and removes observers for events on all remote bluetooth + // devices. Check the |object_path| parameter of observer methods to + // determine which device is issuing the event. virtual void AddObserver(Observer* observer) = 0; virtual void RemoveObserver(Observer* observer) = 0; diff --git a/chrome/browser/chromeos/dbus/bluetooth_manager_client.cc b/chrome/browser/chromeos/dbus/bluetooth_manager_client.cc index f65fa84..20423d5 100644 --- a/chrome/browser/chromeos/dbus/bluetooth_manager_client.cc +++ b/chrome/browser/chromeos/dbus/bluetooth_manager_client.cc @@ -20,16 +20,16 @@ class BluetoothManagerClientImpl : public BluetoothManagerClient { public: explicit BluetoothManagerClientImpl(dbus::Bus* bus) : weak_ptr_factory_(this), - bluetooth_manager_proxy_(NULL) { - VLOG(1) << "Creating BluetoothManagerClientImpl"; + object_proxy_(NULL) { + DVLOG(1) << "Creating BluetoothManagerClientImpl"; DCHECK(bus); - bluetooth_manager_proxy_ = bus->GetObjectProxy( + object_proxy_ = bus->GetObjectProxy( bluetooth_manager::kBluetoothManagerServiceName, dbus::ObjectPath(bluetooth_manager::kBluetoothManagerServicePath)); - bluetooth_manager_proxy_->ConnectToSignal( + object_proxy_->ConnectToSignal( bluetooth_manager::kBluetoothManagerInterface, bluetooth_manager::kAdapterAddedSignal, base::Bind(&BluetoothManagerClientImpl::AdapterAddedReceived, @@ -37,7 +37,7 @@ class BluetoothManagerClientImpl : public BluetoothManagerClient { base::Bind(&BluetoothManagerClientImpl::AdapterAddedConnected, weak_ptr_factory_.GetWeakPtr())); - bluetooth_manager_proxy_->ConnectToSignal( + object_proxy_->ConnectToSignal( bluetooth_manager::kBluetoothManagerInterface, bluetooth_manager::kAdapterRemovedSignal, base::Bind(&BluetoothManagerClientImpl::AdapterRemovedReceived, @@ -45,7 +45,7 @@ class BluetoothManagerClientImpl : public BluetoothManagerClient { base::Bind(&BluetoothManagerClientImpl::AdapterRemovedConnected, weak_ptr_factory_.GetWeakPtr())); - bluetooth_manager_proxy_->ConnectToSignal( + object_proxy_->ConnectToSignal( bluetooth_manager::kBluetoothManagerInterface, bluetooth_manager::kDefaultAdapterChangedSignal, base::Bind(&BluetoothManagerClientImpl::DefaultAdapterChangedReceived, @@ -58,29 +58,25 @@ class BluetoothManagerClientImpl : public BluetoothManagerClient { } // BluetoothManagerClient override. - virtual void AddObserver(Observer* observer) { - VLOG(1) << "AddObserver"; + virtual void AddObserver(Observer* observer) OVERRIDE { DCHECK(observer); observers_.AddObserver(observer); } // BluetoothManagerClient override. - virtual void RemoveObserver(Observer* observer) { - VLOG(1) << "RemoveObserver"; + virtual void RemoveObserver(Observer* observer) OVERRIDE { DCHECK(observer); observers_.RemoveObserver(observer); } // BluetoothManagerClient override. - virtual void DefaultAdapter(const DefaultAdapterCallback& callback) { - LOG(INFO) << "DefaultAdapter"; - + virtual void DefaultAdapter(const DefaultAdapterCallback& callback) OVERRIDE { dbus::MethodCall method_call( bluetooth_manager::kBluetoothManagerInterface, bluetooth_manager::kDefaultAdapter); - DCHECK(bluetooth_manager_proxy_); - bluetooth_manager_proxy_->CallMethod( + DCHECK(object_proxy_); + object_proxy_->CallMethod( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, base::Bind(&BluetoothManagerClientImpl::OnDefaultAdapter, @@ -98,7 +94,8 @@ class BluetoothManagerClientImpl : public BluetoothManagerClient { << signal->ToString(); return; } - VLOG(1) << "Adapter added: " << object_path.value(); + + DVLOG(1) << "Adapter added: " << object_path.value(); FOR_EACH_OBSERVER(Observer, observers_, AdapterAdded(object_path)); } @@ -119,7 +116,8 @@ class BluetoothManagerClientImpl : public BluetoothManagerClient { << signal->ToString(); return; } - VLOG(1) << "Adapter removed: " << object_path.value(); + + DVLOG(1) << "Adapter removed: " << object_path.value(); FOR_EACH_OBSERVER(Observer, observers_, AdapterRemoved(object_path)); } @@ -140,7 +138,8 @@ class BluetoothManagerClientImpl : public BluetoothManagerClient { << signal->ToString(); return; } - VLOG(1) << "Default adapter changed: " << object_path.value(); + + DVLOG(1) << "Default adapter changed: " << object_path.value(); FOR_EACH_OBSERVER(Observer, observers_, DefaultAdapterChanged(object_path)); } @@ -158,22 +157,21 @@ class BluetoothManagerClientImpl : public BluetoothManagerClient { dbus::Response* response) { // Parse response. bool success = false; - dbus::ObjectPath adapter; + dbus::ObjectPath object_path; if (response != NULL) { dbus::MessageReader reader(response); - if (!reader.PopObjectPath(&adapter)) { + if (!reader.PopObjectPath(&object_path)) { LOG(ERROR) << "DefaultAdapter response has incorrect parameters: " << response->ToString(); } else { success = true; - LOG(INFO) << "OnDefaultAdapter: " << adapter.value(); } } else { LOG(ERROR) << "Failed to get default adapter."; } // Notify client. - callback.Run(adapter, success); + callback.Run(object_path, success); } // Weak pointer factory for generating 'this' pointers that might live longer @@ -181,7 +179,7 @@ class BluetoothManagerClientImpl : public BluetoothManagerClient { base::WeakPtrFactory<BluetoothManagerClientImpl> weak_ptr_factory_; // D-Bus proxy for BlueZ Manager interface. - dbus::ObjectProxy* bluetooth_manager_proxy_; + dbus::ObjectProxy* object_proxy_; // List of observers interested in event notifications from us. ObserverList<Observer> observers_; @@ -194,16 +192,17 @@ class BluetoothManagerClientImpl : public BluetoothManagerClient { class BluetoothManagerClientStubImpl : public BluetoothManagerClient { public: // BluetoothManagerClient override. - virtual void AddObserver(Observer* observer) { + virtual void AddObserver(Observer* observer) OVERRIDE { } // BluetoothManagerClient override. - virtual void RemoveObserver(Observer* observer) { + virtual void RemoveObserver(Observer* observer) OVERRIDE { } // BluetoothManagerClient override. - virtual void DefaultAdapter(const DefaultAdapterCallback& callback) { + virtual void DefaultAdapter(const DefaultAdapterCallback& callback) OVERRIDE { VLOG(1) << "Requested default adapter."; + callback.Run(dbus::ObjectPath(), false); } }; diff --git a/chrome/browser/chromeos/dbus/bluetooth_manager_client.h b/chrome/browser/chromeos/dbus/bluetooth_manager_client.h index a74f925..0abb6e6 100644 --- a/chrome/browser/chromeos/dbus/bluetooth_manager_client.h +++ b/chrome/browser/chromeos/dbus/bluetooth_manager_client.h @@ -43,7 +43,7 @@ class BluetoothManagerClient { virtual ~BluetoothManagerClient(); - // Adds and removes the observer. + // Adds and removes observers. virtual void AddObserver(Observer* observer) = 0; virtual void RemoveObserver(Observer* observer) = 0; diff --git a/chrome/browser/chromeos/dbus/bluetooth_property.cc b/chrome/browser/chromeos/dbus/bluetooth_property.cc index 630bacb..9f72429 100644 --- a/chrome/browser/chromeos/dbus/bluetooth_property.cc +++ b/chrome/browser/chromeos/dbus/bluetooth_property.cc @@ -24,7 +24,6 @@ void BluetoothPropertySet::ConnectSignals() { // dbus::PropertySet override. void BluetoothPropertySet::ChangedReceived(dbus::Signal* signal) { - DVLOG(1) << "ChangedReceived"; DCHECK(signal); dbus::MessageReader reader(signal); diff --git a/chrome/browser/chromeos/dbus/bluetooth_property.h b/chrome/browser/chromeos/dbus/bluetooth_property.h index c5d439d..7ae3090 100644 --- a/chrome/browser/chromeos/dbus/bluetooth_property.h +++ b/chrome/browser/chromeos/dbus/bluetooth_property.h @@ -69,8 +69,6 @@ class BluetoothProperty : public dbus::Property<T> { // // dbus::Property<> override. void Set(const T& value, SetCallback callback) { - DVLOG(1) << "Set: " << this->name(); - dbus::MethodCall method_call(this->GetInterface(), bluetooth_common::kSetProperty); dbus::MessageWriter writer(&method_call); |