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_CHROMEOS) |
8 #include "device/bluetooth/bluetooth_profile_chromeos.h" | 8 #include "device/bluetooth/bluetooth_profile_chromeos.h" |
9 #elif defined(OS_MACOSX) | 9 #elif defined(OS_MACOSX) |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
11 #include "device/bluetooth/bluetooth_profile_mac.h" | |
12 #elif defined(OS_WIN) | 11 #elif defined(OS_WIN) |
13 #include "device/bluetooth/bluetooth_profile_win.h" | 12 #include "device/bluetooth/bluetooth_profile_win.h" |
14 #endif | 13 #endif |
15 | 14 |
16 namespace device { | 15 namespace device { |
17 | 16 |
18 BluetoothProfile::Options::Options() | 17 BluetoothProfile::Options::Options() |
19 : channel(0), | 18 : channel(0), |
20 psm(0), | 19 psm(0), |
21 require_authentication(false), | 20 require_authentication(false), |
22 require_authorization(false), | 21 require_authorization(false), |
23 auto_connect(false), | 22 auto_connect(false), |
24 version(0), | 23 version(0), |
25 features(0) { | 24 features(0) { |
26 } | 25 } |
27 | 26 |
28 BluetoothProfile::Options::~Options() { | 27 BluetoothProfile::Options::~Options() { |
29 | 28 |
30 } | 29 } |
31 | 30 |
32 | 31 |
33 BluetoothProfile::BluetoothProfile() { | 32 BluetoothProfile::BluetoothProfile() { |
34 | 33 |
35 } | 34 } |
36 | 35 |
37 BluetoothProfile::~BluetoothProfile() { | 36 BluetoothProfile::~BluetoothProfile() { |
38 | |
39 } | 37 } |
40 | 38 |
| 39 // TODO(isherman): This is defined in BluetoothProfileMac.mm. Since the |
| 40 // BluetoothProfile classes are soon going away, it's not really worth cleaning |
| 41 // this up more. |
| 42 BluetoothProfile* CreateBluetoothProfileMac( |
| 43 const BluetoothUUID& uuid, |
| 44 const BluetoothProfile::Options& options); |
41 | 45 |
42 // static | 46 // static |
43 void BluetoothProfile::Register(const BluetoothUUID& uuid, | 47 void BluetoothProfile::Register(const BluetoothUUID& uuid, |
44 const Options& options, | 48 const Options& options, |
45 const ProfileCallback& callback) { | 49 const ProfileCallback& callback) { |
46 #if defined(OS_CHROMEOS) | 50 #if defined(OS_CHROMEOS) |
47 chromeos::BluetoothProfileChromeOS* profile = NULL; | 51 chromeos::BluetoothProfileChromeOS* profile = NULL; |
48 profile = new chromeos::BluetoothProfileChromeOS(); | 52 profile = new chromeos::BluetoothProfileChromeOS(); |
49 profile->Init(uuid, options, callback); | 53 profile->Init(uuid, options, callback); |
50 #elif defined(OS_MACOSX) | 54 #elif defined(OS_MACOSX) |
51 BluetoothProfile* profile = NULL; | 55 BluetoothProfile* profile = NULL; |
52 | 56 |
53 if (base::mac::IsOSLionOrLater()) | 57 if (base::mac::IsOSLionOrLater()) |
54 profile = new BluetoothProfileMac(uuid, options.name); | 58 profile = CreateBluetoothProfileMac(uuid, options); |
55 callback.Run(profile); | 59 callback.Run(profile); |
56 #elif defined(OS_WIN) | 60 #elif defined(OS_WIN) |
57 BluetoothProfile* profile = NULL; | 61 BluetoothProfile* profile = NULL; |
58 profile = new BluetoothProfileWin(uuid, options.name); | 62 profile = new BluetoothProfileWin(uuid, options.name); |
59 callback.Run(profile); | 63 callback.Run(profile); |
60 #else | 64 #else |
61 callback.Run(NULL); | 65 callback.Run(NULL); |
62 #endif | 66 #endif |
63 } | 67 } |
64 | 68 |
65 } // namespace device | 69 } // namespace device |
OLD | NEW |