OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_
CONNECTION_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_
CONNECTION_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "device/bluetooth/bluetooth_gatt_connection.h" |
| 10 #include "extensions/browser/api/api_resource.h" |
| 11 #include "extensions/browser/api/api_resource_manager.h" |
| 12 |
| 13 namespace extensions { |
| 14 |
| 15 // An ApiResource wrapper for a device::BluetoothGattConnection. |
| 16 class BluetoothLowEnergyConnection : public ApiResource { |
| 17 public: |
| 18 explicit BluetoothLowEnergyConnection( |
| 19 const std::string& owner_extension_id, |
| 20 scoped_ptr<device::BluetoothGattConnection> connection); |
| 21 virtual ~BluetoothLowEnergyConnection(); |
| 22 |
| 23 // Returns a pointer to the underlying connection object. |
| 24 device::BluetoothGattConnection* GetConnection() const; |
| 25 |
| 26 // ApiResource override. |
| 27 virtual bool IsPersistent() const OVERRIDE; |
| 28 |
| 29 // This resource should be managed on the UI thread. |
| 30 static const content::BrowserThread::ID kThreadId = |
| 31 content::BrowserThread::UI; |
| 32 |
| 33 private: |
| 34 friend class ApiResourceManager<BluetoothLowEnergyConnection>; |
| 35 static const char* service_name() { |
| 36 return "BluetoothLowEnergyConnectionManager"; |
| 37 } |
| 38 |
| 39 // The connection is owned by this instance and will automatically disconnect |
| 40 // when deleted. |
| 41 scoped_ptr<device::BluetoothGattConnection> connection_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyConnection); |
| 44 }; |
| 45 |
| 46 } // namespace extensions |
| 47 |
| 48 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENER
GY_CONNECTION_H_ |
OLD | NEW |