forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbluetooth_profile.cc
67 lines (51 loc) · 1.58 KB
/
bluetooth_profile.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "device/bluetooth/bluetooth_profile.h"
#if defined(OS_CHROMEOS)
#include "device/bluetooth/bluetooth_profile_chromeos.h"
#elif defined(OS_MACOSX)
#include "base/mac/mac_util.h"
#include "device/bluetooth/bluetooth_profile_mac.h"
#elif defined(OS_WIN)
#include "device/bluetooth/bluetooth_profile_win.h"
#endif
#include <string>
namespace device {
BluetoothProfile::Options::Options()
: channel(0),
psm(0),
require_authentication(false),
require_authorization(false),
auto_connect(false),
version(0),
features(0) {
}
BluetoothProfile::Options::~Options() {
}
BluetoothProfile::BluetoothProfile() {
}
BluetoothProfile::~BluetoothProfile() {
}
// static
void BluetoothProfile::Register(const std::string& uuid,
const Options& options,
const ProfileCallback& callback) {
#if defined(OS_CHROMEOS)
chromeos::BluetoothProfileChromeOS* profile = NULL;
profile = new chromeos::BluetoothProfileChromeOS();
profile->Init(uuid, options, callback);
#elif defined(OS_MACOSX)
BluetoothProfile* profile = NULL;
if (base::mac::IsOSLionOrLater())
profile = new BluetoothProfileMac(uuid, options.name);
callback.Run(profile);
#elif defined(OS_WIN)
BluetoothProfile* profile = NULL;
profile = new BluetoothProfileWin(uuid, options.name);
callback.Run(profile);
#else
callback.Run(NULL);
#endif
}
} // namespace device