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

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: Fix ChromeOS Full build. Created 6 years, 8 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
« no previous file with comments | « device/bluetooth/bluetooth_device_win.h ('k') | device/bluetooth/bluetooth_device_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_device_win.cc
diff --git a/device/bluetooth/bluetooth_device_win.cc b/device/bluetooth/bluetooth_device_win.cc
index 312f0e5d66b43dec27918d89e0ec9ff99dd43689..1834096822142cffea453750c694e8f2429f112a 100644
--- a/device/bluetooth/bluetooth_device_win.cc
+++ b/device/bluetooth/bluetooth_device_win.cc
@@ -9,10 +9,12 @@
#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"
#include "device/bluetooth/bluetooth_service_record_win.h"
+#include "device/bluetooth/bluetooth_socket_thread_win.h"
#include "device/bluetooth/bluetooth_socket_win.h"
#include "device/bluetooth/bluetooth_task_manager_win.h"
@@ -25,8 +27,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<BluetoothSocketThreadWin> socket_thread,
+ net::NetLog* net_log,
+ const net::NetLog::Source& net_log_source)
+ : BluetoothDevice(),
+ ui_task_runner_(ui_task_runner),
+ socket_thread_(socket_thread),
+ net_log_(net_log),
+ net_log_source_(net_log_source) {
name_ = state.name;
address_ = state.address;
bluetooth_class_ = state.bluetooth_class;
@@ -163,29 +173,21 @@ void BluetoothDeviceWin::Forget(const ErrorCallback& error_callback) {
void BluetoothDeviceWin::ConnectToService(
const device::BluetoothUUID& 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();
+ const ConnectToProfileErrorCallback& error_callback) {
+ DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
+ static_cast<BluetoothProfileWin*>(profile)->Connect(this,
+ ui_task_runner_,
+ socket_thread_,
+ net_log_,
+ net_log_source_,
+ callback,
+ error_callback);
}
void BluetoothDeviceWin::SetOutOfBandPairingData(
« no previous file with comments | « device/bluetooth/bluetooth_device_win.h ('k') | device/bluetooth/bluetooth_device_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698