OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_conne
ction.h" | 5 #include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_conne
ction.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 | 8 |
9 namespace extensions { | 9 namespace extensions { |
10 | 10 |
11 static base::LazyInstance<BrowserContextKeyedAPIFactory< | 11 static base::LazyInstance<BrowserContextKeyedAPIFactory< |
12 ApiResourceManager<BluetoothLowEnergyConnection>>> | 12 ApiResourceManager<BluetoothLowEnergyConnection>>>::DestructorAtExit |
13 g_factory = LAZY_INSTANCE_INITIALIZER; | 13 g_factory = LAZY_INSTANCE_INITIALIZER; |
14 | 14 |
15 template <> | 15 template <> |
16 BrowserContextKeyedAPIFactory<ApiResourceManager<BluetoothLowEnergyConnection>>* | 16 BrowserContextKeyedAPIFactory<ApiResourceManager<BluetoothLowEnergyConnection>>* |
17 ApiResourceManager<BluetoothLowEnergyConnection>::GetFactoryInstance() { | 17 ApiResourceManager<BluetoothLowEnergyConnection>::GetFactoryInstance() { |
18 return g_factory.Pointer(); | 18 return g_factory.Pointer(); |
19 } | 19 } |
20 | 20 |
21 BluetoothLowEnergyConnection::BluetoothLowEnergyConnection( | 21 BluetoothLowEnergyConnection::BluetoothLowEnergyConnection( |
22 bool persistent, | 22 bool persistent, |
23 const std::string& owner_extension_id, | 23 const std::string& owner_extension_id, |
24 std::unique_ptr<device::BluetoothGattConnection> connection) | 24 std::unique_ptr<device::BluetoothGattConnection> connection) |
25 : ApiResource(owner_extension_id), | 25 : ApiResource(owner_extension_id), |
26 persistent_(persistent), | 26 persistent_(persistent), |
27 connection_(connection.release()) {} | 27 connection_(connection.release()) {} |
28 | 28 |
29 BluetoothLowEnergyConnection::~BluetoothLowEnergyConnection() {} | 29 BluetoothLowEnergyConnection::~BluetoothLowEnergyConnection() {} |
30 | 30 |
31 device::BluetoothGattConnection* BluetoothLowEnergyConnection::GetConnection() | 31 device::BluetoothGattConnection* BluetoothLowEnergyConnection::GetConnection() |
32 const { | 32 const { |
33 return connection_.get(); | 33 return connection_.get(); |
34 } | 34 } |
35 | 35 |
36 bool BluetoothLowEnergyConnection::IsPersistent() const { | 36 bool BluetoothLowEnergyConnection::IsPersistent() const { |
37 return persistent_; | 37 return persistent_; |
38 } | 38 } |
39 | 39 |
40 } // namespace extensions | 40 } // namespace extensions |
OLD | NEW |