1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "device/bluetooth/bluetooth_profile_win.h"
7 #include "base/memory/ref_counted.h"
8 #include "device/bluetooth/bluetooth_device_win.h"
9 #include "device/bluetooth/bluetooth_service_record.h"
10 #include "device/bluetooth/bluetooth_socket_win.h"
14 BluetoothProfileWin::BluetoothProfileWin(const std::string& uuid,
15 const std::string& name)
16 : BluetoothProfile(), uuid_(uuid), name_(name) {
19 BluetoothProfileWin::~BluetoothProfileWin() {
22 void BluetoothProfileWin::Unregister() {
26 void BluetoothProfileWin::SetConnectionCallback(
27 const ConnectionCallback& callback) {
28 connection_callback_ = callback;
31 bool BluetoothProfileWin::Connect(const BluetoothDeviceWin* device) {
32 if (connection_callback_.is_null())
35 const BluetoothServiceRecord* record = device->GetServiceRecord(uuid_);
37 scoped_refptr<BluetoothSocket> socket(
38 BluetoothSocketWin::CreateBluetoothSocket(*record));
39 if (socket.get() != NULL) {
40 connection_callback_.Run(device, socket);