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

Side by Side Diff: device/bluetooth/bluetooth_profile_mac.mm

Issue 14487002: Bluetooth: Profile support for Chrome OS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Transfer out ownership of fd. Fix socket code Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/bluetooth_profile_mac.h" 5 #include "device/bluetooth/bluetooth_profile_mac.h"
6 6
7 #import <IOBluetooth/objc/IOBluetoothDevice.h> 7 #import <IOBluetooth/objc/IOBluetoothDevice.h>
8 #import <IOBluetooth/objc/IOBluetoothSDPServiceRecord.h> 8 #import <IOBluetooth/objc/IOBluetoothSDPServiceRecord.h>
9 #import <IOBluetooth/objc/IOBluetoothSDPUUID.h> 9 #import <IOBluetooth/objc/IOBluetoothSDPUUID.h>
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 BluetoothProfileMac::~BluetoothProfileMac() { 54 BluetoothProfileMac::~BluetoothProfileMac() {
55 } 55 }
56 56
57 void BluetoothProfileMac::Unregister() { 57 void BluetoothProfileMac::Unregister() {
58 delete this; 58 delete this;
59 } 59 }
60 60
61 void BluetoothProfileMac::SetConnectionCallback( 61 void BluetoothProfileMac::SetConnectionCallback(
62 const SocketCallback& callback) { 62 const ConnectionCallback& callback) {
63 socket_callback_ = callback; 63 connection_callback_ = callback;
64 } 64 }
65 65
66 bool BluetoothProfileMac::Connect(IOBluetoothDevice* device) { 66 bool BluetoothProfileMac::Connect(IOBluetoothDevice* device) {
67 IOBluetoothSDPServiceRecord* record = 67 IOBluetoothSDPServiceRecord* record =
68 [device getServiceRecordForUUID:GetIOBluetoothSDPUUID(uuid_)]; 68 [device getServiceRecordForUUID:GetIOBluetoothSDPUUID(uuid_)];
69 if (record != nil) { 69 if (record != nil) {
70 scoped_refptr<BluetoothSocket> socket( 70 scoped_refptr<BluetoothSocket> socket(
71 BluetoothSocketMac::CreateBluetoothSocket(record)); 71 BluetoothSocketMac::CreateBluetoothSocket(record));
72 if (socket.get() != NULL) { 72 if (socket.get() != NULL) {
73 socket_callback_.Run(socket); 73 BluetoothDeviceMac device_mac(device);
74 connection_callback_.Run(&device_mac, socket);
74 return true; 75 return true;
75 } 76 }
76 } 77 }
77 return false; 78 return false;
78 } 79 }
79 80
80 } // namespace device 81 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698