diff options
author | keybuk@chromium.org <keybuk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-12 14:47:32 +0000 |
---|---|---|
committer | keybuk@chromium.org <keybuk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-12 14:47:32 +0000 |
commit | 627f4f4ec29191d02998358a0b9d8896547ffca1 (patch) | |
tree | dba063c373e62ef6dca9cd8dd0fc05150aa8efd4 /device | |
parent | 5ddc6f5f34fc08363a5acbdd089a1d8be680e8fb (diff) | |
download | chromium_src-627f4f4ec29191d02998358a0b9d8896547ffca1.zip chromium_src-627f4f4ec29191d02998358a0b9d8896547ffca1.tar.gz chromium_src-627f4f4ec29191d02998358a0b9d8896547ffca1.tar.bz2 |
Bluetooth: drop "Experimental" from Chrome OS backend
BUG=221813
TEST=device_unittests
Review URL: https://chromiumcodereview.appspot.com/14932007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205777 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device')
-rw-r--r-- | device/bluetooth/bluetooth.gyp | 16 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_adapter_chromeos.cc (renamed from device/bluetooth/bluetooth_adapter_experimental_chromeos.cc) | 219 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_adapter_chromeos.h (renamed from device/bluetooth/bluetooth_adapter_experimental_chromeos.h) | 56 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_adapter_factory.cc | 6 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_chromeos_unittest.cc (renamed from device/bluetooth/bluetooth_experimental_chromeos_unittest.cc) | 262 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_device_chromeos.cc (renamed from device/bluetooth/bluetooth_device_experimental_chromeos.cc) | 303 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_device_chromeos.h (renamed from device/bluetooth/bluetooth_device_experimental_chromeos.h) | 46 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_profile.cc | 6 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_profile_chromeos.cc (renamed from device/bluetooth/bluetooth_profile_experimental_chromeos.cc) | 94 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_profile_chromeos.h (renamed from device/bluetooth/bluetooth_profile_experimental_chromeos.h) | 41 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_profile_chromeos_unittest.cc | 8 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_socket_chromeos.cc (renamed from device/bluetooth/bluetooth_socket_experimental_chromeos.cc) | 27 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_socket_chromeos.h (renamed from device/bluetooth/bluetooth_socket_experimental_chromeos.h) | 22 | ||||
-rw-r--r-- | device/device.gyp | 2 |
14 files changed, 526 insertions, 582 deletions
diff --git a/device/bluetooth/bluetooth.gyp b/device/bluetooth/bluetooth.gyp index cd4788b..9da5cda 100644 --- a/device/bluetooth/bluetooth.gyp +++ b/device/bluetooth/bluetooth.gyp @@ -21,8 +21,8 @@ 'sources': [ 'bluetooth_adapter.cc', 'bluetooth_adapter.h', - 'bluetooth_adapter_experimental_chromeos.cc', - 'bluetooth_adapter_experimental_chromeos.h', + 'bluetooth_adapter_chromeos.cc', + 'bluetooth_adapter_chromeos.h', 'bluetooth_adapter_factory.cc', 'bluetooth_adapter_factory.h', 'bluetooth_adapter_mac.h', @@ -31,8 +31,8 @@ 'bluetooth_adapter_win.h', 'bluetooth_device.cc', 'bluetooth_device.h', - 'bluetooth_device_experimental_chromeos.cc', - 'bluetooth_device_experimental_chromeos.h', + 'bluetooth_device_chromeos.cc', + 'bluetooth_device_chromeos.h', 'bluetooth_device_mac.h', 'bluetooth_device_mac.mm', 'bluetooth_device_win.cc', @@ -42,8 +42,8 @@ 'bluetooth_out_of_band_pairing_data.h', 'bluetooth_profile.cc', 'bluetooth_profile.h', - 'bluetooth_profile_experimental_chromeos.cc', - 'bluetooth_profile_experimental_chromeos.h', + 'bluetooth_profile_chromeos.cc', + 'bluetooth_profile_chromeos.h', 'bluetooth_profile_mac.h', 'bluetooth_profile_mac.mm', 'bluetooth_profile_win.cc', @@ -55,8 +55,8 @@ 'bluetooth_service_record_win.cc', 'bluetooth_service_record_win.h', 'bluetooth_socket.h', - 'bluetooth_socket_experimental_chromeos.cc', - 'bluetooth_socket_experimental_chromeos.h', + 'bluetooth_socket_chromeos.cc', + 'bluetooth_socket_chromeos.h', 'bluetooth_socket_mac.h', 'bluetooth_socket_mac.mm', 'bluetooth_socket_win.cc', diff --git a/device/bluetooth/bluetooth_adapter_experimental_chromeos.cc b/device/bluetooth/bluetooth_adapter_chromeos.cc index 579dbb5..b5f6ba0 100644 --- a/device/bluetooth/bluetooth_adapter_experimental_chromeos.cc +++ b/device/bluetooth/bluetooth_adapter_chromeos.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "device/bluetooth/bluetooth_adapter_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_adapter_chromeos.h" #include <string> @@ -11,30 +11,26 @@ #include "base/logging.h" #include "base/metrics/histogram.h" #include "chromeos/chromeos_switches.h" +#include "chromeos/dbus/bluetooth_adapter_client.h" +#include "chromeos/dbus/bluetooth_device_client.h" +#include "chromeos/dbus/bluetooth_input_client.h" #include "chromeos/dbus/dbus_thread_manager.h" -#include "chromeos/dbus/experimental_bluetooth_adapter_client.h" -#include "chromeos/dbus/experimental_bluetooth_device_client.h" -#include "chromeos/dbus/experimental_bluetooth_input_client.h" #include "device/bluetooth/bluetooth_device.h" -#include "device/bluetooth/bluetooth_device_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_device_chromeos.h" using device::BluetoothAdapter; using device::BluetoothDevice; namespace chromeos { -BluetoothAdapterExperimentalChromeOS::BluetoothAdapterExperimentalChromeOS() +BluetoothAdapterChromeOS::BluetoothAdapterChromeOS() : weak_ptr_factory_(this) { - DBusThreadManager::Get()->GetExperimentalBluetoothAdapterClient()-> - AddObserver(this); - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> - AddObserver(this); - DBusThreadManager::Get()->GetExperimentalBluetoothInputClient()-> - AddObserver(this); + DBusThreadManager::Get()->GetBluetoothAdapterClient()->AddObserver(this); + DBusThreadManager::Get()->GetBluetoothDeviceClient()->AddObserver(this); + DBusThreadManager::Get()->GetBluetoothInputClient()->AddObserver(this); std::vector<dbus::ObjectPath> object_paths = - DBusThreadManager::Get()->GetExperimentalBluetoothAdapterClient()-> - GetAdapters(); + DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetAdapters(); if (!object_paths.empty()) { VLOG(1) << object_paths.size() << " Bluetooth adapter(s) available."; @@ -42,157 +38,150 @@ BluetoothAdapterExperimentalChromeOS::BluetoothAdapterExperimentalChromeOS() } } -BluetoothAdapterExperimentalChromeOS::~BluetoothAdapterExperimentalChromeOS() { - DBusThreadManager::Get()->GetExperimentalBluetoothAdapterClient()-> - RemoveObserver(this); - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> - RemoveObserver(this); - DBusThreadManager::Get()->GetExperimentalBluetoothInputClient()-> - RemoveObserver(this); +BluetoothAdapterChromeOS::~BluetoothAdapterChromeOS() { + DBusThreadManager::Get()->GetBluetoothAdapterClient()->RemoveObserver(this); + DBusThreadManager::Get()->GetBluetoothDeviceClient()->RemoveObserver(this); + DBusThreadManager::Get()->GetBluetoothInputClient()->RemoveObserver(this); } -void BluetoothAdapterExperimentalChromeOS::AddObserver( +void BluetoothAdapterChromeOS::AddObserver( BluetoothAdapter::Observer* observer) { DCHECK(observer); observers_.AddObserver(observer); } -void BluetoothAdapterExperimentalChromeOS::RemoveObserver( +void BluetoothAdapterChromeOS::RemoveObserver( BluetoothAdapter::Observer* observer) { DCHECK(observer); observers_.RemoveObserver(observer); } -std::string BluetoothAdapterExperimentalChromeOS::GetAddress() const { +std::string BluetoothAdapterChromeOS::GetAddress() const { if (!IsPresent()) return std::string(); - ExperimentalBluetoothAdapterClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothAdapterClient()-> + BluetoothAdapterClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothAdapterClient()-> GetProperties(object_path_); DCHECK(properties); return properties->address.value(); } -std::string BluetoothAdapterExperimentalChromeOS::GetName() const { +std::string BluetoothAdapterChromeOS::GetName() const { if (!IsPresent()) return std::string(); - ExperimentalBluetoothAdapterClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothAdapterClient()-> + BluetoothAdapterClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothAdapterClient()-> GetProperties(object_path_); DCHECK(properties); return properties->alias.value(); } -bool BluetoothAdapterExperimentalChromeOS::IsInitialized() const { +bool BluetoothAdapterChromeOS::IsInitialized() const { return true; } -bool BluetoothAdapterExperimentalChromeOS::IsPresent() const { +bool BluetoothAdapterChromeOS::IsPresent() const { return !object_path_.value().empty(); } -bool BluetoothAdapterExperimentalChromeOS::IsPowered() const { +bool BluetoothAdapterChromeOS::IsPowered() const { if (!IsPresent()) return false; - ExperimentalBluetoothAdapterClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothAdapterClient()-> + BluetoothAdapterClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothAdapterClient()-> GetProperties(object_path_); return properties->powered.value(); } -void BluetoothAdapterExperimentalChromeOS::SetPowered( +void BluetoothAdapterChromeOS::SetPowered( bool powered, const base::Closure& callback, const ErrorCallback& error_callback) { - DBusThreadManager::Get()->GetExperimentalBluetoothAdapterClient()-> + DBusThreadManager::Get()->GetBluetoothAdapterClient()-> GetProperties(object_path_)->powered.Set( powered, - base::Bind(&BluetoothAdapterExperimentalChromeOS::OnSetPowered, + base::Bind(&BluetoothAdapterChromeOS::OnSetPowered, weak_ptr_factory_.GetWeakPtr(), callback, error_callback)); } -bool BluetoothAdapterExperimentalChromeOS::IsDiscovering() const { +bool BluetoothAdapterChromeOS::IsDiscovering() const { if (!IsPresent()) return false; - ExperimentalBluetoothAdapterClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothAdapterClient()-> + BluetoothAdapterClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothAdapterClient()-> GetProperties(object_path_); return properties->discovering.value(); } -void BluetoothAdapterExperimentalChromeOS::StartDiscovering( +void BluetoothAdapterChromeOS::StartDiscovering( const base::Closure& callback, const ErrorCallback& error_callback) { // BlueZ counts discovery sessions, and permits multiple sessions for a // single connection, so issue a StartDiscovery() call for every use // within Chromium for the right behavior. - DBusThreadManager::Get()->GetExperimentalBluetoothAdapterClient()-> + DBusThreadManager::Get()->GetBluetoothAdapterClient()-> StartDiscovery( object_path_, - base::Bind( - &BluetoothAdapterExperimentalChromeOS::OnStartDiscovery, - weak_ptr_factory_.GetWeakPtr(), - callback), - base::Bind( - &BluetoothAdapterExperimentalChromeOS::OnStartDiscoveryError, - weak_ptr_factory_.GetWeakPtr(), - error_callback)); + base::Bind(&BluetoothAdapterChromeOS::OnStartDiscovery, + weak_ptr_factory_.GetWeakPtr(), + callback), + base::Bind(&BluetoothAdapterChromeOS::OnStartDiscoveryError, + weak_ptr_factory_.GetWeakPtr(), + error_callback)); } -void BluetoothAdapterExperimentalChromeOS::StopDiscovering( +void BluetoothAdapterChromeOS::StopDiscovering( const base::Closure& callback, const ErrorCallback& error_callback) { // Inform BlueZ to stop one of our open discovery sessions. - DBusThreadManager::Get()->GetExperimentalBluetoothAdapterClient()-> + DBusThreadManager::Get()->GetBluetoothAdapterClient()-> StopDiscovery( object_path_, - base::Bind( - &BluetoothAdapterExperimentalChromeOS::OnStopDiscovery, - weak_ptr_factory_.GetWeakPtr(), - callback), - base::Bind( - &BluetoothAdapterExperimentalChromeOS::OnStopDiscoveryError, - weak_ptr_factory_.GetWeakPtr(), - error_callback)); + base::Bind(&BluetoothAdapterChromeOS::OnStopDiscovery, + weak_ptr_factory_.GetWeakPtr(), + callback), + base::Bind(&BluetoothAdapterChromeOS::OnStopDiscoveryError, + weak_ptr_factory_.GetWeakPtr(), + error_callback)); } -void BluetoothAdapterExperimentalChromeOS::ReadLocalOutOfBandPairingData( +void BluetoothAdapterChromeOS::ReadLocalOutOfBandPairingData( const BluetoothAdapter::BluetoothOutOfBandPairingDataCallback& callback, const ErrorCallback& error_callback) { error_callback.Run(); } -void BluetoothAdapterExperimentalChromeOS::AdapterAdded( +void BluetoothAdapterChromeOS::AdapterAdded( const dbus::ObjectPath& object_path) { // Set the adapter to the newly added adapter only if no adapter is present. if (!IsPresent()) SetAdapter(object_path); } -void BluetoothAdapterExperimentalChromeOS::AdapterRemoved( +void BluetoothAdapterChromeOS::AdapterRemoved( const dbus::ObjectPath& object_path) { if (object_path == object_path_) RemoveAdapter(); } -void BluetoothAdapterExperimentalChromeOS::AdapterPropertyChanged( +void BluetoothAdapterChromeOS::AdapterPropertyChanged( const dbus::ObjectPath& object_path, const std::string& property_name) { if (object_path != object_path_) return; - ExperimentalBluetoothAdapterClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothAdapterClient()-> + BluetoothAdapterClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothAdapterClient()-> GetProperties(object_path_); if (property_name == properties->powered.name()) @@ -201,16 +190,16 @@ void BluetoothAdapterExperimentalChromeOS::AdapterPropertyChanged( DiscoveringChanged(properties->discovering.value()); } -void BluetoothAdapterExperimentalChromeOS::DeviceAdded( +void BluetoothAdapterChromeOS::DeviceAdded( const dbus::ObjectPath& object_path) { - ExperimentalBluetoothDeviceClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()-> GetProperties(object_path); if (properties->adapter.value() != object_path_) return; - BluetoothDeviceExperimentalChromeOS* device_chromeos = - new BluetoothDeviceExperimentalChromeOS(this, object_path); + BluetoothDeviceChromeOS* device_chromeos = + new BluetoothDeviceChromeOS(this, object_path); DCHECK(devices_.find(device_chromeos->GetAddress()) == devices_.end()); devices_[device_chromeos->GetAddress()] = device_chromeos; @@ -219,12 +208,12 @@ void BluetoothAdapterExperimentalChromeOS::DeviceAdded( DeviceAdded(this, device_chromeos)); } -void BluetoothAdapterExperimentalChromeOS::DeviceRemoved( +void BluetoothAdapterChromeOS::DeviceRemoved( const dbus::ObjectPath& object_path) { for (DevicesMap::iterator iter = devices_.begin(); iter != devices_.end(); ++iter) { - BluetoothDeviceExperimentalChromeOS* device_chromeos = - static_cast<BluetoothDeviceExperimentalChromeOS*>(iter->second); + BluetoothDeviceChromeOS* device_chromeos = + static_cast<BluetoothDeviceChromeOS*>(iter->second); if (device_chromeos->object_path() == object_path) { devices_.erase(iter); @@ -236,16 +225,15 @@ void BluetoothAdapterExperimentalChromeOS::DeviceRemoved( } } -void BluetoothAdapterExperimentalChromeOS::DevicePropertyChanged( +void BluetoothAdapterChromeOS::DevicePropertyChanged( const dbus::ObjectPath& object_path, const std::string& property_name) { - BluetoothDeviceExperimentalChromeOS* device_chromeos = - GetDeviceWithPath(object_path); + BluetoothDeviceChromeOS* device_chromeos = GetDeviceWithPath(object_path); if (!device_chromeos) return; - ExperimentalBluetoothDeviceClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()-> GetProperties(object_path); if (property_name == properties->bluetooth_class.name() || @@ -271,16 +259,15 @@ void BluetoothAdapterExperimentalChromeOS::DevicePropertyChanged( } } -void BluetoothAdapterExperimentalChromeOS::InputPropertyChanged( +void BluetoothAdapterChromeOS::InputPropertyChanged( const dbus::ObjectPath& object_path, const std::string& property_name) { - BluetoothDeviceExperimentalChromeOS* device_chromeos = - GetDeviceWithPath(object_path); + BluetoothDeviceChromeOS* device_chromeos = GetDeviceWithPath(object_path); if (!device_chromeos) return; - ExperimentalBluetoothInputClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothInputClient()-> + BluetoothInputClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothInputClient()-> GetProperties(object_path); // Properties structure can be removed, which triggers a change in the @@ -291,13 +278,13 @@ void BluetoothAdapterExperimentalChromeOS::InputPropertyChanged( NotifyDeviceChanged(device_chromeos); } -BluetoothDeviceExperimentalChromeOS* -BluetoothAdapterExperimentalChromeOS::GetDeviceWithPath( +BluetoothDeviceChromeOS* +BluetoothAdapterChromeOS::GetDeviceWithPath( const dbus::ObjectPath& object_path) { for (DevicesMap::iterator iter = devices_.begin(); iter != devices_.end(); ++iter) { - BluetoothDeviceExperimentalChromeOS* device_chromeos = - static_cast<BluetoothDeviceExperimentalChromeOS*>(iter->second); + BluetoothDeviceChromeOS* device_chromeos = + static_cast<BluetoothDeviceChromeOS*>(iter->second); if (device_chromeos->object_path() == object_path) return device_chromeos; } @@ -305,8 +292,7 @@ BluetoothAdapterExperimentalChromeOS::GetDeviceWithPath( return NULL; } -void BluetoothAdapterExperimentalChromeOS::SetAdapter( - const dbus::ObjectPath& object_path) { +void BluetoothAdapterChromeOS::SetAdapter(const dbus::ObjectPath& object_path) { DCHECK(!IsPresent()); object_path_ = object_path; @@ -314,8 +300,8 @@ void BluetoothAdapterExperimentalChromeOS::SetAdapter( SetAdapterName(); - ExperimentalBluetoothAdapterClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothAdapterClient()-> + BluetoothAdapterClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothAdapterClient()-> GetProperties(object_path_); PresentChanged(true); @@ -326,13 +312,13 @@ void BluetoothAdapterExperimentalChromeOS::SetAdapter( DiscoveringChanged(true); std::vector<dbus::ObjectPath> device_paths = - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> + DBusThreadManager::Get()->GetBluetoothDeviceClient()-> GetDevicesForAdapter(object_path_); for (std::vector<dbus::ObjectPath>::iterator iter = device_paths.begin(); iter != device_paths.end(); ++iter) { - BluetoothDeviceExperimentalChromeOS* device_chromeos = - new BluetoothDeviceExperimentalChromeOS(this, *iter); + BluetoothDeviceChromeOS* device_chromeos = + new BluetoothDeviceChromeOS(this, *iter); devices_[device_chromeos->GetAddress()] = device_chromeos; @@ -341,7 +327,7 @@ void BluetoothAdapterExperimentalChromeOS::SetAdapter( } } -void BluetoothAdapterExperimentalChromeOS::SetAdapterName() { +void BluetoothAdapterChromeOS::SetAdapterName() { // Set a better name for the adapter than "BlueZ 5.x"; this isn't an ideal // way to do this but it'll do for now. See http://crbug.com/126732 and // http://crbug.com/126802. @@ -361,24 +347,24 @@ void BluetoothAdapterExperimentalChromeOS::SetAdapterName() { alias = "Chromebook"; } - DBusThreadManager::Get()->GetExperimentalBluetoothAdapterClient()-> + DBusThreadManager::Get()->GetBluetoothAdapterClient()-> GetProperties(object_path_)->alias.Set( alias, - base::Bind(&BluetoothAdapterExperimentalChromeOS::OnSetAlias, + base::Bind(&BluetoothAdapterChromeOS::OnSetAlias, weak_ptr_factory_.GetWeakPtr())); } -void BluetoothAdapterExperimentalChromeOS::OnSetAlias(bool success) { +void BluetoothAdapterChromeOS::OnSetAlias(bool success) { LOG_IF(WARNING, !success) << object_path_.value() << ": Failed to set adapter alias"; } -void BluetoothAdapterExperimentalChromeOS::RemoveAdapter() { +void BluetoothAdapterChromeOS::RemoveAdapter() { DCHECK(IsPresent()); VLOG(1) << object_path_.value() << ": adapter removed."; - ExperimentalBluetoothAdapterClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothAdapterClient()-> + BluetoothAdapterClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothAdapterClient()-> GetProperties(object_path_); object_path_ = dbus::ObjectPath(""); @@ -403,46 +389,44 @@ void BluetoothAdapterExperimentalChromeOS::RemoveAdapter() { PresentChanged(false); } -void BluetoothAdapterExperimentalChromeOS::PoweredChanged(bool powered) { +void BluetoothAdapterChromeOS::PoweredChanged(bool powered) { FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, AdapterPoweredChanged(this, powered)); } -void BluetoothAdapterExperimentalChromeOS::DiscoveringChanged( +void BluetoothAdapterChromeOS::DiscoveringChanged( bool discovering) { FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, AdapterDiscoveringChanged(this, discovering)); } -void BluetoothAdapterExperimentalChromeOS::PresentChanged(bool present) { +void BluetoothAdapterChromeOS::PresentChanged(bool present) { FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, AdapterPresentChanged(this, present)); } -void BluetoothAdapterExperimentalChromeOS::NotifyDeviceChanged( - BluetoothDeviceExperimentalChromeOS* device) { +void BluetoothAdapterChromeOS::NotifyDeviceChanged( + BluetoothDeviceChromeOS* device) { DCHECK(device->adapter_ == this); FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, DeviceChanged(this, device)); } -void BluetoothAdapterExperimentalChromeOS::OnSetPowered( - const base::Closure& callback, - const ErrorCallback& error_callback, - bool success) { +void BluetoothAdapterChromeOS::OnSetPowered(const base::Closure& callback, + const ErrorCallback& error_callback, + bool success) { if (success) callback.Run(); else error_callback.Run(); } -void BluetoothAdapterExperimentalChromeOS::OnStartDiscovery( - const base::Closure& callback) { +void BluetoothAdapterChromeOS::OnStartDiscovery(const base::Closure& callback) { callback.Run(); } -void BluetoothAdapterExperimentalChromeOS::OnStartDiscoveryError( +void BluetoothAdapterChromeOS::OnStartDiscoveryError( const ErrorCallback& error_callback, const std::string& error_name, const std::string& error_message) { @@ -451,12 +435,11 @@ void BluetoothAdapterExperimentalChromeOS::OnStartDiscoveryError( error_callback.Run(); } -void BluetoothAdapterExperimentalChromeOS::OnStopDiscovery( - const base::Closure& callback) { +void BluetoothAdapterChromeOS::OnStopDiscovery(const base::Closure& callback) { callback.Run(); } -void BluetoothAdapterExperimentalChromeOS::OnStopDiscoveryError( +void BluetoothAdapterChromeOS::OnStopDiscoveryError( const ErrorCallback& error_callback, const std::string& error_name, const std::string& error_message) { diff --git a/device/bluetooth/bluetooth_adapter_experimental_chromeos.h b/device/bluetooth/bluetooth_adapter_chromeos.h index 80dce84..74beb35 100644 --- a/device/bluetooth/bluetooth_adapter_experimental_chromeos.h +++ b/device/bluetooth/bluetooth_adapter_chromeos.h @@ -1,16 +1,16 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_EXPERIMENTAL_CHROMEOS_H_ -#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_EXPERIMENTAL_CHROMEOS_H_ +#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ +#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ #include <string> #include "base/memory/weak_ptr.h" -#include "chromeos/dbus/experimental_bluetooth_adapter_client.h" -#include "chromeos/dbus/experimental_bluetooth_device_client.h" -#include "chromeos/dbus/experimental_bluetooth_input_client.h" +#include "chromeos/dbus/bluetooth_adapter_client.h" +#include "chromeos/dbus/bluetooth_device_client.h" +#include "chromeos/dbus/bluetooth_input_client.h" #include "dbus/object_path.h" #include "device/bluetooth/bluetooth_adapter.h" @@ -22,18 +22,16 @@ class BluetoothAdapterFactory; namespace chromeos { -class BluetoothDeviceExperimentalChromeOS; -class BluetoothExperimentalChromeOSTest; +class BluetoothChromeOSTest; +class BluetoothDeviceChromeOS; -// The BluetoothAdapterExperimentalChromeOS class is an alternate implementation -// of BluetoothAdapter for the Chrome OS platform using the Bluetooth Smart -// capable backend. It will become the sole implementation for Chrome OS, and -// be renamed to BluetoothAdapterChromeOS, once the backend is switched, -class BluetoothAdapterExperimentalChromeOS +// The BluetoothAdapterChromeOS class implements BluetoothAdapter for the +// Chrome OS platform. +class BluetoothAdapterChromeOS : public device::BluetoothAdapter, - private chromeos::ExperimentalBluetoothAdapterClient::Observer, - private chromeos::ExperimentalBluetoothDeviceClient::Observer, - private chromeos::ExperimentalBluetoothInputClient::Observer { + private chromeos::BluetoothAdapterClient::Observer, + private chromeos::BluetoothDeviceClient::Observer, + private chromeos::BluetoothInputClient::Observer { public: // BluetoothAdapter override virtual void AddObserver( @@ -63,34 +61,34 @@ class BluetoothAdapterExperimentalChromeOS private: friend class device::BluetoothAdapterFactory; - friend class BluetoothDeviceExperimentalChromeOS; - friend class BluetoothExperimentalChromeOSTest; - friend class BluetoothProfileExperimentalChromeOS; + friend class BluetoothChromeOSTest; + friend class BluetoothDeviceChromeOS; + friend class BluetoothProfileChromeOS; friend class BluetoothProfileChromeOSTest; - BluetoothAdapterExperimentalChromeOS(); - virtual ~BluetoothAdapterExperimentalChromeOS(); + BluetoothAdapterChromeOS(); + virtual ~BluetoothAdapterChromeOS(); - // ExperimentalBluetoothAdapterClient::Observer override. + // BluetoothAdapterClient::Observer override. virtual void AdapterAdded(const dbus::ObjectPath& object_path) OVERRIDE; virtual void AdapterRemoved(const dbus::ObjectPath& object_path) OVERRIDE; virtual void AdapterPropertyChanged( const dbus::ObjectPath& object_path, const std::string& property_name) OVERRIDE; - // ExperimentalBluetoothDeviceClient::Observer override. + // BluetoothDeviceClient::Observer override. virtual void DeviceAdded(const dbus::ObjectPath& object_path) OVERRIDE; virtual void DeviceRemoved(const dbus::ObjectPath& object_path) OVERRIDE; virtual void DevicePropertyChanged(const dbus::ObjectPath& object_path, const std::string& property_name) OVERRIDE; - // ExperimentalBluetoothInputClient::Observer override. + // BluetoothInputClient::Observer override. virtual void InputPropertyChanged(const dbus::ObjectPath& object_path, const std::string& property_name) OVERRIDE; // Internal method used to locate the device object by object path // (the devices map and BluetoothDevice methods are by address) - BluetoothDeviceExperimentalChromeOS* GetDeviceWithPath( + BluetoothDeviceChromeOS* GetDeviceWithPath( const dbus::ObjectPath& object_path); // Set the tracked adapter to the one in |object_path|, this object will @@ -113,7 +111,7 @@ class BluetoothAdapterExperimentalChromeOS // Announce to observers a change in device state that is not reflected by // its D-Bus properties. - void NotifyDeviceChanged(BluetoothDeviceExperimentalChromeOS* device); + void NotifyDeviceChanged(BluetoothDeviceChromeOS* device); // Called by dbus:: on completion of the powered property change. void OnSetPowered(const base::Closure& callback, @@ -140,11 +138,11 @@ class BluetoothAdapterExperimentalChromeOS // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. - base::WeakPtrFactory<BluetoothAdapterExperimentalChromeOS> weak_ptr_factory_; + base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterExperimentalChromeOS); + DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); }; } // namespace chromeos -#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_EXPERIMENTAL_CHROMEOS_H_ +#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ diff --git a/device/bluetooth/bluetooth_adapter_factory.cc b/device/bluetooth/bluetooth_adapter_factory.cc index 0b9d160..262c95b 100644 --- a/device/bluetooth/bluetooth_adapter_factory.cc +++ b/device/bluetooth/bluetooth_adapter_factory.cc @@ -13,7 +13,7 @@ #include "device/bluetooth/bluetooth_adapter.h" #if defined(OS_CHROMEOS) -#include "device/bluetooth/bluetooth_adapter_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_adapter_chromeos.h" #elif defined(OS_WIN) #include "device/bluetooth/bluetooth_adapter_win.h" #elif defined(OS_MACOSX) @@ -74,8 +74,8 @@ bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() { void BluetoothAdapterFactory::GetAdapter(const AdapterCallback& callback) { if (!default_adapter.Get().get()) { #if defined(OS_CHROMEOS) - chromeos::BluetoothAdapterExperimentalChromeOS* new_adapter = - new chromeos::BluetoothAdapterExperimentalChromeOS(); + chromeos::BluetoothAdapterChromeOS* new_adapter = + new chromeos::BluetoothAdapterChromeOS(); default_adapter.Get() = new_adapter->weak_ptr_factory_.GetWeakPtr(); #elif defined(OS_WIN) BluetoothAdapterWin* new_adapter = new BluetoothAdapterWin( diff --git a/device/bluetooth/bluetooth_experimental_chromeos_unittest.cc b/device/bluetooth/bluetooth_chromeos_unittest.cc index a680a4b..6020ce4 100644 --- a/device/bluetooth/bluetooth_experimental_chromeos_unittest.cc +++ b/device/bluetooth/bluetooth_chromeos_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,10 +9,10 @@ #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h" #include "dbus/object_path.h" #include "device/bluetooth/bluetooth_adapter.h" -#include "device/bluetooth/bluetooth_adapter_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_adapter_chromeos.h" #include "device/bluetooth/bluetooth_adapter_factory.h" #include "device/bluetooth/bluetooth_device.h" -#include "device/bluetooth/bluetooth_device_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_device_chromeos.h" #include "testing/gtest/include/gtest/gtest.h" using device::BluetoothAdapter; @@ -205,7 +205,7 @@ class TestPairingDelegate : public BluetoothDevice::PairingDelegate { } }; -class BluetoothExperimentalChromeOSTest : public testing::Test { +class BluetoothChromeOSTest : public testing::Test { public: virtual void SetUp() { mock_dbus_thread_manager_ = @@ -243,7 +243,7 @@ class BluetoothExperimentalChromeOSTest : public testing::Test { // Call to fill the adapter_ member with a BluetoothAdapter instance. void GetAdapter() { - adapter_ = new BluetoothAdapterExperimentalChromeOS(); + adapter_ = new BluetoothAdapterChromeOS(); ASSERT_TRUE(adapter_ != NULL); ASSERT_TRUE(adapter_->IsInitialized()); } @@ -269,14 +269,14 @@ class BluetoothExperimentalChromeOSTest : public testing::Test { adapter_->SetPowered( true, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); adapter_->StartDiscovering( - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); ASSERT_EQ(2, callback_count_); ASSERT_EQ(0, error_callback_count_); @@ -290,9 +290,9 @@ class BluetoothExperimentalChromeOSTest : public testing::Test { base::MessageLoop::current()->Run(); adapter_->StopDiscovering( - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); ASSERT_EQ(1, callback_count_); ASSERT_EQ(0, error_callback_count_); @@ -321,7 +321,7 @@ class BluetoothExperimentalChromeOSTest : public testing::Test { enum BluetoothDevice::ConnectErrorCode last_connect_error_; }; -TEST_F(BluetoothExperimentalChromeOSTest, AlreadyPresent) { +TEST_F(BluetoothChromeOSTest, AlreadyPresent) { GetAdapter(); // This verifies that the class gets the list of adapters when created; @@ -339,7 +339,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, AlreadyPresent) { devices[0]->GetAddress()); } -TEST_F(BluetoothExperimentalChromeOSTest, BecomePresent) { +TEST_F(BluetoothChromeOSTest, BecomePresent) { fake_bluetooth_adapter_client_->SetVisible(false); GetAdapter(); ASSERT_FALSE(adapter_->IsPresent()); @@ -368,7 +368,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, BecomePresent) { EXPECT_FALSE(adapter_->IsDiscovering()); } -TEST_F(BluetoothExperimentalChromeOSTest, BecomeNotPresent) { +TEST_F(BluetoothChromeOSTest, BecomeNotPresent) { GetAdapter(); ASSERT_TRUE(adapter_->IsPresent()); @@ -396,7 +396,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, BecomeNotPresent) { EXPECT_FALSE(adapter_->IsDiscovering()); } -TEST_F(BluetoothExperimentalChromeOSTest, SecondAdapter) { +TEST_F(BluetoothChromeOSTest, SecondAdapter) { GetAdapter(); ASSERT_TRUE(adapter_->IsPresent()); @@ -443,7 +443,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, SecondAdapter) { EXPECT_EQ(0, observer.discovering_changed_count_); } -TEST_F(BluetoothExperimentalChromeOSTest, BecomePowered) { +TEST_F(BluetoothChromeOSTest, BecomePowered) { GetAdapter(); ASSERT_FALSE(adapter_->IsPowered()); @@ -454,9 +454,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, BecomePowered) { adapter_->SetPowered( true, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); EXPECT_EQ(1, callback_count_); EXPECT_EQ(0, error_callback_count_); @@ -467,13 +467,13 @@ TEST_F(BluetoothExperimentalChromeOSTest, BecomePowered) { EXPECT_TRUE(adapter_->IsPowered()); } -TEST_F(BluetoothExperimentalChromeOSTest, BecomeNotPowered) { +TEST_F(BluetoothChromeOSTest, BecomeNotPowered) { GetAdapter(); adapter_->SetPowered( true, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); EXPECT_EQ(1, callback_count_); EXPECT_EQ(0, error_callback_count_); @@ -488,9 +488,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, BecomeNotPowered) { adapter_->SetPowered( false, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); EXPECT_EQ(1, callback_count_); EXPECT_EQ(0, error_callback_count_); @@ -501,21 +501,21 @@ TEST_F(BluetoothExperimentalChromeOSTest, BecomeNotPowered) { EXPECT_FALSE(adapter_->IsPowered()); } -TEST_F(BluetoothExperimentalChromeOSTest, StopDiscovery) { +TEST_F(BluetoothChromeOSTest, StopDiscovery) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); GetAdapter(); adapter_->SetPowered( true, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); adapter_->StartDiscovering( - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); EXPECT_EQ(2, callback_count_); EXPECT_EQ(0, error_callback_count_); @@ -531,9 +531,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, StopDiscovery) { adapter_->AddObserver(&observer); adapter_->StopDiscovering( - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); EXPECT_EQ(1, callback_count_); EXPECT_EQ(0, error_callback_count_); @@ -544,21 +544,21 @@ TEST_F(BluetoothExperimentalChromeOSTest, StopDiscovery) { EXPECT_FALSE(adapter_->IsDiscovering()); } -TEST_F(BluetoothExperimentalChromeOSTest, StopDiscoveryAfterTwoStarts) { +TEST_F(BluetoothChromeOSTest, StopDiscoveryAfterTwoStarts) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); GetAdapter(); adapter_->SetPowered( true, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); adapter_->StartDiscovering( - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); EXPECT_EQ(2, callback_count_); EXPECT_EQ(0, error_callback_count_); @@ -573,9 +573,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, StopDiscoveryAfterTwoStarts) { adapter_->AddObserver(&observer); adapter_->StartDiscovering( - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); EXPECT_EQ(1, callback_count_); EXPECT_EQ(0, error_callback_count_); @@ -586,9 +586,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, StopDiscoveryAfterTwoStarts) { // Stop discovering; only the callback should be called since we're still // discovering. The adapter should be still discovering. adapter_->StopDiscovering( - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); EXPECT_EQ(1, callback_count_); EXPECT_EQ(0, error_callback_count_); @@ -602,9 +602,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, StopDiscoveryAfterTwoStarts) { // AdapterDiscoveringChanged method to be called and no longer to be // discovering, adapter_->StopDiscovering( - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); EXPECT_EQ(1, callback_count_); EXPECT_EQ(0, error_callback_count_); @@ -615,7 +615,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, StopDiscoveryAfterTwoStarts) { EXPECT_FALSE(adapter_->IsDiscovering()); } -TEST_F(BluetoothExperimentalChromeOSTest, Discovery) { +TEST_F(BluetoothChromeOSTest, Discovery) { // Test a simulated discovery session. base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); @@ -627,14 +627,14 @@ TEST_F(BluetoothExperimentalChromeOSTest, Discovery) { adapter_->SetPowered( true, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); adapter_->StartDiscovering( - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); EXPECT_EQ(2, callback_count_); EXPECT_EQ(0, error_callback_count_); @@ -663,20 +663,20 @@ TEST_F(BluetoothExperimentalChromeOSTest, Discovery) { observer.last_device_address_); } -TEST_F(BluetoothExperimentalChromeOSTest, PoweredAndDiscovering) { +TEST_F(BluetoothChromeOSTest, PoweredAndDiscovering) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); GetAdapter(); adapter_->SetPowered( true, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); adapter_->StartDiscovering( - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); EXPECT_EQ(2, callback_count_); EXPECT_EQ(0, error_callback_count_); @@ -734,7 +734,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PoweredAndDiscovering) { EXPECT_FALSE(adapter_->IsDiscovering()); } -TEST_F(BluetoothExperimentalChromeOSTest, DeviceProperties) { +TEST_F(BluetoothChromeOSTest, DeviceProperties) { GetAdapter(); BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); @@ -763,7 +763,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, DeviceProperties) { EXPECT_EQ(0x0306, devices[0]->GetDeviceID()); } -TEST_F(BluetoothExperimentalChromeOSTest, DeviceClassChanged) { +TEST_F(BluetoothChromeOSTest, DeviceClassChanged) { // Simulate a change of class of a device, as sometimes occurs // during discovery. GetAdapter(); @@ -791,7 +791,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, DeviceClassChanged) { EXPECT_EQ(BluetoothDevice::DEVICE_MOUSE, devices[0]->GetDeviceType()); } -TEST_F(BluetoothExperimentalChromeOSTest, DeviceNameChanged) { +TEST_F(BluetoothChromeOSTest, DeviceNameChanged) { // Simulate a change of name of a device. GetAdapter(); @@ -820,7 +820,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, DeviceNameChanged) { EXPECT_EQ(UTF8ToUTF16(new_name), devices[0]->GetName()); } -TEST_F(BluetoothExperimentalChromeOSTest, DeviceUuidsChanged) { +TEST_F(BluetoothChromeOSTest, DeviceUuidsChanged) { // Simulate a change of advertised services of a device. GetAdapter(); @@ -862,7 +862,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, DeviceUuidsChanged) { EXPECT_EQ(uuids[4], "0000110a-0000-1000-8000-00805f9b34fb"); } -TEST_F(BluetoothExperimentalChromeOSTest, ForgetDevice) { +TEST_F(BluetoothChromeOSTest, ForgetDevice) { GetAdapter(); BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); @@ -878,7 +878,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, ForgetDevice) { adapter_->AddObserver(&observer); devices[0]->Forget( - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); EXPECT_EQ(0, error_callback_count_); @@ -890,7 +890,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, ForgetDevice) { ASSERT_EQ(0U, devices.size()); } -TEST_F(BluetoothExperimentalChromeOSTest, ForgetUnpairedDevice) { +TEST_F(BluetoothChromeOSTest, ForgetUnpairedDevice) { GetAdapter(); DiscoverDevices(); @@ -902,9 +902,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, ForgetUnpairedDevice) { // Connect the device so it becomes trusted and remembered. device->Connect( NULL, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); ASSERT_EQ(1, callback_count_); @@ -926,7 +926,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, ForgetUnpairedDevice) { adapter_->AddObserver(&observer); device->Forget( - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); EXPECT_EQ(0, error_callback_count_); @@ -940,7 +940,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, ForgetUnpairedDevice) { EXPECT_FALSE(device != NULL); } -TEST_F(BluetoothExperimentalChromeOSTest, ConnectPairedDevice) { +TEST_F(BluetoothChromeOSTest, ConnectPairedDevice) { GetAdapter(); BluetoothDevice* device = adapter_->GetDevice( @@ -955,9 +955,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, ConnectPairedDevice) { // this should succeed and the device should become connected. device->Connect( NULL, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(1, callback_count_); @@ -972,7 +972,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, ConnectPairedDevice) { EXPECT_FALSE(device->IsConnecting()); } -TEST_F(BluetoothExperimentalChromeOSTest, ConnectUnpairableDevice) { +TEST_F(BluetoothChromeOSTest, ConnectUnpairableDevice) { GetAdapter(); DiscoverDevices(); @@ -988,9 +988,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, ConnectUnpairableDevice) { // pairing, this should succeed and the device should become connected. device->Connect( NULL, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(1, callback_count_); @@ -1017,7 +1017,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, ConnectUnpairableDevice) { EXPECT_FALSE(device->IsConnectable()); } -TEST_F(BluetoothExperimentalChromeOSTest, ConnectConnectedDevice) { +TEST_F(BluetoothChromeOSTest, ConnectConnectedDevice) { GetAdapter(); BluetoothDevice* device = adapter_->GetDevice( @@ -1027,9 +1027,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, ConnectConnectedDevice) { device->Connect( NULL, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); ASSERT_EQ(1, callback_count_); @@ -1045,9 +1045,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, ConnectConnectedDevice) { device->Connect( NULL, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(1, callback_count_); @@ -1061,7 +1061,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, ConnectConnectedDevice) { EXPECT_FALSE(device->IsConnecting()); } -TEST_F(BluetoothExperimentalChromeOSTest, ConnectDeviceFails) { +TEST_F(BluetoothChromeOSTest, ConnectDeviceFails) { GetAdapter(); DiscoverDevices(); @@ -1077,9 +1077,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, ConnectDeviceFails) { // this should fail with an error. device->Connect( NULL, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(0, callback_count_); @@ -1092,7 +1092,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, ConnectDeviceFails) { EXPECT_FALSE(device->IsConnecting()); } -TEST_F(BluetoothExperimentalChromeOSTest, DisconnectDevice) { +TEST_F(BluetoothChromeOSTest, DisconnectDevice) { GetAdapter(); BluetoothDevice* device = adapter_->GetDevice( @@ -1102,9 +1102,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, DisconnectDevice) { device->Connect( NULL, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); ASSERT_EQ(1, callback_count_); @@ -1120,9 +1120,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, DisconnectDevice) { adapter_->AddObserver(&observer); device->Disconnect( - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); EXPECT_EQ(1, callback_count_); @@ -1134,7 +1134,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, DisconnectDevice) { EXPECT_FALSE(device->IsConnected()); } -TEST_F(BluetoothExperimentalChromeOSTest, DisconnectUnconnectedDevice) { +TEST_F(BluetoothChromeOSTest, DisconnectUnconnectedDevice) { GetAdapter(); BluetoothDevice* device = adapter_->GetDevice( @@ -1149,9 +1149,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, DisconnectUnconnectedDevice) { adapter_->AddObserver(&observer); device->Disconnect( - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ErrorCallback, + base::Bind(&BluetoothChromeOSTest::ErrorCallback, base::Unretained(this))); EXPECT_EQ(0, callback_count_); @@ -1162,7 +1162,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, DisconnectUnconnectedDevice) { EXPECT_FALSE(device->IsConnected()); } -TEST_F(BluetoothExperimentalChromeOSTest, PairAppleMouse) { +TEST_F(BluetoothChromeOSTest, PairAppleMouse) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1182,9 +1182,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairAppleMouse) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(0, pairing_delegate.call_count_); @@ -1223,7 +1223,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairAppleMouse) { EXPECT_TRUE(properties->trusted.value()); } -TEST_F(BluetoothExperimentalChromeOSTest, PairAppleKeyboard) { +TEST_F(BluetoothChromeOSTest, PairAppleKeyboard) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1243,9 +1243,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairAppleKeyboard) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(1, pairing_delegate.call_count_); @@ -1285,7 +1285,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairAppleKeyboard) { EXPECT_TRUE(properties->trusted.value()); } -TEST_F(BluetoothExperimentalChromeOSTest, PairMotorolaKeyboard) { +TEST_F(BluetoothChromeOSTest, PairMotorolaKeyboard) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1305,9 +1305,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairMotorolaKeyboard) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); // One call for DisplayPasskey() and one for KeysEntered(). @@ -1368,7 +1368,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairMotorolaKeyboard) { EXPECT_TRUE(properties->trusted.value()); } -TEST_F(BluetoothExperimentalChromeOSTest, PairSonyHeadphones) { +TEST_F(BluetoothChromeOSTest, PairSonyHeadphones) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1387,9 +1387,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairSonyHeadphones) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(1, pairing_delegate.call_count_); @@ -1431,7 +1431,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairSonyHeadphones) { EXPECT_TRUE(properties->trusted.value()); } -TEST_F(BluetoothExperimentalChromeOSTest, PairPhone) { +TEST_F(BluetoothChromeOSTest, PairPhone) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1450,9 +1450,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairPhone) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(1, pairing_delegate.call_count_); @@ -1491,7 +1491,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairPhone) { EXPECT_TRUE(properties->trusted.value()); } -TEST_F(BluetoothExperimentalChromeOSTest, PairWeirdDevice) { +TEST_F(BluetoothChromeOSTest, PairWeirdDevice) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1512,9 +1512,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairWeirdDevice) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(1, pairing_delegate.call_count_); @@ -1552,7 +1552,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairWeirdDevice) { EXPECT_TRUE(properties->trusted.value()); } -TEST_F(BluetoothExperimentalChromeOSTest, PairUnpairableDeviceFails) { +TEST_F(BluetoothChromeOSTest, PairUnpairableDeviceFails) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1570,9 +1570,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairUnpairableDeviceFails) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(0, pairing_delegate.call_count_); @@ -1595,7 +1595,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairUnpairableDeviceFails) { EXPECT_EQ(1, pairing_delegate.dismiss_count_); } -TEST_F(BluetoothExperimentalChromeOSTest, PairingFails) { +TEST_F(BluetoothChromeOSTest, PairingFails) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1614,9 +1614,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingFails) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(0, pairing_delegate.call_count_); @@ -1639,7 +1639,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingFails) { EXPECT_EQ(1, pairing_delegate.dismiss_count_); } -TEST_F(BluetoothExperimentalChromeOSTest, PairingFailsAtConnection) { +TEST_F(BluetoothChromeOSTest, PairingFailsAtConnection) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1659,9 +1659,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingFailsAtConnection) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(0, pairing_delegate.call_count_); @@ -1696,7 +1696,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingFailsAtConnection) { EXPECT_TRUE(properties->trusted.value()); } -TEST_F(BluetoothExperimentalChromeOSTest, PairingRejectedAtPinCode) { +TEST_F(BluetoothChromeOSTest, PairingRejectedAtPinCode) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1715,9 +1715,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingRejectedAtPinCode) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(1, pairing_delegate.call_count_); @@ -1743,7 +1743,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingRejectedAtPinCode) { EXPECT_EQ(1, pairing_delegate.dismiss_count_); } -TEST_F(BluetoothExperimentalChromeOSTest, PairingCancelledAtPinCode) { +TEST_F(BluetoothChromeOSTest, PairingCancelledAtPinCode) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1762,9 +1762,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingCancelledAtPinCode) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(1, pairing_delegate.call_count_); @@ -1790,7 +1790,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingCancelledAtPinCode) { EXPECT_EQ(1, pairing_delegate.dismiss_count_); } -TEST_F(BluetoothExperimentalChromeOSTest, PairingRejectedAtPasskey) { +TEST_F(BluetoothChromeOSTest, PairingRejectedAtPasskey) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1809,9 +1809,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingRejectedAtPasskey) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(1, pairing_delegate.call_count_); @@ -1837,7 +1837,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingRejectedAtPasskey) { EXPECT_EQ(1, pairing_delegate.dismiss_count_); } -TEST_F(BluetoothExperimentalChromeOSTest, PairingCancelledAtPasskey) { +TEST_F(BluetoothChromeOSTest, PairingCancelledAtPasskey) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1856,9 +1856,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingCancelledAtPasskey) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(1, pairing_delegate.call_count_); @@ -1884,7 +1884,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingCancelledAtPasskey) { EXPECT_EQ(1, pairing_delegate.dismiss_count_); } -TEST_F(BluetoothExperimentalChromeOSTest, PairingRejectedAtConfirmation) { +TEST_F(BluetoothChromeOSTest, PairingRejectedAtConfirmation) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1903,9 +1903,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingRejectedAtConfirmation) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(1, pairing_delegate.call_count_); @@ -1931,7 +1931,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingRejectedAtConfirmation) { EXPECT_EQ(1, pairing_delegate.dismiss_count_); } -TEST_F(BluetoothExperimentalChromeOSTest, PairingCancelledAtConfirmation) { +TEST_F(BluetoothChromeOSTest, PairingCancelledAtConfirmation) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1950,9 +1950,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingCancelledAtConfirmation) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(1, pairing_delegate.call_count_); @@ -1978,7 +1978,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingCancelledAtConfirmation) { EXPECT_EQ(1, pairing_delegate.dismiss_count_); } -TEST_F(BluetoothExperimentalChromeOSTest, PairingCancelledInFlight) { +TEST_F(BluetoothChromeOSTest, PairingCancelledInFlight) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); fake_bluetooth_device_client_->SetSimulationIntervalMs(10); @@ -1997,9 +1997,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairingCancelledInFlight) { TestPairingDelegate pairing_delegate; device->Connect( &pairing_delegate, - base::Bind(&BluetoothExperimentalChromeOSTest::Callback, + base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback, + base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, base::Unretained(this))); EXPECT_EQ(0, pairing_delegate.call_count_); diff --git a/device/bluetooth/bluetooth_device_experimental_chromeos.cc b/device/bluetooth/bluetooth_device_chromeos.cc index b6932ba..76e2097 100644 --- a/device/bluetooth/bluetooth_device_experimental_chromeos.cc +++ b/device/bluetooth/bluetooth_device_chromeos.cc @@ -1,22 +1,22 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "device/bluetooth/bluetooth_device_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_device_chromeos.h" #include "base/bind.h" #include "base/metrics/histogram.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" +#include "chromeos/dbus/bluetooth_adapter_client.h" +#include "chromeos/dbus/bluetooth_agent_manager_client.h" +#include "chromeos/dbus/bluetooth_agent_service_provider.h" +#include "chromeos/dbus/bluetooth_device_client.h" +#include "chromeos/dbus/bluetooth_input_client.h" #include "chromeos/dbus/dbus_thread_manager.h" -#include "chromeos/dbus/experimental_bluetooth_adapter_client.h" -#include "chromeos/dbus/experimental_bluetooth_agent_manager_client.h" -#include "chromeos/dbus/experimental_bluetooth_agent_service_provider.h" -#include "chromeos/dbus/experimental_bluetooth_device_client.h" -#include "chromeos/dbus/experimental_bluetooth_input_client.h" #include "dbus/bus.h" -#include "device/bluetooth/bluetooth_adapter_experimental_chromeos.h" -#include "device/bluetooth/bluetooth_profile_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_adapter_chromeos.h" +#include "device/bluetooth/bluetooth_profile_chromeos.h" #include "device/bluetooth/bluetooth_socket.h" #include "third_party/cros_system_api/dbus/service_constants.h" @@ -62,9 +62,9 @@ void ParseModalias(const dbus::ObjectPath& object_path, uint16 *vendor_id, uint16 *product_id, uint16 *device_id) { - chromeos::ExperimentalBluetoothDeviceClient::Properties* properties = - chromeos::DBusThreadManager::Get()-> - GetExperimentalBluetoothDeviceClient()->GetProperties(object_path); + chromeos::BluetoothDeviceClient::Properties* properties = + chromeos::DBusThreadManager::Get()->GetBluetoothDeviceClient()-> + GetProperties(object_path); DCHECK(properties); std::string modalias = properties->modalias.value(); @@ -127,8 +127,8 @@ void RecordPairingResult(BluetoothDevice::ConnectErrorCode error_code) { namespace chromeos { -BluetoothDeviceExperimentalChromeOS::BluetoothDeviceExperimentalChromeOS( - BluetoothAdapterExperimentalChromeOS* adapter, +BluetoothDeviceChromeOS::BluetoothDeviceChromeOS( + BluetoothAdapterChromeOS* adapter, const dbus::ObjectPath& object_path) : adapter_(adapter), object_path_(object_path), @@ -138,57 +138,57 @@ BluetoothDeviceExperimentalChromeOS::BluetoothDeviceExperimentalChromeOS( weak_ptr_factory_(this) { } -BluetoothDeviceExperimentalChromeOS::~BluetoothDeviceExperimentalChromeOS() { +BluetoothDeviceChromeOS::~BluetoothDeviceChromeOS() { } -uint32 BluetoothDeviceExperimentalChromeOS::GetBluetoothClass() const { - ExperimentalBluetoothDeviceClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> +uint32 BluetoothDeviceChromeOS::GetBluetoothClass() const { + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()-> GetProperties(object_path_); DCHECK(properties); return properties->bluetooth_class.value(); } -std::string BluetoothDeviceExperimentalChromeOS::GetDeviceName() const { - ExperimentalBluetoothDeviceClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> +std::string BluetoothDeviceChromeOS::GetDeviceName() const { + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()-> GetProperties(object_path_); DCHECK(properties); return properties->alias.value(); } -std::string BluetoothDeviceExperimentalChromeOS::GetAddress() const { - ExperimentalBluetoothDeviceClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> +std::string BluetoothDeviceChromeOS::GetAddress() const { + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()-> GetProperties(object_path_); DCHECK(properties); return properties->address.value(); } -uint16 BluetoothDeviceExperimentalChromeOS::GetVendorID() const { +uint16 BluetoothDeviceChromeOS::GetVendorID() const { uint16 vendor_id = 0; ParseModalias(object_path_, &vendor_id, NULL, NULL); return vendor_id; } -uint16 BluetoothDeviceExperimentalChromeOS::GetProductID() const { +uint16 BluetoothDeviceChromeOS::GetProductID() const { uint16 product_id = 0; ParseModalias(object_path_, NULL, &product_id, NULL); return product_id; } -uint16 BluetoothDeviceExperimentalChromeOS::GetDeviceID() const { +uint16 BluetoothDeviceChromeOS::GetDeviceID() const { uint16 device_id = 0; ParseModalias(object_path_, NULL, NULL, &device_id); return device_id; } -bool BluetoothDeviceExperimentalChromeOS::IsPaired() const { - ExperimentalBluetoothDeviceClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> +bool BluetoothDeviceChromeOS::IsPaired() const { + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()-> GetProperties(object_path_); DCHECK(properties); @@ -198,18 +198,18 @@ bool BluetoothDeviceExperimentalChromeOS::IsPaired() const { return properties->paired.value() || properties->trusted.value(); } -bool BluetoothDeviceExperimentalChromeOS::IsConnected() const { - ExperimentalBluetoothDeviceClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> +bool BluetoothDeviceChromeOS::IsConnected() const { + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()-> GetProperties(object_path_); DCHECK(properties); return properties->connected.value(); } -bool BluetoothDeviceExperimentalChromeOS::IsConnectable() const { - ExperimentalBluetoothInputClient::Properties* input_properties = - DBusThreadManager::Get()->GetExperimentalBluetoothInputClient()-> +bool BluetoothDeviceChromeOS::IsConnectable() const { + BluetoothInputClient::Properties* input_properties = + DBusThreadManager::Get()->GetBluetoothInputClient()-> GetProperties(object_path_); // GetProperties returns NULL when the device does not implement the given // interface. Non HID devices are normally connectable. @@ -219,47 +219,47 @@ bool BluetoothDeviceExperimentalChromeOS::IsConnectable() const { return input_properties->reconnect_mode.value() != "device"; } -bool BluetoothDeviceExperimentalChromeOS::IsConnecting() const { +bool BluetoothDeviceChromeOS::IsConnecting() const { return num_connecting_calls_ > 0; } -BluetoothDeviceExperimentalChromeOS::ServiceList -BluetoothDeviceExperimentalChromeOS::GetServices() const { - ExperimentalBluetoothDeviceClient::Properties* properties = - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> +BluetoothDeviceChromeOS::ServiceList BluetoothDeviceChromeOS::GetServices() + const { + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()-> GetProperties(object_path_); DCHECK(properties); return properties->uuids.value(); } -void BluetoothDeviceExperimentalChromeOS::GetServiceRecords( +void BluetoothDeviceChromeOS::GetServiceRecords( const ServiceRecordsCallback& callback, const ErrorCallback& error_callback) { // TODO(keybuk): not implemented; remove error_callback.Run(); } -void BluetoothDeviceExperimentalChromeOS::ProvidesServiceWithName( +void BluetoothDeviceChromeOS::ProvidesServiceWithName( const std::string& name, const ProvidesServiceCallback& callback) { // TODO(keybuk): not implemented; remove callback.Run(false); } -bool BluetoothDeviceExperimentalChromeOS::ExpectingPinCode() const { +bool BluetoothDeviceChromeOS::ExpectingPinCode() const { return !pincode_callback_.is_null(); } -bool BluetoothDeviceExperimentalChromeOS::ExpectingPasskey() const { +bool BluetoothDeviceChromeOS::ExpectingPasskey() const { return !passkey_callback_.is_null(); } -bool BluetoothDeviceExperimentalChromeOS::ExpectingConfirmation() const { +bool BluetoothDeviceChromeOS::ExpectingConfirmation() const { return !confirmation_callback_.is_null(); } -void BluetoothDeviceExperimentalChromeOS::Connect( +void BluetoothDeviceChromeOS::Connect( BluetoothDevice::PairingDelegate* pairing_delegate, const base::Closure& callback, const ConnectErrorCallback& error_callback) { @@ -283,29 +283,26 @@ void BluetoothDeviceExperimentalChromeOS::Connect( // The agent path is relatively meaningless since BlueZ only supports // one per application at a time. dbus::Bus* system_bus = DBusThreadManager::Get()->GetSystemBus(); - agent_.reset(ExperimentalBluetoothAgentServiceProvider::Create( + agent_.reset(BluetoothAgentServiceProvider::Create( system_bus, dbus::ObjectPath(kAgentPath), this)); DCHECK(agent_.get()); VLOG(1) << object_path_.value() << ": Registering agent for pairing"; - DBusThreadManager::Get()->GetExperimentalBluetoothAgentManagerClient()-> + DBusThreadManager::Get()->GetBluetoothAgentManagerClient()-> RegisterAgent( dbus::ObjectPath(kAgentPath), bluetooth_agent_manager::kKeyboardDisplayCapability, - base::Bind( - &BluetoothDeviceExperimentalChromeOS::OnRegisterAgent, - weak_ptr_factory_.GetWeakPtr(), - callback, - error_callback), - base::Bind( - &BluetoothDeviceExperimentalChromeOS::OnRegisterAgentError, - weak_ptr_factory_.GetWeakPtr(), - error_callback)); + base::Bind(&BluetoothDeviceChromeOS::OnRegisterAgent, + weak_ptr_factory_.GetWeakPtr(), + callback, + error_callback), + base::Bind(&BluetoothDeviceChromeOS::OnRegisterAgentError, + weak_ptr_factory_.GetWeakPtr(), + error_callback)); } } -void BluetoothDeviceExperimentalChromeOS::SetPinCode( - const std::string& pincode) { +void BluetoothDeviceChromeOS::SetPinCode(const std::string& pincode) { if (!agent_.get() || pincode_callback_.is_null()) return; @@ -313,7 +310,7 @@ void BluetoothDeviceExperimentalChromeOS::SetPinCode( pincode_callback_.Reset(); } -void BluetoothDeviceExperimentalChromeOS::SetPasskey(uint32 passkey) { +void BluetoothDeviceChromeOS::SetPasskey(uint32 passkey) { if (!agent_.get() || passkey_callback_.is_null()) return; @@ -321,7 +318,7 @@ void BluetoothDeviceExperimentalChromeOS::SetPasskey(uint32 passkey) { passkey_callback_.Reset(); } -void BluetoothDeviceExperimentalChromeOS::ConfirmPairing() { +void BluetoothDeviceChromeOS::ConfirmPairing() { if (!agent_.get() || confirmation_callback_.is_null()) return; @@ -329,21 +326,20 @@ void BluetoothDeviceExperimentalChromeOS::ConfirmPairing() { confirmation_callback_.Reset(); } -void BluetoothDeviceExperimentalChromeOS::RejectPairing() { +void BluetoothDeviceChromeOS::RejectPairing() { RunPairingCallbacks(REJECTED); } -void BluetoothDeviceExperimentalChromeOS::CancelPairing() { +void BluetoothDeviceChromeOS::CancelPairing() { // If there wasn't a callback in progress that we can reply to then we // have to send a CancelPairing() to the device instead. if (!RunPairingCallbacks(CANCELLED)) { - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> + DBusThreadManager::Get()->GetBluetoothDeviceClient()-> CancelPairing( object_path_, base::Bind(&base::DoNothing), - base::Bind( - &BluetoothDeviceExperimentalChromeOS::OnCancelPairingError, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothDeviceChromeOS::OnCancelPairingError, + weak_ptr_factory_.GetWeakPtr())); // Since there's no calback to this method, it's possible that the pairing // delegate is going to be freed before things complete. @@ -351,69 +347,64 @@ void BluetoothDeviceExperimentalChromeOS::CancelPairing() { } } -void BluetoothDeviceExperimentalChromeOS::Disconnect( - const base::Closure& callback, - const ErrorCallback& error_callback) { +void BluetoothDeviceChromeOS::Disconnect(const base::Closure& callback, + const ErrorCallback& error_callback) { VLOG(1) << object_path_.value() << ": Disconnecting"; - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> + DBusThreadManager::Get()->GetBluetoothDeviceClient()-> Disconnect( object_path_, - base::Bind( - &BluetoothDeviceExperimentalChromeOS::OnDisconnect, - weak_ptr_factory_.GetWeakPtr(), - callback), - base::Bind( - &BluetoothDeviceExperimentalChromeOS::OnDisconnectError, - weak_ptr_factory_.GetWeakPtr(), - error_callback)); + base::Bind(&BluetoothDeviceChromeOS::OnDisconnect, + weak_ptr_factory_.GetWeakPtr(), + callback), + base::Bind(&BluetoothDeviceChromeOS::OnDisconnectError, + weak_ptr_factory_.GetWeakPtr(), + error_callback)); } -void BluetoothDeviceExperimentalChromeOS::Forget( - const ErrorCallback& error_callback) { +void BluetoothDeviceChromeOS::Forget(const ErrorCallback& error_callback) { VLOG(1) << object_path_.value() << ": Removing device"; - DBusThreadManager::Get()->GetExperimentalBluetoothAdapterClient()-> + DBusThreadManager::Get()->GetBluetoothAdapterClient()-> RemoveDevice( adapter_->object_path_, object_path_, base::Bind(&base::DoNothing), - base::Bind( - &BluetoothDeviceExperimentalChromeOS::OnForgetError, - weak_ptr_factory_.GetWeakPtr(), - error_callback)); + base::Bind(&BluetoothDeviceChromeOS::OnForgetError, + weak_ptr_factory_.GetWeakPtr(), + error_callback)); } -void BluetoothDeviceExperimentalChromeOS::ConnectToService( +void BluetoothDeviceChromeOS::ConnectToService( const std::string& service_uuid, const SocketCallback& callback) { // TODO(keybuk): implement callback.Run(scoped_refptr<device::BluetoothSocket>()); } -void BluetoothDeviceExperimentalChromeOS::ConnectToProfile( +void BluetoothDeviceChromeOS::ConnectToProfile( device::BluetoothProfile* profile, const base::Closure& callback, const ErrorCallback& error_callback) { - BluetoothProfileExperimentalChromeOS* profile_chromeos = - static_cast<BluetoothProfileExperimentalChromeOS*>(profile); + BluetoothProfileChromeOS* profile_chromeos = + static_cast<BluetoothProfileChromeOS*>(profile); VLOG(1) << object_path_.value() << ": Connecting profile: " << profile_chromeos->uuid(); - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> + DBusThreadManager::Get()->GetBluetoothDeviceClient()-> ConnectProfile( object_path_, profile_chromeos->uuid(), base::Bind( - &BluetoothDeviceExperimentalChromeOS::OnConnectProfile, + &BluetoothDeviceChromeOS::OnConnectProfile, weak_ptr_factory_.GetWeakPtr(), profile, callback), base::Bind( - &BluetoothDeviceExperimentalChromeOS::OnConnectProfileError, + &BluetoothDeviceChromeOS::OnConnectProfileError, weak_ptr_factory_.GetWeakPtr(), profile, error_callback)); } -void BluetoothDeviceExperimentalChromeOS::SetOutOfBandPairingData( +void BluetoothDeviceChromeOS::SetOutOfBandPairingData( const device::BluetoothOutOfBandPairingData& data, const base::Closure& callback, const ErrorCallback& error_callback) { @@ -421,7 +412,7 @@ void BluetoothDeviceExperimentalChromeOS::SetOutOfBandPairingData( error_callback.Run(); } -void BluetoothDeviceExperimentalChromeOS::ClearOutOfBandPairingData( +void BluetoothDeviceChromeOS::ClearOutOfBandPairingData( const base::Closure& callback, const ErrorCallback& error_callback) { // TODO(keybuk): implement @@ -429,7 +420,7 @@ void BluetoothDeviceExperimentalChromeOS::ClearOutOfBandPairingData( } -void BluetoothDeviceExperimentalChromeOS::Release() { +void BluetoothDeviceChromeOS::Release() { DCHECK(agent_.get()); DCHECK(pairing_delegate_); VLOG(1) << object_path_.value() << ": Release"; @@ -441,7 +432,7 @@ void BluetoothDeviceExperimentalChromeOS::Release() { UnregisterAgent(); } -void BluetoothDeviceExperimentalChromeOS::RequestPinCode( +void BluetoothDeviceChromeOS::RequestPinCode( const dbus::ObjectPath& device_path, const PinCodeCallback& callback) { DCHECK(agent_.get()); @@ -459,7 +450,7 @@ void BluetoothDeviceExperimentalChromeOS::RequestPinCode( pairing_delegate_used_ = true; } -void BluetoothDeviceExperimentalChromeOS::DisplayPinCode( +void BluetoothDeviceChromeOS::DisplayPinCode( const dbus::ObjectPath& device_path, const std::string& pincode) { DCHECK(agent_.get()); @@ -475,7 +466,7 @@ void BluetoothDeviceExperimentalChromeOS::DisplayPinCode( pairing_delegate_used_ = true; } -void BluetoothDeviceExperimentalChromeOS::RequestPasskey( +void BluetoothDeviceChromeOS::RequestPasskey( const dbus::ObjectPath& device_path, const PasskeyCallback& callback) { DCHECK(agent_.get()); @@ -493,7 +484,7 @@ void BluetoothDeviceExperimentalChromeOS::RequestPasskey( pairing_delegate_used_ = true; } -void BluetoothDeviceExperimentalChromeOS::DisplayPasskey( +void BluetoothDeviceChromeOS::DisplayPasskey( const dbus::ObjectPath& device_path, uint32 passkey, uint16 entered) { @@ -514,7 +505,7 @@ void BluetoothDeviceExperimentalChromeOS::DisplayPasskey( pairing_delegate_used_ = true; } -void BluetoothDeviceExperimentalChromeOS::RequestConfirmation( +void BluetoothDeviceChromeOS::RequestConfirmation( const dbus::ObjectPath& device_path, uint32 passkey, const ConfirmationCallback& callback) { @@ -533,14 +524,14 @@ void BluetoothDeviceExperimentalChromeOS::RequestConfirmation( pairing_delegate_used_ = true; } -void BluetoothDeviceExperimentalChromeOS::RequestAuthorization( +void BluetoothDeviceChromeOS::RequestAuthorization( const dbus::ObjectPath& device_path, const ConfirmationCallback& callback) { // TODO(keybuk): implement callback.Run(CANCELLED); } -void BluetoothDeviceExperimentalChromeOS::AuthorizeService( +void BluetoothDeviceChromeOS::AuthorizeService( const dbus::ObjectPath& device_path, const std::string& uuid, const ConfirmationCallback& callback) { @@ -548,7 +539,7 @@ void BluetoothDeviceExperimentalChromeOS::AuthorizeService( callback.Run(CANCELLED); } -void BluetoothDeviceExperimentalChromeOS::Cancel() { +void BluetoothDeviceChromeOS::Cancel() { DCHECK(agent_.get()); VLOG(1) << object_path_.value() << ": Cancel"; @@ -556,29 +547,26 @@ void BluetoothDeviceExperimentalChromeOS::Cancel() { pairing_delegate_->DismissDisplayOrConfirm(); } -void BluetoothDeviceExperimentalChromeOS::ConnectInternal( +void BluetoothDeviceChromeOS::ConnectInternal( bool after_pairing, const base::Closure& callback, const ConnectErrorCallback& error_callback) { VLOG(1) << object_path_.value() << ": Connecting"; - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> + DBusThreadManager::Get()->GetBluetoothDeviceClient()-> Connect( object_path_, - base::Bind( - &BluetoothDeviceExperimentalChromeOS::OnConnect, - weak_ptr_factory_.GetWeakPtr(), - after_pairing, - callback), - base::Bind( - &BluetoothDeviceExperimentalChromeOS::OnConnectError, - weak_ptr_factory_.GetWeakPtr(), - after_pairing, - error_callback)); -} - -void BluetoothDeviceExperimentalChromeOS::OnConnect( - bool after_pairing, - const base::Closure& callback) { + base::Bind(&BluetoothDeviceChromeOS::OnConnect, + weak_ptr_factory_.GetWeakPtr(), + after_pairing, + callback), + base::Bind(&BluetoothDeviceChromeOS::OnConnectError, + weak_ptr_factory_.GetWeakPtr(), + after_pairing, + error_callback)); +} + +void BluetoothDeviceChromeOS::OnConnect(bool after_pairing, + const base::Closure& callback) { if (--num_connecting_calls_ == 0) adapter_->NotifyDeviceChanged(this); @@ -596,7 +584,7 @@ void BluetoothDeviceExperimentalChromeOS::OnConnect( callback.Run(); } -void BluetoothDeviceExperimentalChromeOS::OnConnectError( +void BluetoothDeviceChromeOS::OnConnectError( bool after_pairing, const ConnectErrorCallback& error_callback, const std::string& error_name, @@ -625,24 +613,22 @@ void BluetoothDeviceExperimentalChromeOS::OnConnectError( error_callback.Run(error_code); } -void BluetoothDeviceExperimentalChromeOS::OnRegisterAgent( +void BluetoothDeviceChromeOS::OnRegisterAgent( const base::Closure& callback, const ConnectErrorCallback& error_callback) { VLOG(1) << object_path_.value() << ": Agent registered, now pairing"; - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> + DBusThreadManager::Get()->GetBluetoothDeviceClient()-> Pair(object_path_, - base::Bind( - &BluetoothDeviceExperimentalChromeOS::OnPair, - weak_ptr_factory_.GetWeakPtr(), - callback, error_callback), - base::Bind( - &BluetoothDeviceExperimentalChromeOS::OnPairError, - weak_ptr_factory_.GetWeakPtr(), - error_callback)); + base::Bind(&BluetoothDeviceChromeOS::OnPair, + weak_ptr_factory_.GetWeakPtr(), + callback, error_callback), + base::Bind(&BluetoothDeviceChromeOS::OnPairError, + weak_ptr_factory_.GetWeakPtr(), + error_callback)); } -void BluetoothDeviceExperimentalChromeOS::OnRegisterAgentError( +void BluetoothDeviceChromeOS::OnRegisterAgentError( const ConnectErrorCallback& error_callback, const std::string& error_name, const std::string& error_message) { @@ -666,7 +652,7 @@ void BluetoothDeviceExperimentalChromeOS::OnRegisterAgentError( error_callback.Run(error_code); } -void BluetoothDeviceExperimentalChromeOS::OnPair( +void BluetoothDeviceChromeOS::OnPair( const base::Closure& callback, const ConnectErrorCallback& error_callback) { VLOG(1) << object_path_.value() << ": Paired"; @@ -680,7 +666,7 @@ void BluetoothDeviceExperimentalChromeOS::OnPair( ConnectInternal(true, callback, error_callback); } -void BluetoothDeviceExperimentalChromeOS::OnPairError( +void BluetoothDeviceChromeOS::OnPairError( const ConnectErrorCallback& error_callback, const std::string& error_name, const std::string& error_message) { @@ -715,32 +701,31 @@ void BluetoothDeviceExperimentalChromeOS::OnPairError( error_callback.Run(error_code); } -void BluetoothDeviceExperimentalChromeOS::OnCancelPairingError( +void BluetoothDeviceChromeOS::OnCancelPairingError( const std::string& error_name, const std::string& error_message) { LOG(WARNING) << object_path_.value() << ": Failed to cancel pairing: " << error_name << ": " << error_message; } -void BluetoothDeviceExperimentalChromeOS::SetTrusted() { +void BluetoothDeviceChromeOS::SetTrusted() { // Unconditionally send the property change, rather than checking the value // first; there's no harm in doing this and it solves any race conditions // with the property becoming true or false and this call happening before // we get the D-Bus signal about the earlier change. - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> + DBusThreadManager::Get()->GetBluetoothDeviceClient()-> GetProperties(object_path_)->trusted.Set( true, - base::Bind( - &BluetoothDeviceExperimentalChromeOS::OnSetTrusted, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothDeviceChromeOS::OnSetTrusted, + weak_ptr_factory_.GetWeakPtr())); } -void BluetoothDeviceExperimentalChromeOS::OnSetTrusted(bool success) { +void BluetoothDeviceChromeOS::OnSetTrusted(bool success) { LOG_IF(WARNING, !success) << object_path_.value() << ": Failed to set device as trusted"; } -void BluetoothDeviceExperimentalChromeOS::UnregisterAgent() { +void BluetoothDeviceChromeOS::UnregisterAgent() { if (!agent_.get()) return; @@ -757,29 +742,27 @@ void BluetoothDeviceExperimentalChromeOS::UnregisterAgent() { // Clean up after ourselves. VLOG(1) << object_path_.value() << ": Unregistering pairing agent"; - DBusThreadManager::Get()->GetExperimentalBluetoothAgentManagerClient()-> + DBusThreadManager::Get()->GetBluetoothAgentManagerClient()-> UnregisterAgent( dbus::ObjectPath(kAgentPath), base::Bind(&base::DoNothing), - base::Bind( - &BluetoothDeviceExperimentalChromeOS::OnUnregisterAgentError, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothDeviceChromeOS::OnUnregisterAgentError, + weak_ptr_factory_.GetWeakPtr())); } -void BluetoothDeviceExperimentalChromeOS::OnUnregisterAgentError( +void BluetoothDeviceChromeOS::OnUnregisterAgentError( const std::string& error_name, const std::string& error_message) { LOG(WARNING) << object_path_.value() << ": Failed to unregister agent: " << error_name << ": " << error_message; } -void BluetoothDeviceExperimentalChromeOS::OnDisconnect( - const base::Closure& callback) { +void BluetoothDeviceChromeOS::OnDisconnect(const base::Closure& callback) { VLOG(1) << object_path_.value() << ": Disconnected"; callback.Run(); } -void BluetoothDeviceExperimentalChromeOS::OnDisconnectError( +void BluetoothDeviceChromeOS::OnDisconnectError( const ErrorCallback& error_callback, const std::string& error_name, const std::string& error_message) { @@ -788,7 +771,7 @@ void BluetoothDeviceExperimentalChromeOS::OnDisconnectError( error_callback.Run(); } -void BluetoothDeviceExperimentalChromeOS::OnForgetError( +void BluetoothDeviceChromeOS::OnForgetError( const ErrorCallback& error_callback, const std::string& error_name, const std::string& error_message) { @@ -797,7 +780,7 @@ void BluetoothDeviceExperimentalChromeOS::OnForgetError( error_callback.Run(); } -bool BluetoothDeviceExperimentalChromeOS::RunPairingCallbacks(Status status) { +bool BluetoothDeviceChromeOS::RunPairingCallbacks(Status status) { if (!agent_.get()) return false; @@ -823,23 +806,23 @@ bool BluetoothDeviceExperimentalChromeOS::RunPairingCallbacks(Status status) { return callback_run; } -void BluetoothDeviceExperimentalChromeOS::OnConnectProfile( +void BluetoothDeviceChromeOS::OnConnectProfile( device::BluetoothProfile* profile, const base::Closure& callback) { - BluetoothProfileExperimentalChromeOS* profile_chromeos = - static_cast<BluetoothProfileExperimentalChromeOS*>(profile); + BluetoothProfileChromeOS* profile_chromeos = + static_cast<BluetoothProfileChromeOS*>(profile); VLOG(1) << object_path_.value() << ": Profile connected: " << profile_chromeos->uuid(); callback.Run(); } -void BluetoothDeviceExperimentalChromeOS::OnConnectProfileError( +void BluetoothDeviceChromeOS::OnConnectProfileError( device::BluetoothProfile* profile, const ErrorCallback& error_callback, const std::string& error_name, const std::string& error_message) { - BluetoothProfileExperimentalChromeOS* profile_chromeos = - static_cast<BluetoothProfileExperimentalChromeOS*>(profile); + BluetoothProfileChromeOS* profile_chromeos = + static_cast<BluetoothProfileChromeOS*>(profile); VLOG(1) << object_path_.value() << ": Profile connection failed: " << profile_chromeos->uuid() << ": " << error_name << ": " << error_message; diff --git a/device/bluetooth/bluetooth_device_experimental_chromeos.h b/device/bluetooth/bluetooth_device_chromeos.h index 18b48e9..fef7cfd 100644 --- a/device/bluetooth/bluetooth_device_experimental_chromeos.h +++ b/device/bluetooth/bluetooth_device_chromeos.h @@ -1,30 +1,28 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_EXPERIMENTAL_CHROMEOS_H -#define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_EXPERIMENTAL_CHROMEOS_H +#ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H +#define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H #include <string> #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "chromeos/dbus/experimental_bluetooth_agent_service_provider.h" -#include "chromeos/dbus/experimental_bluetooth_device_client.h" +#include "chromeos/dbus/bluetooth_agent_service_provider.h" +#include "chromeos/dbus/bluetooth_device_client.h" #include "dbus/object_path.h" #include "device/bluetooth/bluetooth_device.h" namespace chromeos { -class BluetoothAdapterExperimentalChromeOS; +class BluetoothAdapterChromeOS; -// The BluetoothDeviceExperimentalChromeOS class is an alternate implementation -// of BluetoothDevice for the Chrome OS platform using the Bluetooth Smart -// capable backend. It will become the sole implementation for Chrome OS, and -// be renamed to BluetoothDeviceChromeOS, once the backend is switched. -class BluetoothDeviceExperimentalChromeOS +// The BluetoothDeviceChromeOS class implements BluetoothDevice for the +// Chrome OS platform. +class BluetoothDeviceChromeOS : public device::BluetoothDevice, - private chromeos::ExperimentalBluetoothAgentServiceProvider::Delegate { + private chromeos::BluetoothAgentServiceProvider::Delegate { public: // BluetoothDevice override virtual uint32 GetBluetoothClass() const OVERRIDE; @@ -79,14 +77,13 @@ class BluetoothDeviceExperimentalChromeOS virtual std::string GetDeviceName() const OVERRIDE; private: - friend class BluetoothAdapterExperimentalChromeOS; + friend class BluetoothAdapterChromeOS; - BluetoothDeviceExperimentalChromeOS( - BluetoothAdapterExperimentalChromeOS* adapter, - const dbus::ObjectPath& object_path); - virtual ~BluetoothDeviceExperimentalChromeOS(); + BluetoothDeviceChromeOS(BluetoothAdapterChromeOS* adapter, + const dbus::ObjectPath& object_path); + virtual ~BluetoothDeviceChromeOS(); - // ExperimentalBluetoothAgentServiceProvider::Delegate override. + // BluetoothAgentServiceProvider::Delegate override. virtual void Release() OVERRIDE; virtual void RequestPinCode(const dbus::ObjectPath& device_path, const PinCodeCallback& callback) OVERRIDE; @@ -182,12 +179,11 @@ class BluetoothDeviceExperimentalChromeOS const std::string& error_name, const std::string& error_message); - // Return the object path of the device; used by - // BluetoothAdapterExperimentalChromeOS + // Return the object path of the device; used by BluetoothAdapterChromeOS const dbus::ObjectPath& object_path() const { return object_path_; } // The adapter that owns this device instance. - BluetoothAdapterExperimentalChromeOS* adapter_; + BluetoothAdapterChromeOS* adapter_; // The dbus object path of the device object. dbus::ObjectPath object_path_; @@ -206,7 +202,7 @@ class BluetoothDeviceExperimentalChromeOS // During pairing this is set to an instance of a D-Bus agent object // intialized with our own class as its delegate. - scoped_ptr<ExperimentalBluetoothAgentServiceProvider> agent_; + scoped_ptr<BluetoothAgentServiceProvider> agent_; // During pairing these callbacks are set to those provided by method calls // made on us by |agent_| and are called by our own method calls such as @@ -217,11 +213,11 @@ class BluetoothDeviceExperimentalChromeOS // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. - base::WeakPtrFactory<BluetoothDeviceExperimentalChromeOS> weak_ptr_factory_; + base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceExperimentalChromeOS); + DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); }; } // namespace chromeos -#endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_EXPERIMENTAL_CHROMEOS_H +#endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H diff --git a/device/bluetooth/bluetooth_profile.cc b/device/bluetooth/bluetooth_profile.cc index 6c59e5b..0d9a757 100644 --- a/device/bluetooth/bluetooth_profile.cc +++ b/device/bluetooth/bluetooth_profile.cc @@ -5,7 +5,7 @@ #include "device/bluetooth/bluetooth_profile.h" #if defined(OS_CHROMEOS) -#include "device/bluetooth/bluetooth_profile_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_profile_chromeos.h" #elif defined(OS_MACOSX) #include "base/mac/mac_util.h" #include "device/bluetooth/bluetooth_profile_mac.h" @@ -46,8 +46,8 @@ void BluetoothProfile::Register(const std::string& uuid, const Options& options, const ProfileCallback& callback) { #if defined(OS_CHROMEOS) - chromeos::BluetoothProfileExperimentalChromeOS* profile = NULL; - profile = new chromeos::BluetoothProfileExperimentalChromeOS(); + chromeos::BluetoothProfileChromeOS* profile = NULL; + profile = new chromeos::BluetoothProfileChromeOS(); profile->Init(uuid, options, callback); #elif defined(OS_MACOSX) BluetoothProfile* profile = NULL; diff --git a/device/bluetooth/bluetooth_profile_experimental_chromeos.cc b/device/bluetooth/bluetooth_profile_chromeos.cc index 57a6a43..f4b8ccc 100644 --- a/device/bluetooth/bluetooth_profile_experimental_chromeos.cc +++ b/device/bluetooth/bluetooth_profile_chromeos.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "device/bluetooth/bluetooth_profile_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_profile_chromeos.h" #include <string> @@ -17,19 +17,19 @@ #include "base/task_runner_util.h" #include "base/threading/thread_restrictions.h" #include "base/threading/worker_pool.h" +#include "chromeos/dbus/bluetooth_profile_manager_client.h" +#include "chromeos/dbus/bluetooth_profile_service_provider.h" #include "chromeos/dbus/dbus_thread_manager.h" -#include "chromeos/dbus/experimental_bluetooth_profile_manager_client.h" -#include "chromeos/dbus/experimental_bluetooth_profile_service_provider.h" #include "dbus/bus.h" #include "dbus/file_descriptor.h" #include "dbus/object_path.h" -#include "device/bluetooth/bluetooth_adapter_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_adapter_chromeos.h" #include "device/bluetooth/bluetooth_adapter_factory.h" #include "device/bluetooth/bluetooth_device.h" -#include "device/bluetooth/bluetooth_device_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_device_chromeos.h" #include "device/bluetooth/bluetooth_profile.h" #include "device/bluetooth/bluetooth_socket.h" -#include "device/bluetooth/bluetooth_socket_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_socket_chromeos.h" using device::BluetoothAdapter; using device::BluetoothAdapterFactory; @@ -53,16 +53,16 @@ scoped_ptr<dbus::FileDescriptor> CheckValidity( namespace chromeos { -BluetoothProfileExperimentalChromeOS::BluetoothProfileExperimentalChromeOS() +BluetoothProfileChromeOS::BluetoothProfileChromeOS() : weak_ptr_factory_(this) { } -BluetoothProfileExperimentalChromeOS::~BluetoothProfileExperimentalChromeOS() { +BluetoothProfileChromeOS::~BluetoothProfileChromeOS() { DCHECK(object_path_.value().empty()); DCHECK(profile_.get() == NULL); } -void BluetoothProfileExperimentalChromeOS::Init( +void BluetoothProfileChromeOS::Init( const std::string& uuid, const device::BluetoothProfile::Options& options, const ProfileCallback& callback) { @@ -76,7 +76,7 @@ void BluetoothProfileExperimentalChromeOS::Init( uuid_ = uuid; - ExperimentalBluetoothProfileManagerClient::Options bluetooth_options; + BluetoothProfileManagerClient::Options bluetooth_options; bluetooth_options.name = options.name; bluetooth_options.service = uuid; bluetooth_options.channel = options.channel; @@ -96,58 +96,53 @@ void BluetoothProfileExperimentalChromeOS::Init( uuid_path); dbus::Bus* system_bus = DBusThreadManager::Get()->GetSystemBus(); - profile_.reset(ExperimentalBluetoothProfileServiceProvider::Create( + profile_.reset(BluetoothProfileServiceProvider::Create( system_bus, object_path_, this)); DCHECK(profile_.get()); VLOG(1) << object_path_.value() << ": Register profile"; - DBusThreadManager::Get()->GetExperimentalBluetoothProfileManagerClient()-> + DBusThreadManager::Get()->GetBluetoothProfileManagerClient()-> RegisterProfile( object_path_, uuid, bluetooth_options, - base::Bind( - &BluetoothProfileExperimentalChromeOS::OnRegisterProfile, - weak_ptr_factory_.GetWeakPtr(), - callback), - base::Bind( - &BluetoothProfileExperimentalChromeOS::OnRegisterProfileError, - weak_ptr_factory_.GetWeakPtr(), - callback)); + base::Bind(&BluetoothProfileChromeOS::OnRegisterProfile, + weak_ptr_factory_.GetWeakPtr(), + callback), + base::Bind(&BluetoothProfileChromeOS::OnRegisterProfileError, + weak_ptr_factory_.GetWeakPtr(), + callback)); } -void BluetoothProfileExperimentalChromeOS::Unregister() { +void BluetoothProfileChromeOS::Unregister() { DCHECK(!object_path_.value().empty()); DCHECK(profile_.get()); profile_.reset(); VLOG(1) << object_path_.value() << ": Unregister profile"; - DBusThreadManager::Get()->GetExperimentalBluetoothProfileManagerClient()-> + DBusThreadManager::Get()->GetBluetoothProfileManagerClient()-> UnregisterProfile( object_path_, - base::Bind( - &BluetoothProfileExperimentalChromeOS::OnUnregisterProfile, - weak_ptr_factory_.GetWeakPtr()), - base::Bind( - &BluetoothProfileExperimentalChromeOS::OnUnregisterProfileError, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothProfileChromeOS::OnUnregisterProfile, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&BluetoothProfileChromeOS::OnUnregisterProfileError, + weak_ptr_factory_.GetWeakPtr())); } -void BluetoothProfileExperimentalChromeOS::SetConnectionCallback( +void BluetoothProfileChromeOS::SetConnectionCallback( const ConnectionCallback& callback) { connection_callback_ = callback; } -void BluetoothProfileExperimentalChromeOS::Release() { +void BluetoothProfileChromeOS::Release() { VLOG(1) << object_path_.value() << ": Release"; } -void BluetoothProfileExperimentalChromeOS::NewConnection( +void BluetoothProfileChromeOS::NewConnection( const dbus::ObjectPath& device_path, scoped_ptr<dbus::FileDescriptor> fd, - const ExperimentalBluetoothProfileServiceProvider::Delegate::Options& - options, + const BluetoothProfileServiceProvider::Delegate::Options& options, const ConfirmationCallback& callback) { VLOG(1) << object_path_.value() << ": New connection from device: " << device_path.value();; @@ -165,31 +160,31 @@ void BluetoothProfileExperimentalChromeOS::NewConnection( base::WorkerPool::GetTaskRunner(false), FROM_HERE, base::Bind(&CheckValidity, base::Passed(&fd)), - base::Bind(&BluetoothProfileExperimentalChromeOS::GetAdapter, + base::Bind(&BluetoothProfileChromeOS::GetAdapter, weak_ptr_factory_.GetWeakPtr(), device_path, options, callback)); } -void BluetoothProfileExperimentalChromeOS::RequestDisconnection( +void BluetoothProfileChromeOS::RequestDisconnection( const dbus::ObjectPath& device_path, const ConfirmationCallback& callback) { VLOG(1) << object_path_.value() << ": Request disconnection"; callback.Run(SUCCESS); } -void BluetoothProfileExperimentalChromeOS::Cancel() { +void BluetoothProfileChromeOS::Cancel() { VLOG(1) << object_path_.value() << ": Cancel"; } -void BluetoothProfileExperimentalChromeOS::OnRegisterProfile( +void BluetoothProfileChromeOS::OnRegisterProfile( const ProfileCallback& callback) { VLOG(1) << object_path_.value() << ": Profile registered"; callback.Run(this); } -void BluetoothProfileExperimentalChromeOS::OnRegisterProfileError( +void BluetoothProfileChromeOS::OnRegisterProfileError( const ProfileCallback& callback, const std::string& error_name, const std::string& error_message) { @@ -200,13 +195,13 @@ void BluetoothProfileExperimentalChromeOS::OnRegisterProfileError( Unregister(); } -void BluetoothProfileExperimentalChromeOS::OnUnregisterProfile() { +void BluetoothProfileChromeOS::OnUnregisterProfile() { VLOG(1) << object_path_.value() << ": Profile unregistered"; object_path_ = dbus::ObjectPath(""); delete this; } -void BluetoothProfileExperimentalChromeOS::OnUnregisterProfileError( +void BluetoothProfileChromeOS::OnUnregisterProfileError( const std::string& error_name, const std::string& error_message) { LOG(WARNING) << object_path_.value() << ": Failed to unregister profile: " @@ -215,10 +210,9 @@ void BluetoothProfileExperimentalChromeOS::OnUnregisterProfileError( delete this; } -void BluetoothProfileExperimentalChromeOS::GetAdapter( +void BluetoothProfileChromeOS::GetAdapter( const dbus::ObjectPath& device_path, - const ExperimentalBluetoothProfileServiceProvider::Delegate::Options& - options, + const BluetoothProfileServiceProvider::Delegate::Options& options, const ConfirmationCallback& callback, scoped_ptr<dbus::FileDescriptor> fd) { VLOG(1) << object_path_.value() << ": Validity check complete"; @@ -228,7 +222,7 @@ void BluetoothProfileExperimentalChromeOS::GetAdapter( } BluetoothAdapterFactory::GetAdapter( - base::Bind(&BluetoothProfileExperimentalChromeOS::OnGetAdapter, + base::Bind(&BluetoothProfileChromeOS::OnGetAdapter, weak_ptr_factory_.GetWeakPtr(), device_path, options, @@ -236,9 +230,9 @@ void BluetoothProfileExperimentalChromeOS::GetAdapter( base::Passed(&fd))); } -void BluetoothProfileExperimentalChromeOS::OnGetAdapter( +void BluetoothProfileChromeOS::OnGetAdapter( const dbus::ObjectPath& device_path, - const ExperimentalBluetoothProfileServiceProvider::Delegate::Options& + const BluetoothProfileServiceProvider::Delegate::Options& options, const ConfirmationCallback& callback, scoped_ptr<dbus::FileDescriptor> fd, @@ -246,13 +240,13 @@ void BluetoothProfileExperimentalChromeOS::OnGetAdapter( VLOG(1) << object_path_.value() << ": Obtained adapter reference"; callback.Run(SUCCESS); - BluetoothDeviceExperimentalChromeOS* device = - static_cast<BluetoothAdapterExperimentalChromeOS*>(adapter.get())-> + BluetoothDeviceChromeOS* device = + static_cast<BluetoothAdapterChromeOS*>(adapter.get())-> GetDeviceWithPath(device_path); DCHECK(device); scoped_refptr<BluetoothSocket> socket(( - BluetoothSocketExperimentalChromeOS::Create(fd.get()))); + BluetoothSocketChromeOS::Create(fd.get()))); connection_callback_.Run(device, socket); } diff --git a/device/bluetooth/bluetooth_profile_experimental_chromeos.h b/device/bluetooth/bluetooth_profile_chromeos.h index 61d4c44..c13951e 100644 --- a/device/bluetooth/bluetooth_profile_experimental_chromeos.h +++ b/device/bluetooth/bluetooth_profile_chromeos.h @@ -1,9 +1,9 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_EXPERIMENTAL_CHROMEOS_H_ -#define DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_EXPERIMENTAL_CHROMEOS_H_ +#ifndef DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_CHROMEOS_H_ +#define DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_CHROMEOS_H_ #include <string> @@ -12,7 +12,7 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "chromeos/chromeos_export.h" -#include "chromeos/dbus/experimental_bluetooth_profile_service_provider.h" +#include "chromeos/dbus/bluetooth_profile_service_provider.h" #include "dbus/object_path.h" #include "device/bluetooth/bluetooth_profile.h" @@ -30,13 +30,11 @@ class BluetoothAdapter; namespace chromeos { -// The BluetoothProfileExperimentalChromeOS class implements BluetoothProfile -// for the Chrome OS platform using the Bluetooth Smart capable backend (there -// is no implementation for the older backend). It will be renamed to -// BluetoothProfileChromeOS, once the backend is the sole implementation. -class CHROMEOS_EXPORT BluetoothProfileExperimentalChromeOS +// The BluetoothProfileChromeOS class implements BluetoothProfile for the +// Chrome OS platform. +class CHROMEOS_EXPORT BluetoothProfileChromeOS : public device::BluetoothProfile, - private ExperimentalBluetoothProfileServiceProvider::Delegate { + private BluetoothProfileServiceProvider::Delegate { public: // BluetoothProfile override. virtual void Unregister() OVERRIDE; @@ -49,8 +47,8 @@ class CHROMEOS_EXPORT BluetoothProfileExperimentalChromeOS private: friend class BluetoothProfile; - BluetoothProfileExperimentalChromeOS(); - virtual ~BluetoothProfileExperimentalChromeOS(); + BluetoothProfileChromeOS(); + virtual ~BluetoothProfileChromeOS(); // Called by BluetoothProfile::Register to initialize the profile object // asynchronously. |uuid|, |options| and |callback| are the arguments to @@ -59,13 +57,12 @@ class CHROMEOS_EXPORT BluetoothProfileExperimentalChromeOS const device::BluetoothProfile::Options& options, const ProfileCallback& callback); - // ExperimentalBluetoothProfileServiceProvider::Delegate override. + // BluetoothProfileServiceProvider::Delegate override. virtual void Release() OVERRIDE; virtual void NewConnection( const dbus::ObjectPath& device_path, scoped_ptr<dbus::FileDescriptor> fd, - const ExperimentalBluetoothProfileServiceProvider::Delegate::Options& - options, + const BluetoothProfileServiceProvider::Delegate::Options& options, const ConfirmationCallback& callback) OVERRIDE; virtual void RequestDisconnection( const dbus::ObjectPath& device_path, @@ -94,14 +91,12 @@ class CHROMEOS_EXPORT BluetoothProfileExperimentalChromeOS // becomes the result of a PostTaskAndReplyWithResult() call. void GetAdapter( const dbus::ObjectPath& device_path, - const ExperimentalBluetoothProfileServiceProvider::Delegate::Options& - options, + const BluetoothProfileServiceProvider::Delegate::Options& options, const ConfirmationCallback& callback, scoped_ptr<dbus::FileDescriptor> fd); void OnGetAdapter( const dbus::ObjectPath& device_path, - const ExperimentalBluetoothProfileServiceProvider::Delegate::Options& - options, + const BluetoothProfileServiceProvider::Delegate::Options& options, const ConfirmationCallback& callback, scoped_ptr<dbus::FileDescriptor> fd, scoped_refptr<device::BluetoothAdapter>); @@ -114,7 +109,7 @@ class CHROMEOS_EXPORT BluetoothProfileExperimentalChromeOS // Local profile D-Bus object used for receiving profile delegate methods // from BlueZ. - scoped_ptr<ExperimentalBluetoothProfileServiceProvider> profile_; + scoped_ptr<BluetoothProfileServiceProvider> profile_; // Callback used on both outgoing and incoming connections to pass the // connected socket to profile object owner. @@ -122,11 +117,11 @@ class CHROMEOS_EXPORT BluetoothProfileExperimentalChromeOS // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. - base::WeakPtrFactory<BluetoothProfileExperimentalChromeOS> weak_ptr_factory_; + base::WeakPtrFactory<BluetoothProfileChromeOS> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(BluetoothProfileExperimentalChromeOS); + DISALLOW_COPY_AND_ASSIGN(BluetoothProfileChromeOS); }; } // namespace chromeos -#endif // DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_EXPERIMENTAL_CHROMEOS_H_ +#endif // DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_CHROMEOS_H_ diff --git a/device/bluetooth/bluetooth_profile_chromeos_unittest.cc b/device/bluetooth/bluetooth_profile_chromeos_unittest.cc index 140ba2d..271fe46 100644 --- a/device/bluetooth/bluetooth_profile_chromeos_unittest.cc +++ b/device/bluetooth/bluetooth_profile_chromeos_unittest.cc @@ -8,14 +8,14 @@ #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h" #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h" #include "device/bluetooth/bluetooth_adapter.h" -#include "device/bluetooth/bluetooth_adapter_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_adapter_chromeos.h" #include "device/bluetooth/bluetooth_adapter_factory.h" #include "device/bluetooth/bluetooth_device.h" -#include "device/bluetooth/bluetooth_device_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_device_chromeos.h" #include "device/bluetooth/bluetooth_profile.h" -#include "device/bluetooth/bluetooth_profile_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_profile_chromeos.h" #include "device/bluetooth/bluetooth_socket.h" -#include "device/bluetooth/bluetooth_socket_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_socket_chromeos.h" #include "net/base/io_buffer.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/device/bluetooth/bluetooth_socket_experimental_chromeos.cc b/device/bluetooth/bluetooth_socket_chromeos.cc index 21d281a..81395dc 100644 --- a/device/bluetooth/bluetooth_socket_experimental_chromeos.cc +++ b/device/bluetooth/bluetooth_socket_chromeos.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "device/bluetooth/bluetooth_socket_experimental_chromeos.h" +#include "device/bluetooth/bluetooth_socket_chromeos.h" #include <errno.h> #include <poll.h> @@ -24,8 +24,7 @@ namespace chromeos { -BluetoothSocketExperimentalChromeOS::BluetoothSocketExperimentalChromeOS( - int fd) +BluetoothSocketChromeOS::BluetoothSocketChromeOS(int fd) : fd_(fd) { // Fetch the socket type so we read from it correctly. int optval; @@ -44,12 +43,11 @@ BluetoothSocketExperimentalChromeOS::BluetoothSocketExperimentalChromeOS( } } -BluetoothSocketExperimentalChromeOS::~BluetoothSocketExperimentalChromeOS() { +BluetoothSocketChromeOS::~BluetoothSocketChromeOS() { HANDLE_EINTR(close(fd_)); } -bool BluetoothSocketExperimentalChromeOS::Receive( - net::GrowableIOBuffer *buffer) { +bool BluetoothSocketChromeOS::Receive(net::GrowableIOBuffer *buffer) { base::ThreadRestrictions::AssertIOAllowed(); if (socket_type_ == L2CAP) { @@ -127,8 +125,7 @@ bool BluetoothSocketExperimentalChromeOS::Receive( return true; } -bool BluetoothSocketExperimentalChromeOS::Send( - net::DrainableIOBuffer *buffer) { +bool BluetoothSocketChromeOS::Send(net::DrainableIOBuffer *buffer) { base::ThreadRestrictions::AssertIOAllowed(); ssize_t bytes_written; @@ -153,18 +150,18 @@ bool BluetoothSocketExperimentalChromeOS::Send( return true; } -std::string BluetoothSocketExperimentalChromeOS::GetLastErrorMessage() const { +std::string BluetoothSocketChromeOS::GetLastErrorMessage() const { return error_message_; } // static -scoped_refptr<device::BluetoothSocket> -BluetoothSocketExperimentalChromeOS::Create(dbus::FileDescriptor* fd) { +scoped_refptr<device::BluetoothSocket> BluetoothSocketChromeOS::Create( + dbus::FileDescriptor* fd) { DCHECK(fd->is_valid()); - BluetoothSocketExperimentalChromeOS* bluetooth_socket = - new BluetoothSocketExperimentalChromeOS(fd->TakeValue());; - return scoped_refptr<BluetoothSocketExperimentalChromeOS>(bluetooth_socket); + BluetoothSocketChromeOS* bluetooth_socket = + new BluetoothSocketChromeOS(fd->TakeValue());; + return scoped_refptr<BluetoothSocketChromeOS>(bluetooth_socket); } } // namespace chromeos diff --git a/device/bluetooth/bluetooth_socket_experimental_chromeos.h b/device/bluetooth/bluetooth_socket_chromeos.h index c0e1af0..1c52c67 100644 --- a/device/bluetooth/bluetooth_socket_experimental_chromeos.h +++ b/device/bluetooth/bluetooth_socket_chromeos.h @@ -1,9 +1,9 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_EXPERIMENTAL_CHROMEOS_H_ -#define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_EXPERIMENTAL_CHROMEOS_H_ +#ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ +#define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ #include <string> @@ -27,11 +27,9 @@ class GrowableIOBuffer; namespace chromeos { -// The BluetoothSocketExperimentalChromeOS class is an alternate implementation -// of BluetoothSocket for the Chrome OS platform using the Bluetooth Smart -// capable backend. It will become the sole implementation for Chrome OS, and -// be renamed to BluetoothSocketChromeOS, once the backend is switched. -class CHROMEOS_EXPORT BluetoothSocketExperimentalChromeOS +// The BluetoothSocketChromeOS class implements BluetoothSocket for the +// Chrome OS platform. +class CHROMEOS_EXPORT BluetoothSocketChromeOS : public device::BluetoothSocket { public: // BluetoothSocket override. @@ -46,10 +44,10 @@ class CHROMEOS_EXPORT BluetoothSocketExperimentalChromeOS dbus::FileDescriptor* fd); protected: - virtual ~BluetoothSocketExperimentalChromeOS(); + virtual ~BluetoothSocketChromeOS(); private: - BluetoothSocketExperimentalChromeOS(int fd); + BluetoothSocketChromeOS(int fd); // The different socket types have different reading patterns; l2cap sockets // have to be read with boundaries between datagrams preserved while rfcomm @@ -67,9 +65,9 @@ class CHROMEOS_EXPORT BluetoothSocketExperimentalChromeOS // GetLastErrorMessage(). std::string error_message_; - DISALLOW_COPY_AND_ASSIGN(BluetoothSocketExperimentalChromeOS); + DISALLOW_COPY_AND_ASSIGN(BluetoothSocketChromeOS); }; } // namespace chromeos -#endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_EXPERIMENTAL_CHROMEOS_H_ +#endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ diff --git a/device/device.gyp b/device/device.gyp index a7c520b..bdc387c 100644 --- a/device/device.gyp +++ b/device/device.gyp @@ -22,7 +22,7 @@ 'bluetooth/bluetooth_adapter_mac_unittest.mm', 'bluetooth/bluetooth_adapter_win_unittest.cc', 'bluetooth/bluetooth_device_win_unittest.cc', - 'bluetooth/bluetooth_experimental_chromeos_unittest.cc', + 'bluetooth/bluetooth_chromeos_unittest.cc', 'bluetooth/bluetooth_profile_chromeos_unittest.cc', 'bluetooth/bluetooth_service_record_mac_unittest.mm', 'bluetooth/bluetooth_service_record_win_unittest.cc', |