Chromium Code Reviews| Index: chrome/browser/extensions/api/bluetooth/bluetooth_api.cc |
| diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc |
| index aead116047df8ec1a6a75498d9b21ef9c5e913b1..fa7508051286218b9501088605b756e73df5b6ca 100644 |
| --- a/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc |
| +++ b/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc |
| @@ -19,12 +19,14 @@ |
| #if defined(OS_CHROMEOS) |
| #include "base/memory/ref_counted.h" |
| #include "base/safe_strerror_posix.h" |
| -#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" |
| -#include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" |
| -#include "chrome/browser/chromeos/bluetooth/bluetooth_socket.h" |
| +#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter_interface.h" |
|
bryeung
2012/09/07 18:35:57
As a warning: once the interfaces move out of the
youngki
2012/09/13 18:05:02
Acknowledged.
|
| +#include "chrome/browser/chromeos/bluetooth/bluetooth_device_interface.h" |
| +#include "chrome/browser/chromeos/bluetooth/bluetooth_service_record_interface.h" |
| +#include "chrome/browser/chromeos/bluetooth/bluetooth_socket_posix.h" |
| #include "chrome/browser/chromeos/bluetooth/bluetooth_utils.h" |
| #include "chrome/browser/chromeos/extensions/bluetooth_event_router.h" |
| #include "chromeos/dbus/bluetooth_out_of_band_client.h" |
| +#include "chromeos/dbus/bluetooth_out_of_band_pairing_data.h" |
| namespace { |
| @@ -32,12 +34,12 @@ chromeos::ExtensionBluetoothEventRouter* GetEventRouter(Profile* profile) { |
| return profile->GetExtensionService()->bluetooth_event_router(); |
| } |
| -const chromeos::BluetoothAdapter& GetAdapter(Profile* profile) { |
| +const chromeos::BluetoothAdapterInterface& GetAdapter(Profile* profile) { |
| return GetEventRouter(profile)->adapter(); |
| } |
| -chromeos::BluetoothAdapter* GetMutableAdapter(Profile* profile) { |
| - chromeos::BluetoothAdapter* adapter = |
| +chromeos::BluetoothAdapterInterface* GetMutableAdapter(Profile* profile) { |
| + chromeos::BluetoothAdapterInterface* adapter = |
| GetEventRouter(profile)->GetMutableAdapter(); |
| CHECK(adapter); |
| return adapter; |
| @@ -101,7 +103,7 @@ BluetoothGetDevicesFunction::BluetoothGetDevicesFunction() |
| void BluetoothGetDevicesFunction::AddDeviceIfTrueCallback( |
| ListValue* list, |
| - const chromeos::BluetoothDevice* device, |
| + const chromeos::BluetoothDeviceInterface* device, |
| bool shouldAdd) { |
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| @@ -134,11 +136,12 @@ bool BluetoothGetDevicesFunction::RunImpl() { |
| CHECK_EQ(0, callbacks_pending_); |
| - chromeos::BluetoothAdapter::DeviceList devices = |
| + chromeos::BluetoothAdapterInterface::DeviceList devices = |
| GetMutableAdapter(profile())->GetDevices(); |
| - for (chromeos::BluetoothAdapter::DeviceList::iterator i = devices.begin(); |
| - i != devices.end(); ++i) { |
| - chromeos::BluetoothDevice* device = *i; |
| + for (chromeos::BluetoothAdapterInterface::DeviceList::iterator i = |
| + devices.begin(); |
| + i != devices.end(); ++i) { |
| + chromeos::BluetoothDeviceInterface* device = *i; |
| if (!uuid.empty() && !(device->ProvidesServiceWithUUID(uuid))) |
| continue; |
| @@ -169,10 +172,10 @@ bool BluetoothGetDevicesFunction::RunImpl() { |
| void BluetoothGetServicesFunction::GetServiceRecordsCallback( |
| base::ListValue* services, |
| - const chromeos::BluetoothDevice::ServiceRecordList& records) { |
| - for (chromeos::BluetoothDevice::ServiceRecordList::const_iterator i = |
| + const chromeos::BluetoothDeviceInterface::ServiceRecordList& records) { |
| + for (chromeos::BluetoothDeviceInterface::ServiceRecordList::const_iterator i = |
| records.begin(); i != records.end(); ++i) { |
| - const chromeos::BluetoothServiceRecord& record = **i; |
| + const chromeos::BluetoothServiceRecordInterface& record = **i; |
| experimental_bluetooth::ServiceRecord api_record; |
| api_record.name = record.name(); |
| if (!record.uuid().empty()) |
| @@ -193,7 +196,7 @@ bool BluetoothGetServicesFunction::RunImpl() { |
| EXTENSION_FUNCTION_VALIDATE(params.get() != NULL); |
| const experimental_bluetooth::GetServicesOptions& options = params->options; |
| - chromeos::BluetoothDevice* device = |
| + chromeos::BluetoothDeviceInterface* device = |
| GetMutableAdapter(profile())->GetDevice(options.device_address); |
| if (!device) { |
| SetError(kInvalidDevice); |
| @@ -214,9 +217,9 @@ bool BluetoothGetServicesFunction::RunImpl() { |
| } |
| void BluetoothConnectFunction::ConnectToServiceCallback( |
| - const chromeos::BluetoothDevice* device, |
| + const chromeos::BluetoothDeviceInterface* device, |
| const std::string& service_uuid, |
| - scoped_refptr<chromeos::BluetoothSocket> socket) { |
| + scoped_refptr<chromeos::BluetoothSocketPosix> socket) { |
| if (socket.get()) { |
| int socket_id = GetEventRouter(profile())->RegisterSocket(socket); |
| @@ -245,7 +248,7 @@ bool BluetoothConnectFunction::RunImpl() { |
| return false; |
| } |
| - chromeos::BluetoothDevice* device = |
| + chromeos::BluetoothDeviceInterface* device = |
| GetMutableAdapter(profile())->GetDevice(options.device_address); |
| if (!device) { |
| SetError(kInvalidDevice); |
| @@ -386,7 +389,7 @@ bool BluetoothSetOutOfBandPairingDataFunction::RunImpl() { |
| std::string address; |
| EXTENSION_FUNCTION_VALIDATE(options->GetString("deviceAddress", &address)); |
| - chromeos::BluetoothDevice* device = |
| + chromeos::BluetoothDeviceInterface* device = |
| GetMutableAdapter(profile())->GetDevice(address); |
| if (!device) { |
| SetError(kInvalidDevice); |