Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2425)

Unified Diff: device/bluetooth/bluetooth_device_win.cc

Issue 180163009: chrome.bluetooth API improvements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address code review feedback. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_device_win.cc
diff --git a/device/bluetooth/bluetooth_device_win.cc b/device/bluetooth/bluetooth_device_win.cc
index 3f95efd9b1d87e3713a63a79b81b839a3298ef24..7afe0f0d658e79a3ae01c05f95443190c72cc217 100644
--- a/device/bluetooth/bluetooth_device_win.cc
+++ b/device/bluetooth/bluetooth_device_win.cc
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/memory/scoped_vector.h"
+#include "base/sequenced_task_runner.h"
#include "base/strings/stringprintf.h"
#include "device/bluetooth/bluetooth_out_of_band_pairing_data.h"
#include "device/bluetooth/bluetooth_profile_win.h"
@@ -25,8 +26,16 @@ const int kSdpBytesBufferSize = 1024;
namespace device {
BluetoothDeviceWin::BluetoothDeviceWin(
- const BluetoothTaskManagerWin::DeviceState& state)
- : BluetoothDevice() {
+ const BluetoothTaskManagerWin::DeviceState& state,
+ scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
+ scoped_refptr<base::SequencedTaskRunner> file_task_runner,
+ net::NetLog* net_log,
+ const net::NetLog::Source& net_log_source)
+ : BluetoothDevice(),
+ ui_task_runner_(ui_task_runner),
+ file_task_runner_(file_task_runner),
+ net_log_(net_log),
+ net_log_source_(net_log_source) {
name_ = state.name;
address_ = state.address;
bluetooth_class_ = state.bluetooth_class;
@@ -183,29 +192,21 @@ void BluetoothDeviceWin::Forget(const ErrorCallback& error_callback) {
void BluetoothDeviceWin::ConnectToService(
const std::string& service_uuid,
const SocketCallback& callback) {
- for (ServiceRecordList::const_iterator iter = service_record_list_.begin();
- iter != service_record_list_.end();
- ++iter) {
- if ((*iter)->uuid() == service_uuid) {
- // If multiple service records are found, use the first one that works.
- scoped_refptr<BluetoothSocket> socket(
- BluetoothSocketWin::CreateBluetoothSocket(**iter));
- if (socket.get() != NULL) {
- callback.Run(socket);
- return;
- }
- }
- }
+ NOTIMPLEMENTED();
}
void BluetoothDeviceWin::ConnectToProfile(
device::BluetoothProfile* profile,
const base::Closure& callback,
const ErrorCallback& error_callback) {
- if (static_cast<BluetoothProfileWin*>(profile)->Connect(this))
- callback.Run();
- else
- error_callback.Run();
+ DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
+ static_cast<BluetoothProfileWin*>(profile)->Connect(this,
+ ui_task_runner_,
+ file_task_runner_,
+ net_log_,
+ net_log_source_,
+ callback,
+ error_callback);
}
void BluetoothDeviceWin::SetOutOfBandPairingData(

Powered by Google App Engine
This is Rietveld 408576698