diff options
-rw-r--r-- | chromeos/chromeos.gyp | 28 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_adapter_client.cc (renamed from chromeos/dbus/experimental_bluetooth_adapter_client.cc) | 78 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_adapter_client.h (renamed from chromeos/dbus/experimental_bluetooth_adapter_client.h) | 25 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_agent_manager_client.cc (renamed from chromeos/dbus/experimental_bluetooth_agent_manager_client.cc) | 54 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_agent_manager_client.h (renamed from chromeos/dbus/experimental_bluetooth_agent_manager_client.h) | 25 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_agent_service_provider.cc (renamed from chromeos/dbus/experimental_bluetooth_agent_service_provider.cc) | 143 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_agent_service_provider.h (renamed from chromeos/dbus/experimental_bluetooth_agent_service_provider.h) | 37 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_device_client.cc (renamed from chromeos/dbus/experimental_bluetooth_device_client.cc) | 98 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_device_client.h (renamed from chromeos/dbus/experimental_bluetooth_device_client.h) | 25 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_input_client.cc (renamed from chromeos/dbus/experimental_bluetooth_input_client.cc) | 54 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_input_client.h (renamed from chromeos/dbus/experimental_bluetooth_input_client.h) | 25 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_profile_manager_client.cc (renamed from chromeos/dbus/experimental_bluetooth_profile_manager_client.cc) | 53 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_profile_manager_client.h (renamed from chromeos/dbus/experimental_bluetooth_profile_manager_client.h) | 22 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_profile_service_provider.cc (renamed from chromeos/dbus/experimental_bluetooth_profile_service_provider.cc) | 87 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_profile_service_provider.h (renamed from chromeos/dbus/experimental_bluetooth_profile_service_provider.h) | 37 | ||||
-rw-r--r-- | chromeos/dbus/dbus_thread_manager.cc | 94 | ||||
-rw-r--r-- | chromeos/dbus/dbus_thread_manager.h | 25 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_adapter_client.cc | 18 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_adapter_client.h | 8 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_agent_manager_client.h | 6 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_agent_service_provider.cc | 6 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_agent_service_provider.h | 4 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_device_client.cc | 104 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_device_client.h | 22 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_input_client.cc | 8 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_input_client.h | 8 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_profile_manager_client.h | 6 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_profile_service_provider.cc | 6 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_profile_service_provider.h | 4 | ||||
-rw-r--r-- | chromeos/dbus/mock_dbus_thread_manager.cc | 10 | ||||
-rw-r--r-- | chromeos/dbus/mock_dbus_thread_manager.h | 17 | ||||
-rw-r--r-- | chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc | 50 | ||||
-rw-r--r-- | chromeos/dbus/mock_dbus_thread_manager_without_gmock.h | 18 | ||||
-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 |
47 files changed, 1077 insertions, 1236 deletions
diff --git a/chromeos/chromeos.gyp b/chromeos/chromeos.gyp index 6270b34..eb3d36a 100644 --- a/chromeos/chromeos.gyp +++ b/chromeos/chromeos.gyp @@ -62,6 +62,20 @@ 'dbus/audio_node.h', 'dbus/blocking_method_caller.cc', 'dbus/blocking_method_caller.h', + 'dbus/bluetooth_adapter_client.cc', + 'dbus/bluetooth_adapter_client.h', + 'dbus/bluetooth_agent_manager_client.cc', + 'dbus/bluetooth_agent_manager_client.h', + 'dbus/bluetooth_agent_service_provider.cc', + 'dbus/bluetooth_agent_service_provider.h', + 'dbus/bluetooth_device_client.cc', + 'dbus/bluetooth_device_client.h', + 'dbus/bluetooth_input_client.cc', + 'dbus/bluetooth_input_client.h', + 'dbus/bluetooth_profile_manager_client.cc', + 'dbus/bluetooth_profile_manager_client.h', + 'dbus/bluetooth_profile_service_provider.cc', + 'dbus/bluetooth_profile_service_provider.h', 'dbus/cras_audio_client.cc', 'dbus/cras_audio_client.h', 'dbus/cros_disks_client.cc', @@ -74,20 +88,6 @@ 'dbus/dbus_thread_manager.h', 'dbus/debug_daemon_client.cc', 'dbus/debug_daemon_client.h', - 'dbus/experimental_bluetooth_adapter_client.cc', - 'dbus/experimental_bluetooth_adapter_client.h', - 'dbus/experimental_bluetooth_agent_manager_client.cc', - 'dbus/experimental_bluetooth_agent_manager_client.h', - 'dbus/experimental_bluetooth_agent_service_provider.cc', - 'dbus/experimental_bluetooth_agent_service_provider.h', - 'dbus/experimental_bluetooth_device_client.cc', - 'dbus/experimental_bluetooth_device_client.h', - 'dbus/experimental_bluetooth_input_client.cc', - 'dbus/experimental_bluetooth_input_client.h', - 'dbus/experimental_bluetooth_profile_manager_client.cc', - 'dbus/experimental_bluetooth_profile_manager_client.h', - 'dbus/experimental_bluetooth_profile_service_provider.cc', - 'dbus/experimental_bluetooth_profile_service_provider.h', 'dbus/fake_bluetooth_adapter_client.cc', 'dbus/fake_bluetooth_adapter_client.h', 'dbus/fake_bluetooth_agent_manager_client.cc', diff --git a/chromeos/dbus/experimental_bluetooth_adapter_client.cc b/chromeos/dbus/bluetooth_adapter_client.cc index 9c6ac50..c822e3a 100644 --- a/chromeos/dbus/experimental_bluetooth_adapter_client.cc +++ b/chromeos/dbus/bluetooth_adapter_client.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 "chromeos/dbus/experimental_bluetooth_adapter_client.h" +#include "chromeos/dbus/bluetooth_adapter_client.h" #include "base/bind.h" #include "base/logging.h" @@ -16,12 +16,12 @@ namespace chromeos { -const char ExperimentalBluetoothAdapterClient::kNoResponseError[] = +const char BluetoothAdapterClient::kNoResponseError[] = "org.chromium.Error.NoResponse"; -const char ExperimentalBluetoothAdapterClient::kUnknownAdapterError[] = +const char BluetoothAdapterClient::kUnknownAdapterError[] = "org.chromium.Error.UnknownAdapter"; -ExperimentalBluetoothAdapterClient::Properties::Properties( +BluetoothAdapterClient::Properties::Properties( dbus::ObjectProxy* object_proxy, const std::string& interface_name, const PropertyChangedCallback& callback) @@ -42,16 +42,16 @@ ExperimentalBluetoothAdapterClient::Properties::Properties( RegisterProperty(bluetooth_adapter::kModaliasProperty, &modalias); } -ExperimentalBluetoothAdapterClient::Properties::~Properties() { +BluetoothAdapterClient::Properties::~Properties() { } -// The ExperimentalBluetoothAdapterClient implementation used in production. -class ExperimentalBluetoothAdapterClientImpl - : public ExperimentalBluetoothAdapterClient, +// The BluetoothAdapterClient implementation used in production. +class BluetoothAdapterClientImpl + : public BluetoothAdapterClient, public dbus::ObjectManager::Interface { public: - explicit ExperimentalBluetoothAdapterClientImpl(dbus::Bus* bus) + explicit BluetoothAdapterClientImpl(dbus::Bus* bus) : bus_(bus), weak_ptr_factory_(this) { object_manager_ = bus_->GetObjectManager( @@ -62,21 +62,21 @@ class ExperimentalBluetoothAdapterClientImpl bluetooth_adapter::kBluetoothAdapterInterface, this); } - virtual ~ExperimentalBluetoothAdapterClientImpl() { + virtual ~BluetoothAdapterClientImpl() { object_manager_->UnregisterInterface( bluetooth_adapter::kBluetoothAdapterInterface); } - // ExperimentalBluetoothAdapterClient override. - virtual void AddObserver( - ExperimentalBluetoothAdapterClient::Observer* observer) OVERRIDE { + // BluetoothAdapterClient override. + virtual void AddObserver(BluetoothAdapterClient::Observer* observer) + OVERRIDE { DCHECK(observer); observers_.AddObserver(observer); } - // ExperimentalBluetoothAdapterClient override. - virtual void RemoveObserver( - ExperimentalBluetoothAdapterClient::Observer* observer) OVERRIDE { + // BluetoothAdapterClient override. + virtual void RemoveObserver(BluetoothAdapterClient::Observer* observer) + OVERRIDE { DCHECK(observer); observers_.RemoveObserver(observer); } @@ -95,13 +95,13 @@ class ExperimentalBluetoothAdapterClientImpl Properties* properties = new Properties( object_proxy, interface_name, - base::Bind(&ExperimentalBluetoothAdapterClientImpl::OnPropertyChanged, + base::Bind(&BluetoothAdapterClientImpl::OnPropertyChanged, weak_ptr_factory_.GetWeakPtr(), object_path)); return static_cast<dbus::PropertySet*>(properties); } - // ExperimentalBluetoothAdapterClient override. + // BluetoothAdapterClient override. virtual Properties* GetProperties(const dbus::ObjectPath& object_path) OVERRIDE { return static_cast<Properties*>( @@ -110,7 +110,7 @@ class ExperimentalBluetoothAdapterClientImpl bluetooth_adapter::kBluetoothAdapterInterface)); } - // ExperimentalBluetoothAdapterClient override. + // BluetoothAdapterClient override. virtual void StartDiscovery(const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback) OVERRIDE { @@ -128,13 +128,13 @@ class ExperimentalBluetoothAdapterClientImpl object_proxy->CallMethodWithErrorCallback( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, - base::Bind(&ExperimentalBluetoothAdapterClientImpl::OnSuccess, + base::Bind(&BluetoothAdapterClientImpl::OnSuccess, weak_ptr_factory_.GetWeakPtr(), callback), - base::Bind(&ExperimentalBluetoothAdapterClientImpl::OnError, + base::Bind(&BluetoothAdapterClientImpl::OnError, weak_ptr_factory_.GetWeakPtr(), error_callback)); } - // ExperimentalBluetoothAdapterClient override. + // BluetoothAdapterClient override. virtual void StopDiscovery(const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback) OVERRIDE { @@ -152,13 +152,13 @@ class ExperimentalBluetoothAdapterClientImpl object_proxy->CallMethodWithErrorCallback( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, - base::Bind(&ExperimentalBluetoothAdapterClientImpl::OnSuccess, + base::Bind(&BluetoothAdapterClientImpl::OnSuccess, weak_ptr_factory_.GetWeakPtr(), callback), - base::Bind(&ExperimentalBluetoothAdapterClientImpl::OnError, + base::Bind(&BluetoothAdapterClientImpl::OnError, weak_ptr_factory_.GetWeakPtr(), error_callback)); } - // ExperimentalBluetoothAdapterClient override. + // BluetoothAdapterClient override. virtual void RemoveDevice(const dbus::ObjectPath& object_path, const dbus::ObjectPath& device_path, const base::Closure& callback, @@ -180,9 +180,9 @@ class ExperimentalBluetoothAdapterClientImpl object_proxy->CallMethodWithErrorCallback( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, - base::Bind(&ExperimentalBluetoothAdapterClientImpl::OnSuccess, + base::Bind(&BluetoothAdapterClientImpl::OnSuccess, weak_ptr_factory_.GetWeakPtr(), callback), - base::Bind(&ExperimentalBluetoothAdapterClientImpl::OnError, + base::Bind(&BluetoothAdapterClientImpl::OnError, weak_ptr_factory_.GetWeakPtr(), error_callback)); } @@ -191,8 +191,7 @@ class ExperimentalBluetoothAdapterClientImpl // is created. Informs observers. virtual void ObjectAdded(const dbus::ObjectPath& object_path, const std::string& interface_name) OVERRIDE { - FOR_EACH_OBSERVER(ExperimentalBluetoothAdapterClient::Observer, - observers_, + FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, AdapterAdded(object_path)); } @@ -200,8 +199,7 @@ class ExperimentalBluetoothAdapterClientImpl // is removed. Informs observers. virtual void ObjectRemoved(const dbus::ObjectPath& object_path, const std::string& interface_name) OVERRIDE { - FOR_EACH_OBSERVER(ExperimentalBluetoothAdapterClient::Observer, - observers_, + FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, AdapterRemoved(object_path)); } @@ -210,7 +208,7 @@ class ExperimentalBluetoothAdapterClientImpl // call. Informs observers. void OnPropertyChanged(const dbus::ObjectPath& object_path, const std::string& property_name) { - FOR_EACH_OBSERVER(ExperimentalBluetoothAdapterClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, AdapterPropertyChanged(object_path, property_name)); } @@ -242,29 +240,29 @@ class ExperimentalBluetoothAdapterClientImpl dbus::ObjectManager* object_manager_; // List of observers interested in event notifications from us. - ObserverList<ExperimentalBluetoothAdapterClient::Observer> observers_; + ObserverList<BluetoothAdapterClient::Observer> observers_; // Weak pointer factory for generating 'this' pointers that might live longer // than we do. // 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<ExperimentalBluetoothAdapterClientImpl> + base::WeakPtrFactory<BluetoothAdapterClientImpl> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothAdapterClientImpl); + DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterClientImpl); }; -ExperimentalBluetoothAdapterClient::ExperimentalBluetoothAdapterClient() { +BluetoothAdapterClient::BluetoothAdapterClient() { } -ExperimentalBluetoothAdapterClient::~ExperimentalBluetoothAdapterClient() { +BluetoothAdapterClient::~BluetoothAdapterClient() { } -ExperimentalBluetoothAdapterClient* ExperimentalBluetoothAdapterClient::Create( +BluetoothAdapterClient* BluetoothAdapterClient::Create( DBusClientImplementationType type, dbus::Bus* bus) { if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new ExperimentalBluetoothAdapterClientImpl(bus); + return new BluetoothAdapterClientImpl(bus); DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); return new FakeBluetoothAdapterClient(); } diff --git a/chromeos/dbus/experimental_bluetooth_adapter_client.h b/chromeos/dbus/bluetooth_adapter_client.h index 19c1382..60eaff8 100644 --- a/chromeos/dbus/experimental_bluetooth_adapter_client.h +++ b/chromeos/dbus/bluetooth_adapter_client.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 CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_ADAPTER_CLIENT_H_ -#define CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_ADAPTER_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ +#define CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ #include <string> #include <vector> @@ -22,9 +22,9 @@ class Bus; namespace chromeos { -// ExperimentalBluetoothAdapterClient is used to communicate with Bluetooth -// Adapter objects. -class CHROMEOS_EXPORT ExperimentalBluetoothAdapterClient { +// BluetoothAdapterClient is used to communicate with objects representing +// local Bluetooth Adapters. +class CHROMEOS_EXPORT BluetoothAdapterClient { public: // Structure of properties associated with bluetooth adapters. struct Properties : public dbus::PropertySet { @@ -101,7 +101,7 @@ class CHROMEOS_EXPORT ExperimentalBluetoothAdapterClient { const std::string& property_name) {} }; - virtual ~ExperimentalBluetoothAdapterClient(); + virtual ~BluetoothAdapterClient(); // Adds and removes observers for events on all local bluetooth // adapters. Check the |object_path| parameter of observer methods to @@ -142,21 +142,20 @@ class CHROMEOS_EXPORT ExperimentalBluetoothAdapterClient { const ErrorCallback& error_callback) = 0; // Creates the instance. - static ExperimentalBluetoothAdapterClient* Create( - DBusClientImplementationType type, - dbus::Bus* bus); + static BluetoothAdapterClient* Create(DBusClientImplementationType type, + dbus::Bus* bus); // Constants used to indicate exceptional error conditions. static const char kNoResponseError[]; static const char kUnknownAdapterError[]; protected: - ExperimentalBluetoothAdapterClient(); + BluetoothAdapterClient(); private: - DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothAdapterClient); + DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterClient); }; } // namespace chromeos -#endif // CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_ADAPTER_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ diff --git a/chromeos/dbus/experimental_bluetooth_agent_manager_client.cc b/chromeos/dbus/bluetooth_agent_manager_client.cc index 177bc31..7f96406 100644 --- a/chromeos/dbus/experimental_bluetooth_agent_manager_client.cc +++ b/chromeos/dbus/bluetooth_agent_manager_client.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 "chromeos/dbus/experimental_bluetooth_agent_manager_client.h" +#include "chromeos/dbus/bluetooth_agent_manager_client.h" #include "base/bind.h" #include "base/logging.h" @@ -15,15 +15,14 @@ namespace chromeos { -const char ExperimentalBluetoothAgentManagerClient::kNoResponseError[] = +const char BluetoothAgentManagerClient::kNoResponseError[] = "org.chromium.Error.NoResponse"; -// The ExperimentalBluetoothAgentManagerClient implementation used in -// production. -class ExperimentalBluetoothAgentManagerClientImpl - : public ExperimentalBluetoothAgentManagerClient { +// The BluetoothAgentManagerClient implementation used in production. +class BluetoothAgentManagerClientImpl + : public BluetoothAgentManagerClient { public: - explicit ExperimentalBluetoothAgentManagerClientImpl(dbus::Bus* bus) + explicit BluetoothAgentManagerClientImpl(dbus::Bus* bus) : bus_(bus), weak_ptr_factory_(this) { DCHECK(bus_); @@ -33,10 +32,10 @@ class ExperimentalBluetoothAgentManagerClientImpl bluetooth_agent_manager::kBluetoothAgentManagerServicePath)); } - virtual ~ExperimentalBluetoothAgentManagerClientImpl() { + virtual ~BluetoothAgentManagerClientImpl() { } - // ExperimentalBluetoothAgentManagerClient override. + // BluetoothAgentManagerClient override. virtual void RegisterAgent(const dbus::ObjectPath& agent_path, const std::string& capability, const base::Closure& callback, @@ -52,13 +51,13 @@ class ExperimentalBluetoothAgentManagerClientImpl object_proxy_->CallMethodWithErrorCallback( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, - base::Bind(&ExperimentalBluetoothAgentManagerClientImpl::OnSuccess, + base::Bind(&BluetoothAgentManagerClientImpl::OnSuccess, weak_ptr_factory_.GetWeakPtr(), callback), - base::Bind(&ExperimentalBluetoothAgentManagerClientImpl::OnError, + base::Bind(&BluetoothAgentManagerClientImpl::OnError, weak_ptr_factory_.GetWeakPtr(), error_callback)); } - // ExperimentalBluetoothAgentManagerClient override. + // BluetoothAgentManagerClient override. virtual void UnregisterAgent(const dbus::ObjectPath& agent_path, const base::Closure& callback, const ErrorCallback& error_callback) OVERRIDE { @@ -72,14 +71,14 @@ class ExperimentalBluetoothAgentManagerClientImpl object_proxy_->CallMethodWithErrorCallback( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, - base::Bind(&ExperimentalBluetoothAgentManagerClientImpl::OnSuccess, + base::Bind(&BluetoothAgentManagerClientImpl::OnSuccess, weak_ptr_factory_.GetWeakPtr(), callback), - base::Bind(&ExperimentalBluetoothAgentManagerClientImpl::OnError, + base::Bind(&BluetoothAgentManagerClientImpl::OnError, weak_ptr_factory_.GetWeakPtr(), error_callback)); } - // ExperimentalBluetoothAgentManagerClient override. + // BluetoothAgentManagerClient override. virtual void RequestDefaultAgent(const dbus::ObjectPath& agent_path, const base::Closure& callback, const ErrorCallback& error_callback) @@ -94,9 +93,9 @@ class ExperimentalBluetoothAgentManagerClientImpl object_proxy_->CallMethodWithErrorCallback( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, - base::Bind(&ExperimentalBluetoothAgentManagerClientImpl::OnSuccess, + base::Bind(&BluetoothAgentManagerClientImpl::OnSuccess, weak_ptr_factory_.GetWeakPtr(), callback), - base::Bind(&ExperimentalBluetoothAgentManagerClientImpl::OnError, + base::Bind(&BluetoothAgentManagerClientImpl::OnError, weak_ptr_factory_.GetWeakPtr(), error_callback)); } @@ -132,26 +131,23 @@ class ExperimentalBluetoothAgentManagerClientImpl // than we do. // 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<ExperimentalBluetoothAgentManagerClientImpl> + base::WeakPtrFactory<BluetoothAgentManagerClientImpl> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothAgentManagerClientImpl); + DISALLOW_COPY_AND_ASSIGN(BluetoothAgentManagerClientImpl); }; -ExperimentalBluetoothAgentManagerClient:: - ExperimentalBluetoothAgentManagerClient() { +BluetoothAgentManagerClient::BluetoothAgentManagerClient() { } -ExperimentalBluetoothAgentManagerClient:: - ~ExperimentalBluetoothAgentManagerClient() { +BluetoothAgentManagerClient::~BluetoothAgentManagerClient() { } -ExperimentalBluetoothAgentManagerClient* - ExperimentalBluetoothAgentManagerClient::Create( - DBusClientImplementationType type, - dbus::Bus* bus) { +BluetoothAgentManagerClient* BluetoothAgentManagerClient::Create( + DBusClientImplementationType type, + dbus::Bus* bus) { if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new ExperimentalBluetoothAgentManagerClientImpl(bus); + return new BluetoothAgentManagerClientImpl(bus); DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); return new FakeBluetoothAgentManagerClient(); } diff --git a/chromeos/dbus/experimental_bluetooth_agent_manager_client.h b/chromeos/dbus/bluetooth_agent_manager_client.h index bf71959..acf0465 100644 --- a/chromeos/dbus/experimental_bluetooth_agent_manager_client.h +++ b/chromeos/dbus/bluetooth_agent_manager_client.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 CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_AGENT_MANAGER_CLIENT_H_ -#define CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_AGENT_MANAGER_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_ +#define CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_ #include <string> #include <vector> @@ -20,11 +20,11 @@ class Bus; namespace chromeos { -// ExperimentalBluetoothAgentManagerClient is used to communicate with the -// agent manager component of the Bluetooth daemon. -class CHROMEOS_EXPORT ExperimentalBluetoothAgentManagerClient { +// BluetoothAgentManagerClient is used to communicate with the agent manager +// object of the Bluetooth daemon. +class CHROMEOS_EXPORT BluetoothAgentManagerClient { public: - virtual ~ExperimentalBluetoothAgentManagerClient(); + virtual ~BluetoothAgentManagerClient(); // The ErrorCallback is used by agent manager methods to indicate failure. // It receives two arguments: the name of the error in |error_name| and @@ -55,20 +55,19 @@ class CHROMEOS_EXPORT ExperimentalBluetoothAgentManagerClient { const ErrorCallback& error_callback) = 0; // Creates the instance. - static ExperimentalBluetoothAgentManagerClient* Create( - DBusClientImplementationType type, - dbus::Bus* bus); + static BluetoothAgentManagerClient* Create(DBusClientImplementationType type, + dbus::Bus* bus); // Constants used to indicate exceptional error conditions. static const char kNoResponseError[]; protected: - ExperimentalBluetoothAgentManagerClient(); + BluetoothAgentManagerClient(); private: - DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothAgentManagerClient); + DISALLOW_COPY_AND_ASSIGN(BluetoothAgentManagerClient); }; } // namespace chromeos -#endif // CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_AGENT_MANAGER_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_ diff --git a/chromeos/dbus/experimental_bluetooth_agent_service_provider.cc b/chromeos/dbus/bluetooth_agent_service_provider.cc index 7ee4580..ece8096 100644 --- a/chromeos/dbus/experimental_bluetooth_agent_service_provider.cc +++ b/chromeos/dbus/bluetooth_agent_service_provider.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 "chromeos/dbus/experimental_bluetooth_agent_service_provider.h" +#include "chromeos/dbus/bluetooth_agent_service_provider.h" #include <string> @@ -20,15 +20,13 @@ namespace chromeos { -// The ExperimentalBluetoothAgentServiceProvider implementation used in -// production. -class ExperimentalBluetoothAgentServiceProviderImpl - : public ExperimentalBluetoothAgentServiceProvider { +// The BluetoothAgentServiceProvider implementation used in production. +class BluetoothAgentServiceProviderImpl + : public BluetoothAgentServiceProvider { public: - ExperimentalBluetoothAgentServiceProviderImpl( - dbus::Bus* bus, - const dbus::ObjectPath& object_path, - Delegate* delegate) + BluetoothAgentServiceProviderImpl(dbus::Bus* bus, + const dbus::ObjectPath& object_path, + Delegate* delegate) : origin_thread_id_(base::PlatformThread::CurrentId()), bus_(bus), delegate_(delegate), @@ -41,95 +39,77 @@ class ExperimentalBluetoothAgentServiceProviderImpl exported_object_->ExportMethod( bluetooth_agent::kBluetoothAgentInterface, bluetooth_agent::kRelease, - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::Release, - weak_ptr_factory_.GetWeakPtr()), - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::OnExported, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothAgentServiceProviderImpl::Release, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&BluetoothAgentServiceProviderImpl::OnExported, + weak_ptr_factory_.GetWeakPtr())); exported_object_->ExportMethod( bluetooth_agent::kBluetoothAgentInterface, bluetooth_agent::kRequestPinCode, - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::RequestPinCode, - weak_ptr_factory_.GetWeakPtr()), - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::OnExported, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothAgentServiceProviderImpl::RequestPinCode, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&BluetoothAgentServiceProviderImpl::OnExported, + weak_ptr_factory_.GetWeakPtr())); exported_object_->ExportMethod( bluetooth_agent::kBluetoothAgentInterface, bluetooth_agent::kDisplayPinCode, - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::DisplayPinCode, - weak_ptr_factory_.GetWeakPtr()), - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::OnExported, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothAgentServiceProviderImpl::DisplayPinCode, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&BluetoothAgentServiceProviderImpl::OnExported, + weak_ptr_factory_.GetWeakPtr())); exported_object_->ExportMethod( bluetooth_agent::kBluetoothAgentInterface, bluetooth_agent::kRequestPasskey, - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::RequestPasskey, - weak_ptr_factory_.GetWeakPtr()), - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::OnExported, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothAgentServiceProviderImpl::RequestPasskey, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&BluetoothAgentServiceProviderImpl::OnExported, + weak_ptr_factory_.GetWeakPtr())); exported_object_->ExportMethod( bluetooth_agent::kBluetoothAgentInterface, bluetooth_agent::kDisplayPasskey, - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::DisplayPasskey, - weak_ptr_factory_.GetWeakPtr()), - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::OnExported, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothAgentServiceProviderImpl::DisplayPasskey, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&BluetoothAgentServiceProviderImpl::OnExported, + weak_ptr_factory_.GetWeakPtr())); exported_object_->ExportMethod( bluetooth_agent::kBluetoothAgentInterface, bluetooth_agent::kRequestConfirmation, - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::RequestConfirmation, - weak_ptr_factory_.GetWeakPtr()), - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::OnExported, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothAgentServiceProviderImpl::RequestConfirmation, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&BluetoothAgentServiceProviderImpl::OnExported, + weak_ptr_factory_.GetWeakPtr())); exported_object_->ExportMethod( bluetooth_agent::kBluetoothAgentInterface, bluetooth_agent::kRequestAuthorization, - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::RequestAuthorization, - weak_ptr_factory_.GetWeakPtr()), - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::OnExported, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothAgentServiceProviderImpl::RequestAuthorization, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&BluetoothAgentServiceProviderImpl::OnExported, + weak_ptr_factory_.GetWeakPtr())); exported_object_->ExportMethod( bluetooth_agent::kBluetoothAgentInterface, bluetooth_agent::kAuthorizeService, - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::AuthorizeService, - weak_ptr_factory_.GetWeakPtr()), - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::OnExported, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothAgentServiceProviderImpl::AuthorizeService, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&BluetoothAgentServiceProviderImpl::OnExported, + weak_ptr_factory_.GetWeakPtr())); exported_object_->ExportMethod( bluetooth_agent::kBluetoothAgentInterface, bluetooth_agent::kCancel, - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::Cancel, - weak_ptr_factory_.GetWeakPtr()), - base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::OnExported, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothAgentServiceProviderImpl::Cancel, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&BluetoothAgentServiceProviderImpl::OnExported, + weak_ptr_factory_.GetWeakPtr())); } - virtual ~ExperimentalBluetoothAgentServiceProviderImpl() { + virtual ~BluetoothAgentServiceProviderImpl() { VLOG(1) << "Cleaning up Bluetooth Agent: " << object_path_.value(); // Unregister the object path so we can reuse with a new agent. @@ -170,7 +150,7 @@ class ExperimentalBluetoothAgentServiceProviderImpl } Delegate::PinCodeCallback callback = base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::OnPinCode, + &BluetoothAgentServiceProviderImpl::OnPinCode, weak_ptr_factory_.GetWeakPtr(), method_call, response_sender); @@ -217,7 +197,7 @@ class ExperimentalBluetoothAgentServiceProviderImpl } Delegate::PasskeyCallback callback = base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::OnPasskey, + &BluetoothAgentServiceProviderImpl::OnPasskey, weak_ptr_factory_.GetWeakPtr(), method_call, response_sender); @@ -270,7 +250,7 @@ class ExperimentalBluetoothAgentServiceProviderImpl } Delegate::ConfirmationCallback callback = base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::OnConfirmation, + &BluetoothAgentServiceProviderImpl::OnConfirmation, weak_ptr_factory_.GetWeakPtr(), method_call, response_sender); @@ -295,7 +275,7 @@ class ExperimentalBluetoothAgentServiceProviderImpl } Delegate::ConfirmationCallback callback = base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::OnConfirmation, + &BluetoothAgentServiceProviderImpl::OnConfirmation, weak_ptr_factory_.GetWeakPtr(), method_call, response_sender); @@ -322,7 +302,7 @@ class ExperimentalBluetoothAgentServiceProviderImpl } Delegate::ConfirmationCallback callback = base::Bind( - &ExperimentalBluetoothAgentServiceProviderImpl::OnConfirmation, + &BluetoothAgentServiceProviderImpl::OnConfirmation, weak_ptr_factory_.GetWeakPtr(), method_call, response_sender); @@ -473,29 +453,24 @@ class ExperimentalBluetoothAgentServiceProviderImpl // than we do. // 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<ExperimentalBluetoothAgentServiceProviderImpl> - weak_ptr_factory_; + base::WeakPtrFactory<BluetoothAgentServiceProviderImpl> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothAgentServiceProviderImpl); + DISALLOW_COPY_AND_ASSIGN(BluetoothAgentServiceProviderImpl); }; -ExperimentalBluetoothAgentServiceProvider:: - ExperimentalBluetoothAgentServiceProvider() { +BluetoothAgentServiceProvider::BluetoothAgentServiceProvider() { } -ExperimentalBluetoothAgentServiceProvider:: - ~ExperimentalBluetoothAgentServiceProvider() { +BluetoothAgentServiceProvider::~BluetoothAgentServiceProvider() { } // static -ExperimentalBluetoothAgentServiceProvider* - ExperimentalBluetoothAgentServiceProvider::Create( - dbus::Bus* bus, - const dbus::ObjectPath& object_path, - Delegate* delegate) { +BluetoothAgentServiceProvider* BluetoothAgentServiceProvider::Create( + dbus::Bus* bus, + const dbus::ObjectPath& object_path, + Delegate* delegate) { if (base::chromeos::IsRunningOnChromeOS()) { - return new ExperimentalBluetoothAgentServiceProviderImpl( - bus, object_path, delegate); + return new BluetoothAgentServiceProviderImpl(bus, object_path, delegate); } else { return new FakeBluetoothAgentServiceProvider(object_path, delegate); } diff --git a/chromeos/dbus/experimental_bluetooth_agent_service_provider.h b/chromeos/dbus/bluetooth_agent_service_provider.h index ff264f9..3cef4d6 100644 --- a/chromeos/dbus/experimental_bluetooth_agent_service_provider.h +++ b/chromeos/dbus/bluetooth_agent_service_provider.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 CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ -#define CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ +#define CHROMEOS_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ #include <string> @@ -15,19 +15,20 @@ namespace chromeos { -// ExperimentalBluetoothAgentServiceProvider is used to provide a D-Bus object -// that BlueZ can communicate with during a remote device pairing request. +// BluetoothAgentServiceProvider is used to provide a D-Bus object that +// the bluetooth daemon can communicate with during a remote device pairing +// request. // // Instantiate with a chosen D-Bus object path and delegate object, and pass // the D-Bus object path as the |agent_path| argument to the -// chromeos::ExperimentalBluetoothAgentManagerClient::RegisterAgent() method. +// chromeos::BluetoothAgentManagerClient::RegisterAgent() method. // // After initiating the pairing process with a device, using the -// chromeos::ExperimentalBluetoothDeviceClient::Pair() method, the Bluetooth -// daemon will make calls to this agent object and they will be passed on to -// your Delegate object for handling. Responses should be returned using the -// callbacks supplied to those methods. -class CHROMEOS_EXPORT ExperimentalBluetoothAgentServiceProvider { +// chromeos::BluetoothDeviceClient::Pair() method, the Bluetooth daemon will +// make calls to this agent object and they will be passed on to your Delegate +// object for handling. Responses should be returned using the callbacks +// supplied to those methods. +class CHROMEOS_EXPORT BluetoothAgentServiceProvider { public: // Interface for reacting to agent requests. class Delegate { @@ -155,22 +156,24 @@ class CHROMEOS_EXPORT ExperimentalBluetoothAgentServiceProvider { virtual void Cancel() = 0; }; - virtual ~ExperimentalBluetoothAgentServiceProvider(); + virtual ~BluetoothAgentServiceProvider(); // Creates the instance where |bus| is the D-Bus bus connection to export // the object onto, |object_path| is the object path that it should have // and |delegate| is the object to which all method calls will be passed // and responses generated from. - static ExperimentalBluetoothAgentServiceProvider* Create( - dbus::Bus* bus, const dbus::ObjectPath& object_path, Delegate* delegate); + static BluetoothAgentServiceProvider* Create( + dbus::Bus* bus, + const dbus::ObjectPath& object_path, + Delegate* delegate); protected: - ExperimentalBluetoothAgentServiceProvider(); + BluetoothAgentServiceProvider(); private: - DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothAgentServiceProvider); + DISALLOW_COPY_AND_ASSIGN(BluetoothAgentServiceProvider); }; } // namespace chromeos -#endif // CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ diff --git a/chromeos/dbus/experimental_bluetooth_device_client.cc b/chromeos/dbus/bluetooth_device_client.cc index bf50ab0..62fbab8 100644 --- a/chromeos/dbus/experimental_bluetooth_device_client.cc +++ b/chromeos/dbus/bluetooth_device_client.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 "chromeos/dbus/experimental_bluetooth_device_client.h" +#include "chromeos/dbus/bluetooth_device_client.h" #include "base/bind.h" #include "base/logging.h" @@ -17,12 +17,12 @@ namespace chromeos { -const char ExperimentalBluetoothDeviceClient::kNoResponseError[] = +const char BluetoothDeviceClient::kNoResponseError[] = "org.chromium.Error.NoResponse"; -const char ExperimentalBluetoothDeviceClient::kUnknownDeviceError[] = +const char BluetoothDeviceClient::kUnknownDeviceError[] = "org.chromium.Error.UnknownDevice"; -ExperimentalBluetoothDeviceClient::Properties::Properties( +BluetoothDeviceClient::Properties::Properties( dbus::ObjectProxy* object_proxy, const std::string& interface_name, const PropertyChangedCallback& callback) @@ -44,16 +44,16 @@ ExperimentalBluetoothDeviceClient::Properties::Properties( RegisterProperty(bluetooth_device::kRSSIProperty, &rssi); } -ExperimentalBluetoothDeviceClient::Properties::~Properties() { +BluetoothDeviceClient::Properties::~Properties() { } -// The ExperimentalBluetoothDeviceClient implementation used in production. -class ExperimentalBluetoothDeviceClientImpl - : public ExperimentalBluetoothDeviceClient, +// The BluetoothDeviceClient implementation used in production. +class BluetoothDeviceClientImpl + : public BluetoothDeviceClient, public dbus::ObjectManager::Interface { public: - explicit ExperimentalBluetoothDeviceClientImpl(dbus::Bus* bus) + explicit BluetoothDeviceClientImpl(dbus::Bus* bus) : bus_(bus), weak_ptr_factory_(this) { object_manager_ = bus_->GetObjectManager( @@ -64,21 +64,21 @@ class ExperimentalBluetoothDeviceClientImpl bluetooth_device::kBluetoothDeviceInterface, this); } - virtual ~ExperimentalBluetoothDeviceClientImpl() { + virtual ~BluetoothDeviceClientImpl() { object_manager_->UnregisterInterface( bluetooth_device::kBluetoothDeviceInterface); } - // ExperimentalBluetoothDeviceClient override. - virtual void AddObserver( - ExperimentalBluetoothDeviceClient::Observer* observer) OVERRIDE { + // BluetoothDeviceClient override. + virtual void AddObserver(BluetoothDeviceClient::Observer* observer) + OVERRIDE { DCHECK(observer); observers_.AddObserver(observer); } - // ExperimentalBluetoothDeviceClient override. - virtual void RemoveObserver( - ExperimentalBluetoothDeviceClient::Observer* observer) OVERRIDE { + // BluetoothDeviceClient override. + virtual void RemoveObserver(BluetoothDeviceClient::Observer* observer) + OVERRIDE { DCHECK(observer); observers_.RemoveObserver(observer); } @@ -91,13 +91,13 @@ class ExperimentalBluetoothDeviceClientImpl Properties* properties = new Properties( object_proxy, interface_name, - base::Bind(&ExperimentalBluetoothDeviceClientImpl::OnPropertyChanged, + base::Bind(&BluetoothDeviceClientImpl::OnPropertyChanged, weak_ptr_factory_.GetWeakPtr(), object_path)); return static_cast<dbus::PropertySet*>(properties); } - // ExperimentalBluetoothDeviceClient override. + // BluetoothDeviceClient override. virtual std::vector<dbus::ObjectPath> GetDevicesForAdapter( const dbus::ObjectPath& adapter_path) OVERRIDE { std::vector<dbus::ObjectPath> object_paths, device_paths; @@ -112,7 +112,7 @@ class ExperimentalBluetoothDeviceClientImpl return object_paths; } - // ExperimentalBluetoothDeviceClient override. + // BluetoothDeviceClient override. virtual Properties* GetProperties(const dbus::ObjectPath& object_path) OVERRIDE { return static_cast<Properties*>( @@ -121,7 +121,7 @@ class ExperimentalBluetoothDeviceClientImpl bluetooth_device::kBluetoothDeviceInterface)); } - // ExperimentalBluetoothDeviceClient override. + // BluetoothDeviceClient override. virtual void Connect(const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback) OVERRIDE { @@ -140,13 +140,13 @@ class ExperimentalBluetoothDeviceClientImpl object_proxy->CallMethodWithErrorCallback( &method_call, dbus::ObjectProxy::TIMEOUT_INFINITE, - base::Bind(&ExperimentalBluetoothDeviceClientImpl::OnSuccess, + base::Bind(&BluetoothDeviceClientImpl::OnSuccess, weak_ptr_factory_.GetWeakPtr(), callback), - base::Bind(&ExperimentalBluetoothDeviceClientImpl::OnError, + base::Bind(&BluetoothDeviceClientImpl::OnError, weak_ptr_factory_.GetWeakPtr(), error_callback)); } - // ExperimentalBluetoothDeviceClient override. + // BluetoothDeviceClient override. virtual void Disconnect(const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback) OVERRIDE { @@ -164,13 +164,13 @@ class ExperimentalBluetoothDeviceClientImpl object_proxy->CallMethodWithErrorCallback( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, - base::Bind(&ExperimentalBluetoothDeviceClientImpl::OnSuccess, + base::Bind(&BluetoothDeviceClientImpl::OnSuccess, weak_ptr_factory_.GetWeakPtr(), callback), - base::Bind(&ExperimentalBluetoothDeviceClientImpl::OnError, + base::Bind(&BluetoothDeviceClientImpl::OnError, weak_ptr_factory_.GetWeakPtr(), error_callback)); } - // ExperimentalBluetoothDeviceClient override. + // BluetoothDeviceClient override. virtual void ConnectProfile(const dbus::ObjectPath& object_path, const std::string& uuid, const base::Closure& callback, @@ -193,13 +193,13 @@ class ExperimentalBluetoothDeviceClientImpl object_proxy->CallMethodWithErrorCallback( &method_call, dbus::ObjectProxy::TIMEOUT_INFINITE, - base::Bind(&ExperimentalBluetoothDeviceClientImpl::OnSuccess, + base::Bind(&BluetoothDeviceClientImpl::OnSuccess, weak_ptr_factory_.GetWeakPtr(), callback), - base::Bind(&ExperimentalBluetoothDeviceClientImpl::OnError, + base::Bind(&BluetoothDeviceClientImpl::OnError, weak_ptr_factory_.GetWeakPtr(), error_callback)); } - // ExperimentalBluetoothDeviceClient override. + // BluetoothDeviceClient override. virtual void DisconnectProfile(const dbus::ObjectPath& object_path, const std::string& uuid, const base::Closure& callback, @@ -222,13 +222,13 @@ class ExperimentalBluetoothDeviceClientImpl object_proxy->CallMethodWithErrorCallback( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, - base::Bind(&ExperimentalBluetoothDeviceClientImpl::OnSuccess, + base::Bind(&BluetoothDeviceClientImpl::OnSuccess, weak_ptr_factory_.GetWeakPtr(), callback), - base::Bind(&ExperimentalBluetoothDeviceClientImpl::OnError, + base::Bind(&BluetoothDeviceClientImpl::OnError, weak_ptr_factory_.GetWeakPtr(), error_callback)); } - // ExperimentalBluetoothDeviceClient override. + // BluetoothDeviceClient override. virtual void Pair(const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback) OVERRIDE { @@ -247,13 +247,13 @@ class ExperimentalBluetoothDeviceClientImpl object_proxy->CallMethodWithErrorCallback( &method_call, dbus::ObjectProxy::TIMEOUT_INFINITE, - base::Bind(&ExperimentalBluetoothDeviceClientImpl::OnSuccess, + base::Bind(&BluetoothDeviceClientImpl::OnSuccess, weak_ptr_factory_.GetWeakPtr(), callback), - base::Bind(&ExperimentalBluetoothDeviceClientImpl::OnError, + base::Bind(&BluetoothDeviceClientImpl::OnError, weak_ptr_factory_.GetWeakPtr(), error_callback)); } - // ExperimentalBluetoothDeviceClient override. + // BluetoothDeviceClient override. virtual void CancelPairing(const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback) @@ -271,9 +271,9 @@ class ExperimentalBluetoothDeviceClientImpl object_proxy->CallMethodWithErrorCallback( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, - base::Bind(&ExperimentalBluetoothDeviceClientImpl::OnSuccess, + base::Bind(&BluetoothDeviceClientImpl::OnSuccess, weak_ptr_factory_.GetWeakPtr(), callback), - base::Bind(&ExperimentalBluetoothDeviceClientImpl::OnError, + base::Bind(&BluetoothDeviceClientImpl::OnError, weak_ptr_factory_.GetWeakPtr(), error_callback)); } @@ -282,8 +282,7 @@ class ExperimentalBluetoothDeviceClientImpl // is created. Informs observers. virtual void ObjectAdded(const dbus::ObjectPath& object_path, const std::string& interface_name) OVERRIDE { - FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, - observers_, + FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, DeviceAdded(object_path)); } @@ -291,8 +290,7 @@ class ExperimentalBluetoothDeviceClientImpl // is removed. Informs observers. virtual void ObjectRemoved(const dbus::ObjectPath& object_path, const std::string& interface_name) OVERRIDE { - FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, - observers_, + FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, DeviceRemoved(object_path)); } @@ -301,7 +299,7 @@ class ExperimentalBluetoothDeviceClientImpl // call. Informs observers. void OnPropertyChanged(const dbus::ObjectPath& object_path, const std::string& property_name) { - FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, DevicePropertyChanged(object_path, property_name)); } @@ -333,28 +331,28 @@ class ExperimentalBluetoothDeviceClientImpl dbus::ObjectManager* object_manager_; // List of observers interested in event notifications from us. - ObserverList<ExperimentalBluetoothDeviceClient::Observer> observers_; + ObserverList<BluetoothDeviceClient::Observer> observers_; // Weak pointer factory for generating 'this' pointers that might live longer // than we do. // 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<ExperimentalBluetoothDeviceClientImpl> weak_ptr_factory_; + base::WeakPtrFactory<BluetoothDeviceClientImpl> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothDeviceClientImpl); + DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceClientImpl); }; -ExperimentalBluetoothDeviceClient::ExperimentalBluetoothDeviceClient() { +BluetoothDeviceClient::BluetoothDeviceClient() { } -ExperimentalBluetoothDeviceClient::~ExperimentalBluetoothDeviceClient() { +BluetoothDeviceClient::~BluetoothDeviceClient() { } -ExperimentalBluetoothDeviceClient* ExperimentalBluetoothDeviceClient::Create( +BluetoothDeviceClient* BluetoothDeviceClient::Create( DBusClientImplementationType type, dbus::Bus* bus) { if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new ExperimentalBluetoothDeviceClientImpl(bus); + return new BluetoothDeviceClientImpl(bus); DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); return new FakeBluetoothDeviceClient(); } diff --git a/chromeos/dbus/experimental_bluetooth_device_client.h b/chromeos/dbus/bluetooth_device_client.h index c89ae79..a0066e0 100644 --- a/chromeos/dbus/experimental_bluetooth_device_client.h +++ b/chromeos/dbus/bluetooth_device_client.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 CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_DEVICE_CLIENT_H_ -#define CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_DEVICE_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_DEVICE_CLIENT_H_ +#define CHROMEOS_DBUS_BLUETOOTH_DEVICE_CLIENT_H_ #include <string> #include <vector> @@ -22,9 +22,9 @@ class Bus; namespace chromeos { -// ExperimentalBluetoothDeviceClient is used to communicate with Bluetooth -// Device objects. -class CHROMEOS_EXPORT ExperimentalBluetoothDeviceClient { +// BluetoothDeviceClient is used to communicate with objects representing +// remote Bluetooth Devices. +class CHROMEOS_EXPORT BluetoothDeviceClient { public: // Structure of properties associated with bluetooth devices. struct Properties : public dbus::PropertySet { @@ -108,7 +108,7 @@ class CHROMEOS_EXPORT ExperimentalBluetoothDeviceClient { const std::string& property_name) {} }; - virtual ~ExperimentalBluetoothDeviceClient(); + virtual ~BluetoothDeviceClient(); // Adds and removes observers for events on all remote bluetooth // devices. Check the |object_path| parameter of observer methods to @@ -174,21 +174,20 @@ class CHROMEOS_EXPORT ExperimentalBluetoothDeviceClient { const ErrorCallback& error_callback) = 0; // Creates the instance. - static ExperimentalBluetoothDeviceClient* Create( - DBusClientImplementationType type, - dbus::Bus* bus); + static BluetoothDeviceClient* Create(DBusClientImplementationType type, + dbus::Bus* bus); // Constants used to indicate exceptional error conditions. static const char kNoResponseError[]; static const char kUnknownDeviceError[]; protected: - ExperimentalBluetoothDeviceClient(); + BluetoothDeviceClient(); private: - DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothDeviceClient); + DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceClient); }; } // namespace chromeos -#endif // CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_DEVICE_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_DEVICE_CLIENT_H_ diff --git a/chromeos/dbus/experimental_bluetooth_input_client.cc b/chromeos/dbus/bluetooth_input_client.cc index ccbc896..0d1eb53 100644 --- a/chromeos/dbus/experimental_bluetooth_input_client.cc +++ b/chromeos/dbus/bluetooth_input_client.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 "chromeos/dbus/experimental_bluetooth_input_client.h" +#include "chromeos/dbus/bluetooth_input_client.h" #include <map> @@ -18,7 +18,7 @@ namespace chromeos { -ExperimentalBluetoothInputClient::Properties::Properties( +BluetoothInputClient::Properties::Properties( dbus::ObjectProxy* object_proxy, const std::string& interface_name, const PropertyChangedCallback& callback) @@ -26,16 +26,16 @@ ExperimentalBluetoothInputClient::Properties::Properties( RegisterProperty(bluetooth_input::kReconnectModeProperty, &reconnect_mode); } -ExperimentalBluetoothInputClient::Properties::~Properties() { +BluetoothInputClient::Properties::~Properties() { } -// The ExperimentalBluetoothInputClient implementation used in production. -class ExperimentalBluetoothInputClientImpl - : public ExperimentalBluetoothInputClient, +// The BluetoothInputClient implementation used in production. +class BluetoothInputClientImpl + : public BluetoothInputClient, public dbus::ObjectManager::Interface { public: - explicit ExperimentalBluetoothInputClientImpl(dbus::Bus* bus) + explicit BluetoothInputClientImpl(dbus::Bus* bus) : bus_(bus), weak_ptr_factory_(this) { object_manager_ = bus_->GetObjectManager( @@ -46,21 +46,21 @@ class ExperimentalBluetoothInputClientImpl bluetooth_input::kBluetoothInputInterface, this); } - virtual ~ExperimentalBluetoothInputClientImpl() { + virtual ~BluetoothInputClientImpl() { object_manager_->UnregisterInterface( bluetooth_input::kBluetoothInputInterface); } - // ExperimentalBluetoothInputClient override. - virtual void AddObserver( - ExperimentalBluetoothInputClient::Observer* observer) OVERRIDE { + // BluetoothInputClient override. + virtual void AddObserver(BluetoothInputClient::Observer* observer) + OVERRIDE { DCHECK(observer); observers_.AddObserver(observer); } - // ExperimentalBluetoothInputClient override. - virtual void RemoveObserver( - ExperimentalBluetoothInputClient::Observer* observer) OVERRIDE { + // BluetoothInputClient override. + virtual void RemoveObserver(BluetoothInputClient::Observer* observer) + OVERRIDE { DCHECK(observer); observers_.RemoveObserver(observer); } @@ -73,13 +73,13 @@ class ExperimentalBluetoothInputClientImpl Properties* properties = new Properties( object_proxy, interface_name, - base::Bind(&ExperimentalBluetoothInputClientImpl::OnPropertyChanged, + base::Bind(&BluetoothInputClientImpl::OnPropertyChanged, weak_ptr_factory_.GetWeakPtr(), object_path)); return static_cast<dbus::PropertySet*>(properties); } - // ExperimentalBluetoothInputClient override. + // BluetoothInputClient override. virtual Properties* GetProperties(const dbus::ObjectPath& object_path) OVERRIDE { return static_cast<Properties*>( @@ -93,7 +93,7 @@ class ExperimentalBluetoothInputClientImpl // is created. Informs observers. virtual void ObjectAdded(const dbus::ObjectPath& object_path, const std::string& interface_name) OVERRIDE { - FOR_EACH_OBSERVER(ExperimentalBluetoothInputClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothInputClient::Observer, observers_, InputAdded(object_path)); } @@ -101,7 +101,7 @@ class ExperimentalBluetoothInputClientImpl // is removed. Informs observers. virtual void ObjectRemoved(const dbus::ObjectPath& object_path, const std::string& interface_name) OVERRIDE { - FOR_EACH_OBSERVER(ExperimentalBluetoothInputClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothInputClient::Observer, observers_, InputRemoved(object_path)); } @@ -110,7 +110,7 @@ class ExperimentalBluetoothInputClientImpl // call. Informs observers. void OnPropertyChanged(const dbus::ObjectPath& object_path, const std::string& property_name) { - FOR_EACH_OBSERVER(ExperimentalBluetoothInputClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothInputClient::Observer, observers_, InputPropertyChanged(object_path, property_name)); } @@ -118,28 +118,28 @@ class ExperimentalBluetoothInputClientImpl dbus::ObjectManager* object_manager_; // List of observers interested in event notifications from us. - ObserverList<ExperimentalBluetoothInputClient::Observer> observers_; + ObserverList<BluetoothInputClient::Observer> observers_; // Weak pointer factory for generating 'this' pointers that might live longer // than we do. // 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<ExperimentalBluetoothInputClientImpl> weak_ptr_factory_; + base::WeakPtrFactory<BluetoothInputClientImpl> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothInputClientImpl); + DISALLOW_COPY_AND_ASSIGN(BluetoothInputClientImpl); }; -ExperimentalBluetoothInputClient::ExperimentalBluetoothInputClient() { +BluetoothInputClient::BluetoothInputClient() { } -ExperimentalBluetoothInputClient::~ExperimentalBluetoothInputClient() { +BluetoothInputClient::~BluetoothInputClient() { } -ExperimentalBluetoothInputClient* ExperimentalBluetoothInputClient::Create( +BluetoothInputClient* BluetoothInputClient::Create( DBusClientImplementationType type, dbus::Bus* bus) { if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new ExperimentalBluetoothInputClientImpl(bus); + return new BluetoothInputClientImpl(bus); DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); return new FakeBluetoothInputClient(); } diff --git a/chromeos/dbus/experimental_bluetooth_input_client.h b/chromeos/dbus/bluetooth_input_client.h index 09a6a6b..d4d25d3 100644 --- a/chromeos/dbus/experimental_bluetooth_input_client.h +++ b/chromeos/dbus/bluetooth_input_client.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 CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_INPUT_CLIENT_H_ -#define CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_INPUT_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_INPUT_CLIENT_H_ +#define CHROMEOS_DBUS_BLUETOOTH_INPUT_CLIENT_H_ #include <string> #include <vector> @@ -21,9 +21,9 @@ class Bus; namespace chromeos { -// ExperimentalBluetoothInputClient is used to communicate with Bluetooth -// Input objects. -class CHROMEOS_EXPORT ExperimentalBluetoothInputClient { +// BluetoothInputClient is used to communicate with objects representing +// Bluetooth Input (HID) devices. +class CHROMEOS_EXPORT BluetoothInputClient { public: // Structure of properties associated with bluetooth input devices. struct Properties : public dbus::PropertySet { @@ -58,7 +58,7 @@ class CHROMEOS_EXPORT ExperimentalBluetoothInputClient { const std::string& property_name) {} }; - virtual ~ExperimentalBluetoothInputClient(); + virtual ~BluetoothInputClient(); // Adds and removes observers for events on all remote bluetooth input // devices. Check the |object_path| parameter of observer methods to @@ -71,17 +71,16 @@ class CHROMEOS_EXPORT ExperimentalBluetoothInputClient { virtual Properties* GetProperties(const dbus::ObjectPath& object_path) = 0; // Creates the instance. - static ExperimentalBluetoothInputClient* Create( - DBusClientImplementationType type, - dbus::Bus* bus); + static BluetoothInputClient* Create(DBusClientImplementationType type, + dbus::Bus* bus); protected: - ExperimentalBluetoothInputClient(); + BluetoothInputClient(); private: - DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothInputClient); + DISALLOW_COPY_AND_ASSIGN(BluetoothInputClient); }; } // namespace chromeos -#endif // CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_INPUT_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_INPUT_CLIENT_H_ diff --git a/chromeos/dbus/experimental_bluetooth_profile_manager_client.cc b/chromeos/dbus/bluetooth_profile_manager_client.cc index 1d3562e..6f2875b 100644 --- a/chromeos/dbus/experimental_bluetooth_profile_manager_client.cc +++ b/chromeos/dbus/bluetooth_profile_manager_client.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 "chromeos/dbus/experimental_bluetooth_profile_manager_client.h" +#include "chromeos/dbus/bluetooth_profile_manager_client.h" #include "base/bind.h" #include "base/logging.h" @@ -15,26 +15,25 @@ namespace chromeos { -const char ExperimentalBluetoothProfileManagerClient::kNoResponseError[] = +const char BluetoothProfileManagerClient::kNoResponseError[] = "org.chromium.Error.NoResponse"; -ExperimentalBluetoothProfileManagerClient::Options::Options() +BluetoothProfileManagerClient::Options::Options() : role(SYMMETRIC), require_authentication(false), require_authorization(false), auto_connect(true) { } -ExperimentalBluetoothProfileManagerClient::Options::~Options() { +BluetoothProfileManagerClient::Options::~Options() { } -// The ExperimentalBluetoothProfileManagerClient implementation used in -// production. -class ExperimentalBluetoothProfileManagerClientImpl - : public ExperimentalBluetoothProfileManagerClient { +// The BluetoothProfileManagerClient implementation used in production. +class BluetoothProfileManagerClientImpl + : public BluetoothProfileManagerClient { public: - explicit ExperimentalBluetoothProfileManagerClientImpl(dbus::Bus* bus) + explicit BluetoothProfileManagerClientImpl(dbus::Bus* bus) : bus_(bus), weak_ptr_factory_(this) { DCHECK(bus_); @@ -44,10 +43,10 @@ class ExperimentalBluetoothProfileManagerClientImpl bluetooth_profile_manager::kBluetoothProfileManagerServicePath)); } - virtual ~ExperimentalBluetoothProfileManagerClientImpl() { + virtual ~BluetoothProfileManagerClientImpl() { } - // ExperimentalBluetoothProfileManagerClient override. + // BluetoothProfileManagerClient override. virtual void RegisterProfile(const dbus::ObjectPath& profile_path, const std::string& uuid, const Options& options, @@ -166,13 +165,13 @@ class ExperimentalBluetoothProfileManagerClientImpl object_proxy_->CallMethodWithErrorCallback( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, - base::Bind(&ExperimentalBluetoothProfileManagerClientImpl::OnSuccess, + base::Bind(&BluetoothProfileManagerClientImpl::OnSuccess, weak_ptr_factory_.GetWeakPtr(), callback), - base::Bind(&ExperimentalBluetoothProfileManagerClientImpl::OnError, + base::Bind(&BluetoothProfileManagerClientImpl::OnError, weak_ptr_factory_.GetWeakPtr(), error_callback)); } - // ExperimentalBluetoothProfileManagerClient override. + // BluetoothProfileManagerClient override. virtual void UnregisterProfile(const dbus::ObjectPath& profile_path, const base::Closure& callback, const ErrorCallback& error_callback) OVERRIDE { @@ -186,9 +185,9 @@ class ExperimentalBluetoothProfileManagerClientImpl object_proxy_->CallMethodWithErrorCallback( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, - base::Bind(&ExperimentalBluetoothProfileManagerClientImpl::OnSuccess, + base::Bind(&BluetoothProfileManagerClientImpl::OnSuccess, weak_ptr_factory_.GetWeakPtr(), callback), - base::Bind(&ExperimentalBluetoothProfileManagerClientImpl::OnError, + base::Bind(&BluetoothProfileManagerClientImpl::OnError, weak_ptr_factory_.GetWeakPtr(), error_callback)); } @@ -224,26 +223,22 @@ class ExperimentalBluetoothProfileManagerClientImpl // than we do. // 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<ExperimentalBluetoothProfileManagerClientImpl> - weak_ptr_factory_; + base::WeakPtrFactory<BluetoothProfileManagerClientImpl> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothProfileManagerClientImpl); + DISALLOW_COPY_AND_ASSIGN(BluetoothProfileManagerClientImpl); }; -ExperimentalBluetoothProfileManagerClient:: - ExperimentalBluetoothProfileManagerClient() { +BluetoothProfileManagerClient::BluetoothProfileManagerClient() { } -ExperimentalBluetoothProfileManagerClient:: - ~ExperimentalBluetoothProfileManagerClient() { +BluetoothProfileManagerClient::~BluetoothProfileManagerClient() { } -ExperimentalBluetoothProfileManagerClient* - ExperimentalBluetoothProfileManagerClient::Create( - DBusClientImplementationType type, - dbus::Bus* bus) { +BluetoothProfileManagerClient* BluetoothProfileManagerClient::Create( + DBusClientImplementationType type, + dbus::Bus* bus) { if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) - return new ExperimentalBluetoothProfileManagerClientImpl(bus); + return new BluetoothProfileManagerClientImpl(bus); DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); return new FakeBluetoothProfileManagerClient(); } diff --git a/chromeos/dbus/experimental_bluetooth_profile_manager_client.h b/chromeos/dbus/bluetooth_profile_manager_client.h index df92936..bcf92ddb 100644 --- a/chromeos/dbus/experimental_bluetooth_profile_manager_client.h +++ b/chromeos/dbus/bluetooth_profile_manager_client.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 CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_ -#define CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_ +#define CHROMEOS_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_ #include <string> #include <vector> @@ -20,9 +20,9 @@ class Bus; namespace chromeos { -// ExperimentalBluetoothProfileManagerClient is used to communicate with -// Bluetooth profile manager objects. -class CHROMEOS_EXPORT ExperimentalBluetoothProfileManagerClient { +// BluetoothProfileManagerClient is used to communicate with the profile +// manager object of the Bluetooth daemon. +class CHROMEOS_EXPORT BluetoothProfileManagerClient { public: // Species the role of the object within the profile. SYMMETRIC should be // usually used unless the profile requires you specify as a CLIENT or as a @@ -72,7 +72,7 @@ class CHROMEOS_EXPORT ExperimentalBluetoothProfileManagerClient { uint16 features; }; - virtual ~ExperimentalBluetoothProfileManagerClient(); + virtual ~BluetoothProfileManagerClient(); // The ErrorCallback is used by adapter methods to indicate failure. // It receives two arguments: the name of the error in |error_name| and @@ -98,7 +98,7 @@ class CHROMEOS_EXPORT ExperimentalBluetoothProfileManagerClient { // Creates the instance. - static ExperimentalBluetoothProfileManagerClient* Create( + static BluetoothProfileManagerClient* Create( DBusClientImplementationType type, dbus::Bus* bus); @@ -106,12 +106,12 @@ class CHROMEOS_EXPORT ExperimentalBluetoothProfileManagerClient { static const char kNoResponseError[]; protected: - ExperimentalBluetoothProfileManagerClient(); + BluetoothProfileManagerClient(); private: - DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothProfileManagerClient); + DISALLOW_COPY_AND_ASSIGN(BluetoothProfileManagerClient); }; } // namespace chromeos -#endif // CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_ diff --git a/chromeos/dbus/experimental_bluetooth_profile_service_provider.cc b/chromeos/dbus/bluetooth_profile_service_provider.cc index 4d69e69..dda9714 100644 --- a/chromeos/dbus/experimental_bluetooth_profile_service_provider.cc +++ b/chromeos/dbus/bluetooth_profile_service_provider.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 "chromeos/dbus/experimental_bluetooth_profile_service_provider.h" +#include "chromeos/dbus/bluetooth_profile_service_provider.h" #include <string> @@ -20,15 +20,13 @@ namespace chromeos { -// The ExperimentalBluetoothProfileServiceProvider implementation used in -// production. -class ExperimentalBluetoothProfileServiceProviderImpl - : public ExperimentalBluetoothProfileServiceProvider { +// The BluetoothProfileServiceProvider implementation used in production. +class BluetoothProfileServiceProviderImpl + : public BluetoothProfileServiceProvider { public: - ExperimentalBluetoothProfileServiceProviderImpl( - dbus::Bus* bus, - const dbus::ObjectPath& object_path, - Delegate* delegate) + BluetoothProfileServiceProviderImpl(dbus::Bus* bus, + const dbus::ObjectPath& object_path, + Delegate* delegate) : origin_thread_id_(base::PlatformThread::CurrentId()), bus_(bus), delegate_(delegate), @@ -41,45 +39,37 @@ class ExperimentalBluetoothProfileServiceProviderImpl exported_object_->ExportMethod( bluetooth_profile::kBluetoothProfileInterface, bluetooth_profile::kRelease, - base::Bind( - &ExperimentalBluetoothProfileServiceProviderImpl::Release, - weak_ptr_factory_.GetWeakPtr()), - base::Bind( - &ExperimentalBluetoothProfileServiceProviderImpl::OnExported, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothProfileServiceProviderImpl::Release, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&BluetoothProfileServiceProviderImpl::OnExported, + weak_ptr_factory_.GetWeakPtr())); exported_object_->ExportMethod( bluetooth_profile::kBluetoothProfileInterface, bluetooth_profile::kNewConnection, - base::Bind( - &ExperimentalBluetoothProfileServiceProviderImpl::NewConnection, - weak_ptr_factory_.GetWeakPtr()), - base::Bind( - &ExperimentalBluetoothProfileServiceProviderImpl::OnExported, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothProfileServiceProviderImpl::NewConnection, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&BluetoothProfileServiceProviderImpl::OnExported, + weak_ptr_factory_.GetWeakPtr())); exported_object_->ExportMethod( bluetooth_profile::kBluetoothProfileInterface, bluetooth_profile::kRequestDisconnection, - base::Bind( - &ExperimentalBluetoothProfileServiceProviderImpl::RequestDisconnection, - weak_ptr_factory_.GetWeakPtr()), - base::Bind( - &ExperimentalBluetoothProfileServiceProviderImpl::OnExported, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothProfileServiceProviderImpl::RequestDisconnection, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&BluetoothProfileServiceProviderImpl::OnExported, + weak_ptr_factory_.GetWeakPtr())); exported_object_->ExportMethod( bluetooth_profile::kBluetoothProfileInterface, bluetooth_profile::kCancel, - base::Bind( - &ExperimentalBluetoothProfileServiceProviderImpl::Cancel, - weak_ptr_factory_.GetWeakPtr()), - base::Bind( - &ExperimentalBluetoothProfileServiceProviderImpl::OnExported, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BluetoothProfileServiceProviderImpl::Cancel, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&BluetoothProfileServiceProviderImpl::OnExported, + weak_ptr_factory_.GetWeakPtr())); } - virtual ~ExperimentalBluetoothProfileServiceProviderImpl() { + virtual ~BluetoothProfileServiceProviderImpl() { VLOG(1) << "Cleaning up Bluetooth Profile: " << object_path_.value(); // Unregister the object path so we can reuse with a new agent. @@ -140,7 +130,7 @@ class ExperimentalBluetoothProfileServiceProviderImpl } Delegate::ConfirmationCallback callback = base::Bind( - &ExperimentalBluetoothProfileServiceProviderImpl::OnConfirmation, + &BluetoothProfileServiceProviderImpl::OnConfirmation, weak_ptr_factory_.GetWeakPtr(), method_call, response_sender); @@ -165,7 +155,7 @@ class ExperimentalBluetoothProfileServiceProviderImpl } Delegate::ConfirmationCallback callback = base::Bind( - &ExperimentalBluetoothProfileServiceProviderImpl::OnConfirmation, + &BluetoothProfileServiceProviderImpl::OnConfirmation, weak_ptr_factory_.GetWeakPtr(), method_call, response_sender); @@ -246,29 +236,24 @@ class ExperimentalBluetoothProfileServiceProviderImpl // than we do. // 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<ExperimentalBluetoothProfileServiceProviderImpl> - weak_ptr_factory_; + base::WeakPtrFactory<BluetoothProfileServiceProviderImpl> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothProfileServiceProviderImpl); + DISALLOW_COPY_AND_ASSIGN(BluetoothProfileServiceProviderImpl); }; -ExperimentalBluetoothProfileServiceProvider:: - ExperimentalBluetoothProfileServiceProvider() { +BluetoothProfileServiceProvider::BluetoothProfileServiceProvider() { } -ExperimentalBluetoothProfileServiceProvider:: - ~ExperimentalBluetoothProfileServiceProvider() { +BluetoothProfileServiceProvider::~BluetoothProfileServiceProvider() { } // static -ExperimentalBluetoothProfileServiceProvider* - ExperimentalBluetoothProfileServiceProvider::Create( - dbus::Bus* bus, - const dbus::ObjectPath& object_path, - Delegate* delegate) { +BluetoothProfileServiceProvider* BluetoothProfileServiceProvider::Create( + dbus::Bus* bus, + const dbus::ObjectPath& object_path, + Delegate* delegate) { if (base::chromeos::IsRunningOnChromeOS()) { - return new ExperimentalBluetoothProfileServiceProviderImpl( - bus, object_path, delegate); + return new BluetoothProfileServiceProviderImpl(bus, object_path, delegate); } else { return new FakeBluetoothProfileServiceProvider(object_path, delegate); } diff --git a/chromeos/dbus/experimental_bluetooth_profile_service_provider.h b/chromeos/dbus/bluetooth_profile_service_provider.h index 4649696..ee942cf 100644 --- a/chromeos/dbus/experimental_bluetooth_profile_service_provider.h +++ b/chromeos/dbus/bluetooth_profile_service_provider.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 CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ -#define CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ +#define CHROMEOS_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ #include <string> @@ -17,20 +17,19 @@ namespace chromeos { -// ExperimentalBluetoothProfileServiceProvider is used to provide a D-Bus -// object that BlueZ can communicate with to connect application profiles. +// BluetoothProfileServiceProvider is used to provide a D-Bus object that the +// Bluetooth daemon can communicate with to connect application profiles. // // Instantiate with a chosen D-Bus object path and delegate object, and pass // the D-Bus object path as the |agent_path| argument to the -// chromeos::ExperimentalBluetoothProfileManagerClient::RegisterProfile() -// method. +// chromeos::BluetoothProfileManagerClient::RegisterProfile() method. // // When an incoming profile connection occurs, or after initiating a connection -// using the chromeos::ExperimentalBluetoothDeviceClient::ConnectProfile() -// method, the Bluetooth daemon will make calls to this profile object and they -// will be passed on to your Delegate object for handling. Responses should be -// returned using the callbacks supplied to those methods. -class CHROMEOS_EXPORT ExperimentalBluetoothProfileServiceProvider { +// using the chromeos::BluetoothDeviceClient::ConnectProfile() method, the +// Bluetooth daemon will make calls to this profile object and they will be +// passed on to your Delegate object for handling. Responses should be returned +// using the callbacks supplied to those methods. +class CHROMEOS_EXPORT BluetoothProfileServiceProvider { public: // Interface for reacting to profile requests. class Delegate { @@ -100,22 +99,24 @@ class CHROMEOS_EXPORT ExperimentalBluetoothProfileServiceProvider { virtual void Cancel() = 0; }; - virtual ~ExperimentalBluetoothProfileServiceProvider(); + virtual ~BluetoothProfileServiceProvider(); // Creates the instance where |bus| is the D-Bus bus connection to export // the object onto, |object_path| is the object path that it should have // and |delegate| is the object to which all method calls will be passed // and responses generated from. - static ExperimentalBluetoothProfileServiceProvider* Create( - dbus::Bus* bus, const dbus::ObjectPath& object_path, Delegate* delegate); + static BluetoothProfileServiceProvider* Create( + dbus::Bus* bus, + const dbus::ObjectPath& object_path, + Delegate* delegate); protected: - ExperimentalBluetoothProfileServiceProvider(); + BluetoothProfileServiceProvider(); private: - DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothProfileServiceProvider); + DISALLOW_COPY_AND_ASSIGN(BluetoothProfileServiceProvider); }; } // namespace chromeos -#endif // CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc index e7605eb..f76edb1 100644 --- a/chromeos/dbus/dbus_thread_manager.cc +++ b/chromeos/dbus/dbus_thread_manager.cc @@ -11,17 +11,17 @@ #include "base/observer_list.h" #include "base/threading/thread.h" #include "chromeos/chromeos_switches.h" +#include "chromeos/dbus/bluetooth_adapter_client.h" +#include "chromeos/dbus/bluetooth_agent_manager_client.h" +#include "chromeos/dbus/bluetooth_device_client.h" +#include "chromeos/dbus/bluetooth_input_client.h" +#include "chromeos/dbus/bluetooth_profile_manager_client.h" #include "chromeos/dbus/cras_audio_client.h" #include "chromeos/dbus/cros_disks_client.h" #include "chromeos/dbus/cryptohome_client.h" #include "chromeos/dbus/dbus_client_implementation_type.h" #include "chromeos/dbus/dbus_thread_manager_observer.h" #include "chromeos/dbus/debug_daemon_client.h" -#include "chromeos/dbus/experimental_bluetooth_adapter_client.h" -#include "chromeos/dbus/experimental_bluetooth_agent_manager_client.h" -#include "chromeos/dbus/experimental_bluetooth_device_client.h" -#include "chromeos/dbus/experimental_bluetooth_input_client.h" -#include "chromeos/dbus/experimental_bluetooth_profile_manager_client.h" #include "chromeos/dbus/gsm_sms_client.h" #include "chromeos/dbus/shill_device_client.h" #include "chromeos/dbus/shill_ipconfig_client.h" @@ -83,6 +83,16 @@ class DBusThreadManagerImpl : public DBusThreadManager { // NOTE: Clients that access other clients in their constructor must be // construced in the correct order. void InitializeClients() { + bluetooth_adapter_client_.reset( + BluetoothAdapterClient::Create(client_type_, system_bus_.get())); + bluetooth_agent_manager_client_.reset( + BluetoothAgentManagerClient::Create(client_type_, system_bus_.get())); + bluetooth_device_client_.reset( + BluetoothDeviceClient::Create(client_type_, system_bus_.get())); + bluetooth_input_client_.reset( + BluetoothInputClient::Create(client_type_, system_bus_.get())); + bluetooth_profile_manager_client_.reset( + BluetoothProfileManagerClient::Create(client_type_, system_bus_.get())); cras_audio_client_.reset(CrasAudioClient::Create( client_type_, system_bus_.get())); cros_disks_client_.reset( @@ -92,22 +102,6 @@ class DBusThreadManagerImpl : public DBusThreadManager { debug_daemon_client_.reset( DebugDaemonClient::Create(client_type_, system_bus_.get())); - experimental_bluetooth_adapter_client_.reset( - ExperimentalBluetoothAdapterClient::Create( - client_type_, system_bus_.get())); - experimental_bluetooth_agent_manager_client_.reset( - ExperimentalBluetoothAgentManagerClient::Create( - client_type_, system_bus_.get())); - experimental_bluetooth_device_client_.reset( - ExperimentalBluetoothDeviceClient::Create( - client_type_, system_bus_.get())); - experimental_bluetooth_input_client_.reset( - ExperimentalBluetoothInputClient::Create( - client_type_, system_bus_.get())); - experimental_bluetooth_profile_manager_client_.reset( - ExperimentalBluetoothProfileManagerClient::Create( - client_type_, system_bus_.get())); - shill_manager_client_.reset( ShillManagerClient::Create(client_type_override_, system_bus_.get())); shill_device_client_.reset( @@ -227,45 +221,42 @@ class DBusThreadManagerImpl : public DBusThreadManager { return ibus_bus_.get(); } - virtual CrasAudioClient* GetCrasAudioClient() OVERRIDE { - return cras_audio_client_.get(); + virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE { + return bluetooth_adapter_client_.get(); } - virtual CrosDisksClient* GetCrosDisksClient() OVERRIDE { - return cros_disks_client_.get(); + virtual BluetoothAgentManagerClient* GetBluetoothAgentManagerClient() + OVERRIDE { + return bluetooth_agent_manager_client_.get(); } - virtual CryptohomeClient* GetCryptohomeClient() OVERRIDE { - return cryptohome_client_.get(); + virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE { + return bluetooth_device_client_.get(); } - virtual DebugDaemonClient* GetDebugDaemonClient() OVERRIDE { - return debug_daemon_client_.get(); + virtual BluetoothInputClient* GetBluetoothInputClient() OVERRIDE { + return bluetooth_input_client_.get(); } - virtual ExperimentalBluetoothAdapterClient* - GetExperimentalBluetoothAdapterClient() OVERRIDE { - return experimental_bluetooth_adapter_client_.get(); + virtual BluetoothProfileManagerClient* GetBluetoothProfileManagerClient() + OVERRIDE { + return bluetooth_profile_manager_client_.get(); } - virtual ExperimentalBluetoothAgentManagerClient* - GetExperimentalBluetoothAgentManagerClient() OVERRIDE { - return experimental_bluetooth_agent_manager_client_.get(); + virtual CrasAudioClient* GetCrasAudioClient() OVERRIDE { + return cras_audio_client_.get(); } - virtual ExperimentalBluetoothDeviceClient* - GetExperimentalBluetoothDeviceClient() OVERRIDE { - return experimental_bluetooth_device_client_.get(); + virtual CrosDisksClient* GetCrosDisksClient() OVERRIDE { + return cros_disks_client_.get(); } - virtual ExperimentalBluetoothInputClient* - GetExperimentalBluetoothInputClient() OVERRIDE { - return experimental_bluetooth_input_client_.get(); + virtual CryptohomeClient* GetCryptohomeClient() OVERRIDE { + return cryptohome_client_.get(); } - virtual ExperimentalBluetoothProfileManagerClient* - GetExperimentalBluetoothProfileManagerClient() OVERRIDE { - return experimental_bluetooth_profile_manager_client_.get(); + virtual DebugDaemonClient* GetDebugDaemonClient() OVERRIDE { + return debug_daemon_client_.get(); } virtual ShillDeviceClient* GetShillDeviceClient() OVERRIDE { @@ -387,20 +378,15 @@ class DBusThreadManagerImpl : public DBusThreadManager { scoped_ptr<base::Thread> dbus_thread_; scoped_refptr<dbus::Bus> system_bus_; scoped_refptr<dbus::Bus> ibus_bus_; + scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_; + scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client_; + scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_; + scoped_ptr<BluetoothInputClient> bluetooth_input_client_; + scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client_; scoped_ptr<CrasAudioClient> cras_audio_client_; scoped_ptr<CrosDisksClient> cros_disks_client_; scoped_ptr<CryptohomeClient> cryptohome_client_; scoped_ptr<DebugDaemonClient> debug_daemon_client_; - scoped_ptr<ExperimentalBluetoothAdapterClient> - experimental_bluetooth_adapter_client_; - scoped_ptr<ExperimentalBluetoothAgentManagerClient> - experimental_bluetooth_agent_manager_client_; - scoped_ptr<ExperimentalBluetoothDeviceClient> - experimental_bluetooth_device_client_; - scoped_ptr<ExperimentalBluetoothInputClient> - experimental_bluetooth_input_client_; - scoped_ptr<ExperimentalBluetoothProfileManagerClient> - experimental_bluetooth_profile_manager_client_; scoped_ptr<ShillDeviceClient> shill_device_client_; scoped_ptr<ShillIPConfigClient> shill_ipconfig_client_; scoped_ptr<ShillManagerClient> shill_manager_client_; diff --git a/chromeos/dbus/dbus_thread_manager.h b/chromeos/dbus/dbus_thread_manager.h index 89f23b6..a46ee64 100644 --- a/chromeos/dbus/dbus_thread_manager.h +++ b/chromeos/dbus/dbus_thread_manager.h @@ -26,15 +26,15 @@ namespace chromeos { class DBusThreadManagerObserver; // Style Note: Clients are sorted by names. +class BluetoothAdapterClient; +class BluetoothAgentManagerClient; +class BluetoothDeviceClient; +class BluetoothInputClient; +class BluetoothProfileManagerClient; class CrasAudioClient; class CrosDisksClient; class CryptohomeClient; class DebugDaemonClient; -class ExperimentalBluetoothAdapterClient; -class ExperimentalBluetoothAgentManagerClient; -class ExperimentalBluetoothDeviceClient; -class ExperimentalBluetoothInputClient; -class ExperimentalBluetoothProfileManagerClient; class GsmSMSClient; class IBusClient; class IBusConfigClient; @@ -120,20 +120,15 @@ class CHROMEOS_EXPORT DBusThreadManager { // All returned objects are owned by DBusThreadManager. Do not cache these // pointers and use them after DBusThreadManager has been shut down. + virtual BluetoothAdapterClient* GetBluetoothAdapterClient() = 0; + virtual BluetoothAgentManagerClient* GetBluetoothAgentManagerClient() = 0; + virtual BluetoothDeviceClient* GetBluetoothDeviceClient() = 0; + virtual BluetoothInputClient* GetBluetoothInputClient() = 0; + virtual BluetoothProfileManagerClient* GetBluetoothProfileManagerClient() = 0; virtual CrasAudioClient* GetCrasAudioClient() = 0; virtual CrosDisksClient* GetCrosDisksClient() = 0; virtual CryptohomeClient* GetCryptohomeClient() = 0; virtual DebugDaemonClient* GetDebugDaemonClient() = 0; - virtual ExperimentalBluetoothAdapterClient* - GetExperimentalBluetoothAdapterClient() = 0; - virtual ExperimentalBluetoothAgentManagerClient* - GetExperimentalBluetoothAgentManagerClient() = 0; - virtual ExperimentalBluetoothDeviceClient* - GetExperimentalBluetoothDeviceClient() = 0; - virtual ExperimentalBluetoothInputClient* - GetExperimentalBluetoothInputClient() = 0; - virtual ExperimentalBluetoothProfileManagerClient* - GetExperimentalBluetoothProfileManagerClient() = 0; virtual GsmSMSClient* GetGsmSMSClient() = 0; virtual IBusClient* GetIBusClient() = 0; virtual IBusConfigClient* GetIBusConfigClient() = 0; diff --git a/chromeos/dbus/fake_bluetooth_adapter_client.cc b/chromeos/dbus/fake_bluetooth_adapter_client.cc index 695579d..695ccdf 100644 --- a/chromeos/dbus/fake_bluetooth_adapter_client.cc +++ b/chromeos/dbus/fake_bluetooth_adapter_client.cc @@ -38,7 +38,7 @@ const char FakeBluetoothAdapterClient::kSecondAdapterAddress[] = FakeBluetoothAdapterClient::Properties::Properties( const PropertyChangedCallback& callback) - : ExperimentalBluetoothAdapterClient::Properties( + : BluetoothAdapterClient::Properties( NULL, bluetooth_adapter::kBluetoothAdapterInterface, callback) { @@ -143,7 +143,7 @@ void FakeBluetoothAdapterClient::StartDiscovery( FakeBluetoothDeviceClient* device_client = static_cast<FakeBluetoothDeviceClient*>( - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()); + DBusThreadManager::Get()->GetBluetoothDeviceClient()); device_client->BeginDiscoverySimulation(dbus::ObjectPath(kAdapterPath)); } } @@ -171,7 +171,7 @@ void FakeBluetoothAdapterClient::StopDiscovery( if (discovering_count_ == 0) { FakeBluetoothDeviceClient* device_client = static_cast<FakeBluetoothDeviceClient*>( - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()); + DBusThreadManager::Get()->GetBluetoothDeviceClient()); device_client->EndDiscoverySimulation(dbus::ObjectPath(kAdapterPath)); properties_->discovering.ReplaceValue(false); @@ -194,7 +194,7 @@ void FakeBluetoothAdapterClient::RemoveDevice( FakeBluetoothDeviceClient* device_client = static_cast<FakeBluetoothDeviceClient*>( - DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()); + DBusThreadManager::Get()->GetBluetoothDeviceClient()); device_client->RemoveDevice(dbus::ObjectPath(kAdapterPath), device_path); } @@ -204,14 +204,14 @@ void FakeBluetoothAdapterClient::SetVisible( // Adapter becoming visible visible_ = visible; - FOR_EACH_OBSERVER(ExperimentalBluetoothAdapterClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, AdapterAdded(dbus::ObjectPath(kAdapterPath))); } else if (visible_ && !visible) { // Adapter becoming invisible visible_ = visible; - FOR_EACH_OBSERVER(ExperimentalBluetoothAdapterClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, AdapterRemoved(dbus::ObjectPath(kAdapterPath))); } } @@ -222,14 +222,14 @@ void FakeBluetoothAdapterClient::SetSecondVisible( // Second adapter becoming visible second_visible_ = visible; - FOR_EACH_OBSERVER(ExperimentalBluetoothAdapterClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, AdapterAdded(dbus::ObjectPath(kSecondAdapterPath))); } else if (second_visible_ && !visible) { // Second adapter becoming invisible second_visible_ = visible; - FOR_EACH_OBSERVER(ExperimentalBluetoothAdapterClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, AdapterRemoved(dbus::ObjectPath(kSecondAdapterPath))); } } @@ -246,7 +246,7 @@ void FakeBluetoothAdapterClient::OnPropertyChanged( } } - FOR_EACH_OBSERVER(ExperimentalBluetoothAdapterClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, AdapterPropertyChanged(dbus::ObjectPath(kAdapterPath), property_name)); } diff --git a/chromeos/dbus/fake_bluetooth_adapter_client.h b/chromeos/dbus/fake_bluetooth_adapter_client.h index 96fa426..6eb994a 100644 --- a/chromeos/dbus/fake_bluetooth_adapter_client.h +++ b/chromeos/dbus/fake_bluetooth_adapter_client.h @@ -11,8 +11,8 @@ #include "base/callback.h" #include "base/observer_list.h" #include "chromeos/chromeos_export.h" +#include "chromeos/dbus/bluetooth_adapter_client.h" #include "chromeos/dbus/dbus_client_implementation_type.h" -#include "chromeos/dbus/experimental_bluetooth_adapter_client.h" #include "dbus/object_path.h" #include "dbus/property.h" @@ -22,9 +22,9 @@ namespace chromeos { // adapter objects and is used both in test cases in place of a mock and on // the Linux desktop. class CHROMEOS_EXPORT FakeBluetoothAdapterClient - : public ExperimentalBluetoothAdapterClient { + : public BluetoothAdapterClient { public: - struct Properties : public ExperimentalBluetoothAdapterClient::Properties { + struct Properties : public BluetoothAdapterClient::Properties { explicit Properties(const PropertyChangedCallback & callback); virtual ~Properties(); @@ -39,7 +39,7 @@ class CHROMEOS_EXPORT FakeBluetoothAdapterClient FakeBluetoothAdapterClient(); virtual ~FakeBluetoothAdapterClient(); - // ExperimentalBluetoothAdapterClient override + // BluetoothAdapterClient override virtual void AddObserver(Observer* observer) OVERRIDE; virtual void RemoveObserver(Observer* observer) OVERRIDE; virtual std::vector<dbus::ObjectPath> GetAdapters() OVERRIDE; diff --git a/chromeos/dbus/fake_bluetooth_agent_manager_client.h b/chromeos/dbus/fake_bluetooth_agent_manager_client.h index 57ecd50..315fd5e 100644 --- a/chromeos/dbus/fake_bluetooth_agent_manager_client.h +++ b/chromeos/dbus/fake_bluetooth_agent_manager_client.h @@ -9,8 +9,8 @@ #include "base/callback.h" #include "base/observer_list.h" #include "chromeos/chromeos_export.h" +#include "chromeos/dbus/bluetooth_agent_manager_client.h" #include "chromeos/dbus/dbus_client_implementation_type.h" -#include "chromeos/dbus/experimental_bluetooth_agent_manager_client.h" #include "dbus/object_path.h" #include "dbus/property.h" @@ -22,12 +22,12 @@ class FakeBluetoothAgentServiceProvider; // Daemon's agent manager object and is used both in test cases in place of a // mock and on the Linux desktop. class CHROMEOS_EXPORT FakeBluetoothAgentManagerClient - : public ExperimentalBluetoothAgentManagerClient { + : public BluetoothAgentManagerClient { public: FakeBluetoothAgentManagerClient(); virtual ~FakeBluetoothAgentManagerClient(); - // ExperimentalBluetoothAgentManagerClient override + // BluetoothAgentManagerClient override virtual void RegisterAgent(const dbus::ObjectPath& agent_path, const std::string& capability, const base::Closure& callback, diff --git a/chromeos/dbus/fake_bluetooth_agent_service_provider.cc b/chromeos/dbus/fake_bluetooth_agent_service_provider.cc index 16ba3c0..3948c3c 100644 --- a/chromeos/dbus/fake_bluetooth_agent_service_provider.cc +++ b/chromeos/dbus/fake_bluetooth_agent_service_provider.cc @@ -19,8 +19,7 @@ FakeBluetoothAgentServiceProvider::FakeBluetoothAgentServiceProvider( FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = static_cast<FakeBluetoothAgentManagerClient*>( - DBusThreadManager::Get()-> - GetExperimentalBluetoothAgentManagerClient()); + DBusThreadManager::Get()->GetBluetoothAgentManagerClient()); fake_bluetooth_agent_manager_client->RegisterAgentServiceProvider(this); } @@ -29,8 +28,7 @@ FakeBluetoothAgentServiceProvider::~FakeBluetoothAgentServiceProvider() { FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = static_cast<FakeBluetoothAgentManagerClient*>( - DBusThreadManager::Get()-> - GetExperimentalBluetoothAgentManagerClient()); + DBusThreadManager::Get()->GetBluetoothAgentManagerClient()); fake_bluetooth_agent_manager_client->UnregisterAgentServiceProvider(this); } diff --git a/chromeos/dbus/fake_bluetooth_agent_service_provider.h b/chromeos/dbus/fake_bluetooth_agent_service_provider.h index 9e931a5..82a401b 100644 --- a/chromeos/dbus/fake_bluetooth_agent_service_provider.h +++ b/chromeos/dbus/fake_bluetooth_agent_service_provider.h @@ -9,8 +9,8 @@ #include "base/callback.h" #include "base/observer_list.h" #include "chromeos/chromeos_export.h" +#include "chromeos/dbus/bluetooth_agent_service_provider.h" #include "chromeos/dbus/dbus_client_implementation_type.h" -#include "chromeos/dbus/experimental_bluetooth_agent_service_provider.h" #include "dbus/object_path.h" #include "dbus/property.h" @@ -22,7 +22,7 @@ class FakeBluetoothAgentManagerClient; // Bluetooth agent object and is used both in test cases in place of a // mock and on the Linux desktop. class CHROMEOS_EXPORT FakeBluetoothAgentServiceProvider - : public ExperimentalBluetoothAgentServiceProvider { + : public BluetoothAgentServiceProvider { public: FakeBluetoothAgentServiceProvider(const dbus::ObjectPath& object_path, Delegate *delegate); diff --git a/chromeos/dbus/fake_bluetooth_device_client.cc b/chromeos/dbus/fake_bluetooth_device_client.cc index 124cd73..ed37c2f 100644 --- a/chromeos/dbus/fake_bluetooth_device_client.cc +++ b/chromeos/dbus/fake_bluetooth_device_client.cc @@ -156,7 +156,7 @@ const uint32 FakeBluetoothDeviceClient::kUnpairableDeviceClass = 0x002540; FakeBluetoothDeviceClient::Properties::Properties( const PropertyChangedCallback& callback) - : ExperimentalBluetoothDeviceClient::Properties( + : BluetoothDeviceClient::Properties( NULL, bluetooth_device::kBluetoothDeviceInterface, callback) { @@ -304,8 +304,7 @@ void FakeBluetoothDeviceClient::ConnectProfile( FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = static_cast<FakeBluetoothProfileManagerClient*>( - DBusThreadManager::Get()-> - GetExperimentalBluetoothProfileManagerClient()); + DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); FakeBluetoothProfileServiceProvider* profile_service_provider = fake_bluetooth_profile_manager_client->GetProfileServiceProvider(uuid); if (profile_service_provider == NULL) { @@ -347,7 +346,7 @@ void FakeBluetoothDeviceClient::ConnectProfile( scoped_ptr<dbus::FileDescriptor> fd(new dbus::FileDescriptor(fds[1])); // Post the new connection to the service provider. - ExperimentalBluetoothProfileServiceProvider::Delegate::Options options; + BluetoothProfileServiceProvider::Delegate::Options options; profile_service_provider->NewConnection( object_path, @@ -369,8 +368,7 @@ void FakeBluetoothDeviceClient::DisconnectProfile( FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = static_cast<FakeBluetoothProfileManagerClient*>( - DBusThreadManager::Get()-> - GetExperimentalBluetoothProfileManagerClient()); + DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); FakeBluetoothProfileServiceProvider* profile_service_provider = fake_bluetooth_profile_manager_client->GetProfileServiceProvider(uuid); if (profile_service_provider == NULL) { @@ -404,8 +402,7 @@ void FakeBluetoothDeviceClient::Pair( FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = static_cast<FakeBluetoothAgentManagerClient*>( - DBusThreadManager::Get()-> - GetExperimentalBluetoothAgentManagerClient()); + DBusThreadManager::Get()->GetBluetoothAgentManagerClient()); FakeBluetoothAgentServiceProvider* agent_service_provider = fake_bluetooth_agent_manager_client->GetAgentServiceProvider(); if (agent_service_provider == NULL) { @@ -550,15 +547,14 @@ void FakeBluetoothDeviceClient::RemoveDevice( device_list_.erase(listiter); // Remove the Input interface if it exists. This should be called before the - // ExperimentalBluetoothDeviceClient::Observer::DeviceRemoved because it - // deletes the BluetoothDeviceExperimentalChromeOS object, including the - // device_path referenced here. + // BluetoothDeviceClient::Observer::DeviceRemoved because it deletes the + // BluetoothDeviceChromeOS object, including the device_path referenced here. FakeBluetoothInputClient* fake_bluetooth_input_client = static_cast<FakeBluetoothInputClient*>( - DBusThreadManager::Get()->GetExperimentalBluetoothInputClient()); + DBusThreadManager::Get()->GetBluetoothInputClient()); fake_bluetooth_input_client->RemoveInputDevice(device_path); - FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, DeviceRemoved(device_path)); delete properties; @@ -568,7 +564,7 @@ void FakeBluetoothDeviceClient::RemoveDevice( void FakeBluetoothDeviceClient::OnPropertyChanged( const dbus::ObjectPath& object_path, const std::string& property_name) { - FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, DevicePropertyChanged(object_path, property_name)); } @@ -599,7 +595,7 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { properties_map_[dbus::ObjectPath(kAppleMousePath)] = properties; device_list_.push_back(dbus::ObjectPath(kAppleMousePath)); - FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, DeviceAdded(dbus::ObjectPath(kAppleMousePath))); } @@ -623,7 +619,7 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { properties_map_[dbus::ObjectPath(kAppleKeyboardPath)] = properties; device_list_.push_back(dbus::ObjectPath(kAppleKeyboardPath)); - FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, DeviceAdded(dbus::ObjectPath(kAppleKeyboardPath))); } @@ -643,7 +639,7 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { properties_map_[dbus::ObjectPath(kVanishingDevicePath)] = properties; device_list_.push_back(dbus::ObjectPath(kVanishingDevicePath)); - FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, DeviceAdded(dbus::ObjectPath(kVanishingDevicePath))); } @@ -668,7 +664,7 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { properties_map_[dbus::ObjectPath(kMicrosoftMousePath)] = properties; device_list_.push_back(dbus::ObjectPath(kMicrosoftMousePath)); - FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, DeviceAdded(dbus::ObjectPath(kMicrosoftMousePath))); } @@ -693,7 +689,7 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { properties_map_[dbus::ObjectPath(kMotorolaKeyboardPath)] = properties; device_list_.push_back(dbus::ObjectPath(kMotorolaKeyboardPath)); - FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, DeviceAdded(dbus::ObjectPath(kMotorolaKeyboardPath))); } @@ -713,7 +709,7 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { properties_map_[dbus::ObjectPath(kSonyHeadphonesPath)] = properties; device_list_.push_back(dbus::ObjectPath(kSonyHeadphonesPath)); - FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, DeviceAdded(dbus::ObjectPath(kSonyHeadphonesPath))); } @@ -733,7 +729,7 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { properties_map_[dbus::ObjectPath(kPhonePath)] = properties; device_list_.push_back(dbus::ObjectPath(kPhonePath)); - FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, DeviceAdded(dbus::ObjectPath(kPhonePath))); } @@ -752,7 +748,7 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { properties_map_[dbus::ObjectPath(kWeirdDevicePath)] = properties; device_list_.push_back(dbus::ObjectPath(kWeirdDevicePath)); - FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, DeviceAdded(dbus::ObjectPath(kWeirdDevicePath))); } @@ -773,7 +769,7 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { properties_map_[dbus::ObjectPath(kUnconnectableDevicePath)] = properties; device_list_.push_back(dbus::ObjectPath(kUnconnectableDevicePath)); FOR_EACH_OBSERVER( - ExperimentalBluetoothDeviceClient::Observer, observers_, + BluetoothDeviceClient::Observer, observers_, DeviceAdded(dbus::ObjectPath(kUnconnectableDevicePath))); } @@ -793,9 +789,8 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { properties_map_[dbus::ObjectPath(kUnpairableDevicePath)] = properties; device_list_.push_back(dbus::ObjectPath(kUnpairableDevicePath)); - FOR_EACH_OBSERVER( - ExperimentalBluetoothDeviceClient::Observer, observers_, - DeviceAdded(dbus::ObjectPath(kUnpairableDevicePath))); + FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, + DeviceAdded(dbus::ObjectPath(kUnpairableDevicePath))); } } else if (discovery_simulation_step_ == 13) { @@ -878,7 +873,7 @@ void FakeBluetoothDeviceClient::AddInputDeviceIfNeeded( // simulate the Input interface. FakeBluetoothInputClient* fake_bluetooth_input_client = static_cast<FakeBluetoothInputClient*>( - DBusThreadManager::Get()->GetExperimentalBluetoothInputClient()); + DBusThreadManager::Get()->GetBluetoothInputClient()); if ((properties->bluetooth_class.value() & 0x001f03) == 0x000500) fake_bluetooth_input_client->AddInputDevice(object_path); @@ -888,11 +883,11 @@ void FakeBluetoothDeviceClient::PinCodeCallback( const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback, - ExperimentalBluetoothAgentServiceProvider::Delegate::Status status, + BluetoothAgentServiceProvider::Delegate::Status status, const std::string& pincode) { VLOG(1) << "PinCodeCallback: " << object_path.value(); - if (status == ExperimentalBluetoothAgentServiceProvider::Delegate::SUCCESS) { + if (status == BluetoothAgentServiceProvider::Delegate::SUCCESS) { base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing, @@ -900,8 +895,7 @@ void FakeBluetoothDeviceClient::PinCodeCallback( object_path, callback, error_callback), base::TimeDelta::FromMilliseconds(3 * simulation_interval_ms_)); - } else if (status == - ExperimentalBluetoothAgentServiceProvider::Delegate::CANCELLED) { + } else if (status == BluetoothAgentServiceProvider::Delegate::CANCELLED) { base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&FakeBluetoothDeviceClient::CancelSimulatedPairing, @@ -909,8 +903,7 @@ void FakeBluetoothDeviceClient::PinCodeCallback( object_path, error_callback), base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); - } else if (status == - ExperimentalBluetoothAgentServiceProvider::Delegate::REJECTED) { + } else if (status == BluetoothAgentServiceProvider::Delegate::REJECTED) { base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&FakeBluetoothDeviceClient::RejectSimulatedPairing, @@ -925,11 +918,11 @@ void FakeBluetoothDeviceClient::PasskeyCallback( const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback, - ExperimentalBluetoothAgentServiceProvider::Delegate::Status status, + BluetoothAgentServiceProvider::Delegate::Status status, uint32 passkey) { VLOG(1) << "PasskeyCallback: " << object_path.value(); - if (status == ExperimentalBluetoothAgentServiceProvider::Delegate::SUCCESS) { + if (status == BluetoothAgentServiceProvider::Delegate::SUCCESS) { base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing, @@ -937,8 +930,7 @@ void FakeBluetoothDeviceClient::PasskeyCallback( object_path, callback, error_callback), base::TimeDelta::FromMilliseconds(3 * simulation_interval_ms_)); - } else if (status == - ExperimentalBluetoothAgentServiceProvider::Delegate::CANCELLED) { + } else if (status == BluetoothAgentServiceProvider::Delegate::CANCELLED) { base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&FakeBluetoothDeviceClient::CancelSimulatedPairing, @@ -946,8 +938,7 @@ void FakeBluetoothDeviceClient::PasskeyCallback( object_path, error_callback), base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); - } else if (status == - ExperimentalBluetoothAgentServiceProvider::Delegate::REJECTED) { + } else if (status == BluetoothAgentServiceProvider::Delegate::REJECTED) { base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&FakeBluetoothDeviceClient::RejectSimulatedPairing, @@ -962,10 +953,10 @@ void FakeBluetoothDeviceClient::ConfirmationCallback( const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback, - ExperimentalBluetoothAgentServiceProvider::Delegate::Status status) { + BluetoothAgentServiceProvider::Delegate::Status status) { VLOG(1) << "ConfirmationCallback: " << object_path.value(); - if (status == ExperimentalBluetoothAgentServiceProvider::Delegate::SUCCESS) { + if (status == BluetoothAgentServiceProvider::Delegate::SUCCESS) { base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing, @@ -973,8 +964,7 @@ void FakeBluetoothDeviceClient::ConfirmationCallback( object_path, callback, error_callback), base::TimeDelta::FromMilliseconds(3 * simulation_interval_ms_)); - } else if (status == - ExperimentalBluetoothAgentServiceProvider::Delegate::CANCELLED) { + } else if (status == BluetoothAgentServiceProvider::Delegate::CANCELLED) { base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&FakeBluetoothDeviceClient::CancelSimulatedPairing, @@ -982,8 +972,7 @@ void FakeBluetoothDeviceClient::ConfirmationCallback( object_path, error_callback), base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); - } else if (status == - ExperimentalBluetoothAgentServiceProvider::Delegate::REJECTED) { + } else if (status == BluetoothAgentServiceProvider::Delegate::REJECTED) { base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&FakeBluetoothDeviceClient::RejectSimulatedPairing, @@ -1003,8 +992,7 @@ void FakeBluetoothDeviceClient::SimulateKeypress( FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = static_cast<FakeBluetoothAgentManagerClient*>( - DBusThreadManager::Get()-> - GetExperimentalBluetoothAgentManagerClient()); + DBusThreadManager::Get()->GetBluetoothAgentManagerClient()); FakeBluetoothAgentServiceProvider* agent_service_provider = fake_bluetooth_agent_manager_client->GetAgentServiceProvider(); agent_service_provider->DisplayPasskey(object_path, 123456, entered); @@ -1032,18 +1020,15 @@ void FakeBluetoothDeviceClient::ConnectionCallback( const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback, - ExperimentalBluetoothProfileServiceProvider::Delegate::Status status) { + BluetoothProfileServiceProvider::Delegate::Status status) { VLOG(1) << "ConnectionCallback: " << object_path.value(); - if (status == - ExperimentalBluetoothProfileServiceProvider::Delegate::SUCCESS) { + if (status == BluetoothProfileServiceProvider::Delegate::SUCCESS) { callback.Run(); - } else if (status == - ExperimentalBluetoothProfileServiceProvider::Delegate::CANCELLED) { + } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) { // TODO(keybuk): tear down this side of the connection error_callback.Run(bluetooth_device::kErrorFailed, "Canceled"); - } else if (status == - ExperimentalBluetoothProfileServiceProvider::Delegate::REJECTED) { + } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) { // TODO(keybuk): tear down this side of the connection error_callback.Run(bluetooth_device::kErrorFailed, "Rejected"); } @@ -1053,18 +1038,15 @@ void FakeBluetoothDeviceClient::DisconnectionCallback( const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback, - ExperimentalBluetoothProfileServiceProvider::Delegate::Status status) { + BluetoothProfileServiceProvider::Delegate::Status status) { VLOG(1) << "DisconnectionCallback: " << object_path.value(); - if (status == - ExperimentalBluetoothProfileServiceProvider::Delegate::SUCCESS) { + if (status == BluetoothProfileServiceProvider::Delegate::SUCCESS) { // TODO(keybuk): tear down this side of the connection callback.Run(); - } else if (status == - ExperimentalBluetoothProfileServiceProvider::Delegate::CANCELLED) { + } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) { error_callback.Run(bluetooth_device::kErrorFailed, "Canceled"); - } else if (status == - ExperimentalBluetoothProfileServiceProvider::Delegate::REJECTED) { + } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) { error_callback.Run(bluetooth_device::kErrorFailed, "Rejected"); } } diff --git a/chromeos/dbus/fake_bluetooth_device_client.h b/chromeos/dbus/fake_bluetooth_device_client.h index 6a90863..e5cfc51 100644 --- a/chromeos/dbus/fake_bluetooth_device_client.h +++ b/chromeos/dbus/fake_bluetooth_device_client.h @@ -12,10 +12,10 @@ #include "base/callback.h" #include "base/observer_list.h" #include "chromeos/chromeos_export.h" +#include "chromeos/dbus/bluetooth_agent_service_provider.h" +#include "chromeos/dbus/bluetooth_device_client.h" +#include "chromeos/dbus/bluetooth_profile_service_provider.h" #include "chromeos/dbus/dbus_client_implementation_type.h" -#include "chromeos/dbus/experimental_bluetooth_agent_service_provider.h" -#include "chromeos/dbus/experimental_bluetooth_device_client.h" -#include "chromeos/dbus/experimental_bluetooth_profile_service_provider.h" #include "dbus/object_path.h" #include "dbus/property.h" @@ -25,9 +25,9 @@ namespace chromeos { // device objects and is used both in test cases in place of a mock and on // the Linux desktop. class CHROMEOS_EXPORT FakeBluetoothDeviceClient - : public ExperimentalBluetoothDeviceClient { + : public BluetoothDeviceClient { public: - struct Properties : public ExperimentalBluetoothDeviceClient::Properties { + struct Properties : public BluetoothDeviceClient::Properties { explicit Properties(const PropertyChangedCallback & callback); virtual ~Properties(); @@ -42,7 +42,7 @@ class CHROMEOS_EXPORT FakeBluetoothDeviceClient FakeBluetoothDeviceClient(); virtual ~FakeBluetoothDeviceClient(); - // ExperimentalBluetoothDeviceClient override + // BluetoothDeviceClient override virtual void AddObserver(Observer* observer) OVERRIDE; virtual void RemoveObserver(Observer* observer) OVERRIDE; virtual std::vector<dbus::ObjectPath> GetDevicesForAdapter( @@ -168,19 +168,19 @@ class CHROMEOS_EXPORT FakeBluetoothDeviceClient const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback, - ExperimentalBluetoothAgentServiceProvider::Delegate::Status status, + BluetoothAgentServiceProvider::Delegate::Status status, const std::string& pincode); void PasskeyCallback( const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback, - ExperimentalBluetoothAgentServiceProvider::Delegate::Status status, + BluetoothAgentServiceProvider::Delegate::Status status, uint32 passkey); void ConfirmationCallback( const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback, - ExperimentalBluetoothAgentServiceProvider::Delegate::Status status); + BluetoothAgentServiceProvider::Delegate::Status status); void SimulateKeypress( uint16 entered, const dbus::ObjectPath& object_path, @@ -191,12 +191,12 @@ class CHROMEOS_EXPORT FakeBluetoothDeviceClient const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback, - ExperimentalBluetoothProfileServiceProvider::Delegate::Status status); + BluetoothProfileServiceProvider::Delegate::Status status); void DisconnectionCallback( const dbus::ObjectPath& object_path, const base::Closure& callback, const ErrorCallback& error_callback, - ExperimentalBluetoothProfileServiceProvider::Delegate::Status status); + BluetoothProfileServiceProvider::Delegate::Status status); // List of observers interested in event notifications from us. ObserverList<Observer> observers_; diff --git a/chromeos/dbus/fake_bluetooth_input_client.cc b/chromeos/dbus/fake_bluetooth_input_client.cc index bb3523e..717df07 100644 --- a/chromeos/dbus/fake_bluetooth_input_client.cc +++ b/chromeos/dbus/fake_bluetooth_input_client.cc @@ -20,7 +20,7 @@ namespace chromeos { FakeBluetoothInputClient::Properties::Properties( const PropertyChangedCallback& callback) - : ExperimentalBluetoothInputClient::Properties( + : BluetoothInputClient::Properties( NULL, bluetooth_input::kBluetoothInputInterface, callback) { @@ -95,7 +95,7 @@ void FakeBluetoothInputClient::AddInputDevice( properties_map_[object_path] = properties; - FOR_EACH_OBSERVER(ExperimentalBluetoothInputClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothInputClient::Observer, observers_, InputAdded(object_path)); } @@ -106,7 +106,7 @@ void FakeBluetoothInputClient::RemoveInputDevice( if (it == properties_map_.end()) return; - FOR_EACH_OBSERVER(ExperimentalBluetoothInputClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothInputClient::Observer, observers_, InputRemoved(object_path)); delete it->second; @@ -116,7 +116,7 @@ void FakeBluetoothInputClient::RemoveInputDevice( void FakeBluetoothInputClient::OnPropertyChanged( const dbus::ObjectPath& object_path, const std::string& property_name) { - FOR_EACH_OBSERVER(ExperimentalBluetoothInputClient::Observer, observers_, + FOR_EACH_OBSERVER(BluetoothInputClient::Observer, observers_, InputPropertyChanged(object_path, property_name)); } diff --git a/chromeos/dbus/fake_bluetooth_input_client.h b/chromeos/dbus/fake_bluetooth_input_client.h index 103e57d..8152668 100644 --- a/chromeos/dbus/fake_bluetooth_input_client.h +++ b/chromeos/dbus/fake_bluetooth_input_client.h @@ -8,8 +8,8 @@ #include "base/callback.h" #include "base/observer_list.h" #include "chromeos/chromeos_export.h" +#include "chromeos/dbus/bluetooth_input_client.h" #include "chromeos/dbus/dbus_client_implementation_type.h" -#include "chromeos/dbus/experimental_bluetooth_input_client.h" #include "dbus/object_path.h" #include "dbus/property.h" @@ -19,9 +19,9 @@ namespace chromeos { // input device objects and is used both in test cases in place of a mock and on // the Linux desktop. class CHROMEOS_EXPORT FakeBluetoothInputClient - : public ExperimentalBluetoothInputClient { + : public BluetoothInputClient { public: - struct Properties : public ExperimentalBluetoothInputClient::Properties { + struct Properties : public BluetoothInputClient::Properties { explicit Properties(const PropertyChangedCallback & callback); virtual ~Properties(); @@ -36,7 +36,7 @@ class CHROMEOS_EXPORT FakeBluetoothInputClient FakeBluetoothInputClient(); virtual ~FakeBluetoothInputClient(); - // ExperimentalBluetoothInputClient override + // BluetoothInputClient override virtual void AddObserver(Observer* observer) OVERRIDE; virtual void RemoveObserver(Observer* observer) OVERRIDE; virtual Properties* GetProperties(const dbus::ObjectPath& object_path) diff --git a/chromeos/dbus/fake_bluetooth_profile_manager_client.h b/chromeos/dbus/fake_bluetooth_profile_manager_client.h index bba6732..8bfeaaf 100644 --- a/chromeos/dbus/fake_bluetooth_profile_manager_client.h +++ b/chromeos/dbus/fake_bluetooth_profile_manager_client.h @@ -12,8 +12,8 @@ #include "base/callback.h" #include "base/observer_list.h" #include "chromeos/chromeos_export.h" +#include "chromeos/dbus/bluetooth_profile_manager_client.h" #include "chromeos/dbus/dbus_client_implementation_type.h" -#include "chromeos/dbus/experimental_bluetooth_profile_manager_client.h" #include "dbus/object_path.h" #include "dbus/property.h" @@ -25,12 +25,12 @@ class FakeBluetoothProfileServiceProvider; // Daemon's profile manager object and is used both in test cases in place of a // mock and on the Linux desktop. class CHROMEOS_EXPORT FakeBluetoothProfileManagerClient - : public ExperimentalBluetoothProfileManagerClient { + : public BluetoothProfileManagerClient { public: FakeBluetoothProfileManagerClient(); virtual ~FakeBluetoothProfileManagerClient(); - // ExperimentalBluetoothProfileManagerClient override + // BluetoothProfileManagerClient override virtual void RegisterProfile(const dbus::ObjectPath& profile_path, const std::string& uuid, const Options& options, diff --git a/chromeos/dbus/fake_bluetooth_profile_service_provider.cc b/chromeos/dbus/fake_bluetooth_profile_service_provider.cc index a021464..d07e825 100644 --- a/chromeos/dbus/fake_bluetooth_profile_service_provider.cc +++ b/chromeos/dbus/fake_bluetooth_profile_service_provider.cc @@ -19,8 +19,7 @@ FakeBluetoothProfileServiceProvider::FakeBluetoothProfileServiceProvider( FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = static_cast<FakeBluetoothProfileManagerClient*>( - DBusThreadManager::Get()-> - GetExperimentalBluetoothProfileManagerClient()); + DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); fake_bluetooth_profile_manager_client->RegisterProfileServiceProvider(this); } @@ -29,8 +28,7 @@ FakeBluetoothProfileServiceProvider::~FakeBluetoothProfileServiceProvider() { FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = static_cast<FakeBluetoothProfileManagerClient*>( - DBusThreadManager::Get()-> - GetExperimentalBluetoothProfileManagerClient()); + DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); fake_bluetooth_profile_manager_client->UnregisterProfileServiceProvider(this); } diff --git a/chromeos/dbus/fake_bluetooth_profile_service_provider.h b/chromeos/dbus/fake_bluetooth_profile_service_provider.h index c886f71..14ffd25 100644 --- a/chromeos/dbus/fake_bluetooth_profile_service_provider.h +++ b/chromeos/dbus/fake_bluetooth_profile_service_provider.h @@ -9,8 +9,8 @@ #include "base/callback.h" #include "base/memory/scoped_ptr.h" #include "chromeos/chromeos_export.h" +#include "chromeos/dbus/bluetooth_profile_service_provider.h" #include "chromeos/dbus/dbus_client_implementation_type.h" -#include "chromeos/dbus/experimental_bluetooth_profile_service_provider.h" #include "dbus/file_descriptor.h" #include "dbus/object_path.h" @@ -20,7 +20,7 @@ namespace chromeos { // Bluetooth agent object and is used both in test cases in place of a // mock and on the Linux desktop. class CHROMEOS_EXPORT FakeBluetoothProfileServiceProvider - : public ExperimentalBluetoothProfileServiceProvider { + : public BluetoothProfileServiceProvider { public: FakeBluetoothProfileServiceProvider(const dbus::ObjectPath& object_path, Delegate *delegate); diff --git a/chromeos/dbus/mock_dbus_thread_manager.cc b/chromeos/dbus/mock_dbus_thread_manager.cc index 2265a08..6245e46 100644 --- a/chromeos/dbus/mock_dbus_thread_manager.cc +++ b/chromeos/dbus/mock_dbus_thread_manager.cc @@ -67,15 +67,15 @@ MockDBusThreadManager::MockDBusThreadManager() mock_session_manager_client_(new MockSessionManagerClient) { EXPECT_CALL(*this, GetCryptohomeClient()) .WillRepeatedly(Return(mock_cryptohome_client())); - EXPECT_CALL(*this, GetExperimentalBluetoothAdapterClient()) + EXPECT_CALL(*this, GetBluetoothAdapterClient()) .WillRepeatedly(Return(fake_bluetooth_adapter_client_.get())); - EXPECT_CALL(*this, GetExperimentalBluetoothAgentManagerClient()) + EXPECT_CALL(*this, GetBluetoothAgentManagerClient()) .WillRepeatedly(Return(fake_bluetooth_agent_manager_client())); - EXPECT_CALL(*this, GetExperimentalBluetoothDeviceClient()) + EXPECT_CALL(*this, GetBluetoothDeviceClient()) .WillRepeatedly(Return(fake_bluetooth_device_client_.get())); - EXPECT_CALL(*this, GetExperimentalBluetoothInputClient()) + EXPECT_CALL(*this, GetBluetoothInputClient()) .WillRepeatedly(Return(fake_bluetooth_input_client_.get())); - EXPECT_CALL(*this, GetExperimentalBluetoothProfileManagerClient()) + EXPECT_CALL(*this, GetBluetoothProfileManagerClient()) .WillRepeatedly(Return(fake_bluetooth_profile_manager_client())); EXPECT_CALL(*this, GetShillDeviceClient()) .WillRepeatedly(Return(mock_shill_device_client())); diff --git a/chromeos/dbus/mock_dbus_thread_manager.h b/chromeos/dbus/mock_dbus_thread_manager.h index 33cb2f1..60f61ee 100644 --- a/chromeos/dbus/mock_dbus_thread_manager.h +++ b/chromeos/dbus/mock_dbus_thread_manager.h @@ -51,20 +51,17 @@ class MockDBusThreadManager : public DBusThreadManager { const base::Closure& closure)); MOCK_METHOD0(GetSystemBus, dbus::Bus*(void)); MOCK_METHOD0(GetIBusBus, dbus::Bus*(void)); + MOCK_METHOD0(GetBluetoothAdapterClient, BluetoothAdapterClient*(void)); + MOCK_METHOD0(GetBluetoothAgentManagerClient, + BluetoothAgentManagerClient*(void)); + MOCK_METHOD0(GetBluetoothDeviceClient, BluetoothDeviceClient*(void)); + MOCK_METHOD0(GetBluetoothInputClient, BluetoothInputClient*(void)); + MOCK_METHOD0(GetBluetoothProfileManagerClient, + BluetoothProfileManagerClient*(void)); MOCK_METHOD0(GetCrasAudioClient, CrasAudioClient*(void)); MOCK_METHOD0(GetCrosDisksClient, CrosDisksClient*(void)); MOCK_METHOD0(GetCryptohomeClient, CryptohomeClient*(void)); MOCK_METHOD0(GetDebugDaemonClient, DebugDaemonClient*(void)); - MOCK_METHOD0(GetExperimentalBluetoothAdapterClient, - ExperimentalBluetoothAdapterClient*(void)); - MOCK_METHOD0(GetExperimentalBluetoothAgentManagerClient, - ExperimentalBluetoothAgentManagerClient*(void)); - MOCK_METHOD0(GetExperimentalBluetoothDeviceClient, - ExperimentalBluetoothDeviceClient*(void)); - MOCK_METHOD0(GetExperimentalBluetoothInputClient, - ExperimentalBluetoothInputClient*(void)); - MOCK_METHOD0(GetExperimentalBluetoothProfileManagerClient, - ExperimentalBluetoothProfileManagerClient*(void)); MOCK_METHOD0(GetShillDeviceClient, ShillDeviceClient*(void)); MOCK_METHOD0(GetShillIPConfigClient, ShillIPConfigClient*(void)); MOCK_METHOD0(GetShillManagerClient, ShillManagerClient*(void)); diff --git a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc index 6d38aca..c35fd25 100644 --- a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc +++ b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc @@ -88,48 +88,46 @@ dbus::Bus* MockDBusThreadManagerWithoutGMock::GetIBusBus() { return ibus_bus_; } -CrasAudioClient* MockDBusThreadManagerWithoutGMock::GetCrasAudioClient() { - return NULL; +BluetoothAdapterClient* + MockDBusThreadManagerWithoutGMock::GetBluetoothAdapterClient() { + return fake_bluetooth_adapter_client_.get(); } -CrosDisksClient* MockDBusThreadManagerWithoutGMock::GetCrosDisksClient() { - return fake_cros_disks_client_.get(); +BluetoothAgentManagerClient* + MockDBusThreadManagerWithoutGMock::GetBluetoothAgentManagerClient() { + return fake_bluetooth_agent_manager_client_.get(); } -CryptohomeClient* MockDBusThreadManagerWithoutGMock::GetCryptohomeClient() { - return fake_cryptohome_client_.get(); +BluetoothDeviceClient* + MockDBusThreadManagerWithoutGMock::GetBluetoothDeviceClient() { + return fake_bluetooth_device_client_.get(); } -DebugDaemonClient* MockDBusThreadManagerWithoutGMock::GetDebugDaemonClient() { - NOTIMPLEMENTED(); - return NULL; +BluetoothInputClient* + MockDBusThreadManagerWithoutGMock::GetBluetoothInputClient() { + return fake_bluetooth_input_client_.get(); } -ExperimentalBluetoothAdapterClient* - MockDBusThreadManagerWithoutGMock::GetExperimentalBluetoothAdapterClient() { - return fake_bluetooth_adapter_client_.get(); +BluetoothProfileManagerClient* + MockDBusThreadManagerWithoutGMock::GetBluetoothProfileManagerClient() { + return fake_bluetooth_profile_manager_client_.get(); } -ExperimentalBluetoothAgentManagerClient* - MockDBusThreadManagerWithoutGMock:: - GetExperimentalBluetoothAgentManagerClient() { - return fake_bluetooth_agent_manager_client_.get(); +CrasAudioClient* MockDBusThreadManagerWithoutGMock::GetCrasAudioClient() { + return NULL; } -ExperimentalBluetoothDeviceClient* - MockDBusThreadManagerWithoutGMock::GetExperimentalBluetoothDeviceClient() { - return fake_bluetooth_device_client_.get(); +CrosDisksClient* MockDBusThreadManagerWithoutGMock::GetCrosDisksClient() { + return fake_cros_disks_client_.get(); } -ExperimentalBluetoothInputClient* - MockDBusThreadManagerWithoutGMock::GetExperimentalBluetoothInputClient() { - return fake_bluetooth_input_client_.get(); +CryptohomeClient* MockDBusThreadManagerWithoutGMock::GetCryptohomeClient() { + return fake_cryptohome_client_.get(); } -ExperimentalBluetoothProfileManagerClient* - MockDBusThreadManagerWithoutGMock:: - GetExperimentalBluetoothProfileManagerClient() { - return fake_bluetooth_profile_manager_client_.get(); +DebugDaemonClient* MockDBusThreadManagerWithoutGMock::GetDebugDaemonClient() { + NOTIMPLEMENTED(); + return NULL; } ShillDeviceClient* diff --git a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h index 3810cea..c57cd35 100644 --- a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h +++ b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h @@ -57,20 +57,17 @@ class MockDBusThreadManagerWithoutGMock : public DBusThreadManager { virtual dbus::Bus* GetSystemBus() OVERRIDE; virtual dbus::Bus* GetIBusBus() OVERRIDE; + virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE; + virtual BluetoothAgentManagerClient* + GetBluetoothAgentManagerClient() OVERRIDE; + virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE; + virtual BluetoothInputClient* GetBluetoothInputClient() OVERRIDE; + virtual BluetoothProfileManagerClient* + GetBluetoothProfileManagerClient() OVERRIDE; virtual CrasAudioClient* GetCrasAudioClient() OVERRIDE; virtual CrosDisksClient* GetCrosDisksClient() OVERRIDE; virtual CryptohomeClient* GetCryptohomeClient() OVERRIDE; virtual DebugDaemonClient* GetDebugDaemonClient() OVERRIDE; - virtual ExperimentalBluetoothAdapterClient* - GetExperimentalBluetoothAdapterClient() OVERRIDE; - virtual ExperimentalBluetoothAgentManagerClient* - GetExperimentalBluetoothAgentManagerClient() OVERRIDE; - virtual ExperimentalBluetoothDeviceClient* - GetExperimentalBluetoothDeviceClient() OVERRIDE; - virtual ExperimentalBluetoothInputClient* - GetExperimentalBluetoothInputClient() OVERRIDE; - virtual ExperimentalBluetoothProfileManagerClient* - GetExperimentalBluetoothProfileManagerClient() OVERRIDE; virtual ShillDeviceClient* GetShillDeviceClient() OVERRIDE; virtual ShillIPConfigClient* GetShillIPConfigClient() OVERRIDE; virtual ShillManagerClient* GetShillManagerClient() OVERRIDE; @@ -186,7 +183,6 @@ class MockDBusThreadManagerWithoutGMock : public DBusThreadManager { // their c'tors. ObserverList<DBusThreadManagerObserver> observers_; - // These fake_bluetooth_*_client_ are for ExperimentalBluetooth*Client. scoped_ptr<FakeBluetoothAdapterClient> fake_bluetooth_adapter_client_; scoped_ptr<FakeBluetoothAgentManagerClient> fake_bluetooth_agent_manager_client_; 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', |