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

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

Issue 224763003: Revert 261566 "device/bluetooth: Rename device::bluetooth_utils:..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 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 28 matching lines...) Expand all
39 DCHECK(uuid_bytes_vector.size() == 16); 39 DCHECK(uuid_bytes_vector.size() == 16);
40 40
41 return [IOBluetoothSDPUUID uuidWithBytes:&uuid_bytes_vector[0] 41 return [IOBluetoothSDPUUID uuidWithBytes:&uuid_bytes_vector[0]
42 length:uuid_bytes_vector.size()]; 42 length:uuid_bytes_vector.size()];
43 } 43 }
44 44
45 } // namespace 45 } // namespace
46 46
47 namespace device { 47 namespace device {
48 48
49 BluetoothProfileMac::BluetoothProfileMac(const BluetoothUUID& uuid, 49 BluetoothProfileMac::BluetoothProfileMac(const std::string& uuid,
50 const std::string& name) 50 const std::string& name)
51 : BluetoothProfile(), uuid_(uuid), name_(name) { 51 : BluetoothProfile(), uuid_(uuid), name_(name) {
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 ConnectionCallback& callback) { 62 const ConnectionCallback& callback) {
63 connection_callback_ = callback; 63 connection_callback_ = callback;
64 } 64 }
65 65
66 bool BluetoothProfileMac::Connect(IOBluetoothDevice* device) { 66 bool BluetoothProfileMac::Connect(IOBluetoothDevice* device) {
67 if (connection_callback_.is_null()) 67 if (connection_callback_.is_null())
68 return false; 68 return false;
69 69
70 IOBluetoothSDPServiceRecord* record = 70 IOBluetoothSDPServiceRecord* record =
71 [device getServiceRecordForUUID:GetIOBluetoothSDPUUID( 71 [device getServiceRecordForUUID:GetIOBluetoothSDPUUID(uuid_)];
72 uuid_.canonical_value())];
73 if (record != nil) { 72 if (record != nil) {
74 scoped_refptr<BluetoothSocket> socket( 73 scoped_refptr<BluetoothSocket> socket(
75 BluetoothSocketMac::CreateBluetoothSocket(record)); 74 BluetoothSocketMac::CreateBluetoothSocket(record));
76 if (socket.get() != NULL) { 75 if (socket.get() != NULL) {
77 BluetoothDeviceMac device_mac(device); 76 BluetoothDeviceMac device_mac(device);
78 connection_callback_.Run(&device_mac, socket); 77 connection_callback_.Run(&device_mac, socket);
79 return true; 78 return true;
80 } 79 }
81 } 80 }
82 return false; 81 return false;
83 } 82 }
84 83
85 } // namespace device 84 } // namespace device
OLDNEW
« no previous file with comments | « trunk/src/device/bluetooth/bluetooth_profile_mac.h ('k') | trunk/src/device/bluetooth/bluetooth_profile_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698