Revert 269361 "Fix WebURLLoaderImpl::Context leak if a pending r..."
[chromium-blink-merge.git] / device / bluetooth / bluetooth_profile.cc
blob8050462b93c30cb2ab9e08d39fdd2860e2e19e0e
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.
5 #include "device/bluetooth/bluetooth_profile.h"
7 #if defined(OS_MACOSX)
8 #include "base/mac/mac_util.h"
9 #elif defined(OS_WIN)
10 #include "device/bluetooth/bluetooth_profile_win.h"
11 #endif
13 namespace device {
15 BluetoothProfile::Options::Options()
16 : channel(0),
17 psm(0),
18 require_authentication(false),
19 require_authorization(false),
20 auto_connect(false),
21 version(0),
22 features(0) {
25 BluetoothProfile::Options::~Options() {
30 BluetoothProfile::BluetoothProfile() {
34 BluetoothProfile::~BluetoothProfile() {
37 // TODO(isherman): This is defined in BluetoothProfileMac.mm. Since the
38 // BluetoothProfile classes are soon going away, it's not really worth cleaning
39 // this up more.
40 BluetoothProfile* CreateBluetoothProfileMac(
41 const BluetoothUUID& uuid,
42 const BluetoothProfile::Options& options);
44 // static
45 void BluetoothProfile::Register(const BluetoothUUID& uuid,
46 const Options& options,
47 const ProfileCallback& callback) {
48 #if defined(OS_MACOSX)
49 BluetoothProfile* profile = NULL;
51 if (base::mac::IsOSLionOrLater())
52 profile = CreateBluetoothProfileMac(uuid, options);
53 callback.Run(profile);
54 #elif defined(OS_WIN)
55 BluetoothProfileWin* profile = NULL;
56 profile = new BluetoothProfileWin();
57 profile->Init(uuid, options, callback);
58 #else
59 callback.Run(NULL);
60 #endif
63 } // namespace device