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 #ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_NOTIFY_
SESSION_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_NOTIFY_
SESSION_H_ |
6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_NOTIFY_
SESSION_H_ | 6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_NOTIFY_
SESSION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "device/bluetooth/bluetooth_gatt_notify_session.h" | 11 #include "device/bluetooth/bluetooth_gatt_notify_session.h" |
12 #include "extensions/browser/api/api_resource.h" | 12 #include "extensions/browser/api/api_resource.h" |
13 #include "extensions/browser/api/api_resource_manager.h" | 13 #include "extensions/browser/api/api_resource_manager.h" |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 | 16 |
17 // An ApiResource wrapper for a device::BluetoothGattNotifySession | 17 // An ApiResource wrapper for a device::BluetoothGattNotifySession |
18 class BluetoothLowEnergyNotifySession : public ApiResource { | 18 class BluetoothLowEnergyNotifySession : public ApiResource { |
19 public: | 19 public: |
20 explicit BluetoothLowEnergyNotifySession( | 20 explicit BluetoothLowEnergyNotifySession( |
21 bool persistent, | 21 bool persistent, |
22 const std::string& owner_extension_id, | 22 const std::string& owner_extension_id, |
23 scoped_ptr<device::BluetoothGattNotifySession> session); | 23 scoped_ptr<device::BluetoothGattNotifySession> session); |
24 virtual ~BluetoothLowEnergyNotifySession(); | 24 virtual ~BluetoothLowEnergyNotifySession(); |
25 | 25 |
26 // Returns a pointer to the underlying session object. | 26 // Returns a pointer to the underlying session object. |
27 device::BluetoothGattNotifySession* GetSession() const; | 27 device::BluetoothGattNotifySession* GetSession() const; |
28 | 28 |
29 // ApiResource override. | 29 // ApiResource override. |
30 virtual bool IsPersistent() const OVERRIDE; | 30 virtual bool IsPersistent() const override; |
31 | 31 |
32 // This resource should be managed on the UI thread. | 32 // This resource should be managed on the UI thread. |
33 static const content::BrowserThread::ID kThreadId = | 33 static const content::BrowserThread::ID kThreadId = |
34 content::BrowserThread::UI; | 34 content::BrowserThread::UI; |
35 | 35 |
36 private: | 36 private: |
37 friend class ApiResourceManager<BluetoothLowEnergyNotifySession>; | 37 friend class ApiResourceManager<BluetoothLowEnergyNotifySession>; |
38 static const char* service_name() { | 38 static const char* service_name() { |
39 return "BluetoothLowEnergyNotifySessionManager"; | 39 return "BluetoothLowEnergyNotifySessionManager"; |
40 } | 40 } |
41 | 41 |
42 // True, if this resource should be persistent across suspends. | 42 // True, if this resource should be persistent across suspends. |
43 bool persistent_; | 43 bool persistent_; |
44 | 44 |
45 // The session is owned by this instance and will automatically stop when | 45 // The session is owned by this instance and will automatically stop when |
46 // deleted. | 46 // deleted. |
47 scoped_ptr<device::BluetoothGattNotifySession> session_; | 47 scoped_ptr<device::BluetoothGattNotifySession> session_; |
48 | 48 |
49 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyNotifySession); | 49 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyNotifySession); |
50 }; | 50 }; |
51 | 51 |
52 } // namespace extensions | 52 } // namespace extensions |
53 | 53 |
54 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_NOTI
FY_SESSION_H_ | 54 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_NOTI
FY_SESSION_H_ |
OLD | NEW |