OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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.h" | 5 #include "device/bluetooth/bluetooth_profile.h" |
6 | 6 |
7 #if defined(OS_CHROMEOS) | 7 #if defined(OS_MACOSX) |
8 #include "base/sequenced_task_runner.h" | |
9 #include "base/single_thread_task_runner.h" | |
10 #include "base/thread_task_runner_handle.h" | |
11 #include "device/bluetooth/bluetooth_profile_chromeos.h" | |
12 #include "device/bluetooth/bluetooth_socket_thread.h" | |
13 #elif defined(OS_MACOSX) | |
14 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
15 #elif defined(OS_WIN) | 9 #elif defined(OS_WIN) |
16 #include "device/bluetooth/bluetooth_profile_win.h" | 10 #include "device/bluetooth/bluetooth_profile_win.h" |
17 #endif | 11 #endif |
18 | 12 |
19 namespace device { | 13 namespace device { |
20 | 14 |
21 BluetoothProfile::Options::Options() | 15 BluetoothProfile::Options::Options() |
22 : channel(0), | 16 : channel(0), |
23 psm(0), | 17 psm(0), |
(...skipping 20 matching lines...) Expand all Loading... |
44 // BluetoothProfile classes are soon going away, it's not really worth cleaning | 38 // BluetoothProfile classes are soon going away, it's not really worth cleaning |
45 // this up more. | 39 // this up more. |
46 BluetoothProfile* CreateBluetoothProfileMac( | 40 BluetoothProfile* CreateBluetoothProfileMac( |
47 const BluetoothUUID& uuid, | 41 const BluetoothUUID& uuid, |
48 const BluetoothProfile::Options& options); | 42 const BluetoothProfile::Options& options); |
49 | 43 |
50 // static | 44 // static |
51 void BluetoothProfile::Register(const BluetoothUUID& uuid, | 45 void BluetoothProfile::Register(const BluetoothUUID& uuid, |
52 const Options& options, | 46 const Options& options, |
53 const ProfileCallback& callback) { | 47 const ProfileCallback& callback) { |
54 #if defined(OS_CHROMEOS) | 48 #if defined(OS_MACOSX) |
55 chromeos::BluetoothProfileChromeOS* profile = NULL; | |
56 profile = new chromeos::BluetoothProfileChromeOS( | |
57 base::ThreadTaskRunnerHandle::Get(), | |
58 device::BluetoothSocketThread::Get()); | |
59 profile->Init(uuid, options, callback); | |
60 #elif defined(OS_MACOSX) | |
61 BluetoothProfile* profile = NULL; | 49 BluetoothProfile* profile = NULL; |
62 | 50 |
63 if (base::mac::IsOSLionOrLater()) | 51 if (base::mac::IsOSLionOrLater()) |
64 profile = CreateBluetoothProfileMac(uuid, options); | 52 profile = CreateBluetoothProfileMac(uuid, options); |
65 callback.Run(profile); | 53 callback.Run(profile); |
66 #elif defined(OS_WIN) | 54 #elif defined(OS_WIN) |
67 BluetoothProfileWin* profile = NULL; | 55 BluetoothProfileWin* profile = NULL; |
68 profile = new BluetoothProfileWin(); | 56 profile = new BluetoothProfileWin(); |
69 profile->Init(uuid, options, callback); | 57 profile->Init(uuid, options, callback); |
70 #else | 58 #else |
71 callback.Run(NULL); | 59 callback.Run(NULL); |
72 #endif | 60 #endif |
73 } | 61 } |
74 | 62 |
75 } // namespace device | 63 } // namespace device |
OLD | NEW |