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 "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ
y_notify_session.h" | 5 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ
y_notify_session.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<BluetoothLowEnergyNotifySession> > > g_factory = | 12 ApiResourceManager<BluetoothLowEnergyNotifySession> > > g_factory = |
13 LAZY_INSTANCE_INITIALIZER; | 13 LAZY_INSTANCE_INITIALIZER; |
14 | 14 |
15 template <> | 15 template <> |
16 BrowserContextKeyedAPIFactory< | 16 BrowserContextKeyedAPIFactory< |
17 ApiResourceManager<BluetoothLowEnergyNotifySession> >* | 17 ApiResourceManager<BluetoothLowEnergyNotifySession> >* |
18 ApiResourceManager<BluetoothLowEnergyNotifySession>::GetFactoryInstance() { | 18 ApiResourceManager<BluetoothLowEnergyNotifySession>::GetFactoryInstance() { |
19 return g_factory.Pointer(); | 19 return g_factory.Pointer(); |
20 } | 20 } |
21 | 21 |
22 BluetoothLowEnergyNotifySession::BluetoothLowEnergyNotifySession( | 22 BluetoothLowEnergyNotifySession::BluetoothLowEnergyNotifySession( |
23 bool persistent, | 23 bool persistent, |
24 const std::string& owner_extension_id, | 24 const std::string& owner_extension_id, |
25 scoped_ptr<device::BluetoothGattNotifySession> session) | 25 std::unique_ptr<device::BluetoothGattNotifySession> session) |
26 : ApiResource(owner_extension_id), | 26 : ApiResource(owner_extension_id), |
27 persistent_(persistent), | 27 persistent_(persistent), |
28 session_(session.release()) { | 28 session_(session.release()) {} |
29 } | |
30 | 29 |
31 BluetoothLowEnergyNotifySession::~BluetoothLowEnergyNotifySession() { | 30 BluetoothLowEnergyNotifySession::~BluetoothLowEnergyNotifySession() { |
32 } | 31 } |
33 | 32 |
34 device::BluetoothGattNotifySession* | 33 device::BluetoothGattNotifySession* |
35 BluetoothLowEnergyNotifySession::GetSession() const { | 34 BluetoothLowEnergyNotifySession::GetSession() const { |
36 return session_.get(); | 35 return session_.get(); |
37 } | 36 } |
38 | 37 |
39 bool BluetoothLowEnergyNotifySession::IsPersistent() const { | 38 bool BluetoothLowEnergyNotifySession::IsPersistent() const { |
40 return persistent_; | 39 return persistent_; |
41 } | 40 } |
42 | 41 |
43 } // namespace extensions | 42 } // namespace extensions |
OLD | NEW |