| Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "device/bluetooth/bluetooth_profile.h" |
| 6 | |
| Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 7 | #if defined(OS_CHROMEOS) |
| Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame^] | 8 | #include "device/bluetooth/bluetooth_profile_chromeos.h" |
| Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 9 | #elif defined(OS_MACOSX) |
| Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 10 | #include "base/mac/mac_util.h" |
| 11 | #include "device/bluetooth/bluetooth_profile_mac.h" |
| 12 | #elif defined(OS_WIN) |
| 13 | #include "device/bluetooth/bluetooth_profile_win.h" |
| 14 | #endif |
| 15 | |
| 16 | #include <string> |
| 17 | |
| 18 | namespace device { |
| 19 | |
| 20 | BluetoothProfile::Options::Options() |
| 21 | : channel(0), |
| 22 | psm(0), |
| 23 | require_authentication(false), |
| 24 | require_authorization(false), |
| 25 | auto_connect(false), |
| 26 | version(0), |
| 27 | features(0) { |
| 28 | } |
| 29 | |
| 30 | BluetoothProfile::Options::~Options() { |
| 31 | |
| 32 | } |
| 33 | |
| 34 | |
| 35 | BluetoothProfile::BluetoothProfile() { |
| 36 | |
| 37 | } |
| 38 | |
| 39 | BluetoothProfile::~BluetoothProfile() { |
| 40 | |
| 41 | } |
| 42 | |
| 43 | |
| 44 | // static |
| 45 | void BluetoothProfile::Register(const std::string& uuid, |
| 46 | const Options& options, |
| 47 | const ProfileCallback& callback) { |
| Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 48 | #if defined(OS_CHROMEOS) |
| Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame^] | 49 | chromeos::BluetoothProfileChromeOS* profile = NULL; |
| 50 | profile = new chromeos::BluetoothProfileChromeOS(); |
| Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 51 | profile->Init(uuid, options, callback); |
| 52 | #elif defined(OS_MACOSX) |
| Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 53 | BluetoothProfile* profile = NULL; |
| 54 | |
| Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 55 | if (base::mac::IsOSLionOrLater()) |
| 56 | profile = new BluetoothProfileMac(uuid, options.name); |
| Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 57 | callback.Run(profile); |
| Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 58 | #elif defined(OS_WIN) |
| 59 | BluetoothProfile* profile = NULL; |
| 60 | profile = new BluetoothProfileWin(uuid, options.name); |
| 61 | callback.Run(profile); |
| 62 | #else |
| 63 | callback.Run(NULL); |
| 64 | #endif |
| Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | } // namespace device |