OLD | NEW |
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_adapter_mac.h" | 5 #include "device/bluetooth/bluetooth_adapter_mac.h" |
6 | 6 |
7 #import <IOBluetooth/objc/IOBluetoothDevice.h> | 7 #import <IOBluetooth/objc/IOBluetoothDevice.h> |
8 #import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h> | 8 #import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h> |
9 #import <IOBluetooth/objc/IOBluetoothHostController.h> | 9 #import <IOBluetooth/objc/IOBluetoothHostController.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
16 #include "base/location.h" | 16 #include "base/location.h" |
| 17 #include "base/mac/sdk_forward_declarations.h" |
17 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
18 #include "base/sequenced_task_runner.h" | 19 #include "base/sequenced_task_runner.h" |
19 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
20 #include "base/strings/sys_string_conversions.h" | 21 #include "base/strings/sys_string_conversions.h" |
21 #include "base/thread_task_runner_handle.h" | 22 #include "base/thread_task_runner_handle.h" |
22 #include "base/time/time.h" | 23 #include "base/time/time.h" |
23 #include "device/bluetooth/bluetooth_device_mac.h" | 24 #include "device/bluetooth/bluetooth_device_mac.h" |
24 #include "device/bluetooth/bluetooth_socket_mac.h" | 25 #include "device/bluetooth/bluetooth_socket_mac.h" |
25 #include "device/bluetooth/bluetooth_uuid.h" | 26 #include "device/bluetooth/bluetooth_uuid.h" |
26 | 27 |
27 // Replicate specific 10.7 SDK declarations for building with prior SDKs. | |
28 #if !defined(MAC_OS_X_VERSION_10_7) || \ | |
29 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | |
30 | |
31 @interface IOBluetoothHostController (LionSDKDeclarations) | |
32 - (NSString*)nameAsString; | |
33 - (BluetoothHCIPowerState)powerState; | |
34 @end | |
35 | |
36 @protocol IOBluetoothDeviceInquiryDelegate | |
37 - (void)deviceInquiryStarted:(IOBluetoothDeviceInquiry*)sender; | |
38 - (void)deviceInquiryDeviceFound:(IOBluetoothDeviceInquiry*)sender | |
39 device:(IOBluetoothDevice*)device; | |
40 - (void)deviceInquiryComplete:(IOBluetoothDeviceInquiry*)sender | |
41 error:(IOReturn)error | |
42 aborted:(BOOL)aborted; | |
43 @end | |
44 | |
45 #endif // MAC_OS_X_VERSION_10_7 | |
46 | |
47 @interface BluetoothAdapterMacDelegate | 28 @interface BluetoothAdapterMacDelegate |
48 : NSObject <IOBluetoothDeviceInquiryDelegate> { | 29 : NSObject <IOBluetoothDeviceInquiryDelegate> { |
49 @private | 30 @private |
50 device::BluetoothAdapterMac* adapter_; // weak | 31 device::BluetoothAdapterMac* adapter_; // weak |
51 } | 32 } |
52 | 33 |
53 - (id)initWithAdapter:(device::BluetoothAdapterMac*)adapter; | 34 - (id)initWithAdapter:(device::BluetoothAdapterMac*)adapter; |
54 | 35 |
55 @end | 36 @end |
56 | 37 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 iter != callback_list.end(); | 355 iter != callback_list.end(); |
375 ++iter) { | 356 ++iter) { |
376 if (success) | 357 if (success) |
377 ui_task_runner_->PostTask(FROM_HERE, iter->first); | 358 ui_task_runner_->PostTask(FROM_HERE, iter->first); |
378 else | 359 else |
379 ui_task_runner_->PostTask(FROM_HERE, iter->second); | 360 ui_task_runner_->PostTask(FROM_HERE, iter->second); |
380 } | 361 } |
381 } | 362 } |
382 | 363 |
383 } // namespace device | 364 } // namespace device |
OLD | NEW |