OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_API_ADVERTISEMENT_
H_ |
| 6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_API_ADVERTISEMENT_
H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "device/bluetooth/bluetooth_advertisement.h" |
| 11 #include "extensions/browser/api/api_resource.h" |
| 12 #include "extensions/browser/api/api_resource_manager.h" |
| 13 #include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event
_router.h" |
| 14 |
| 15 namespace device { |
| 16 class BluetoothAdvertisement; |
| 17 } // namespace device |
| 18 |
| 19 namespace apibtle = extensions::core_api::bluetooth_low_energy; |
| 20 |
| 21 namespace extensions { |
| 22 |
| 23 // Representation of advertisement instances from the "bluetooth" namespace, |
| 24 // abstracting the underlying BluetoothAdvertisementXxx class. All methods |
| 25 // must be called on the |kThreadId| thread. |
| 26 class BluetoothApiAdvertisement : public ApiResource { |
| 27 public: |
| 28 BluetoothApiAdvertisement(const std::string& owner_extension_id, |
| 29 scoped_refptr<device::BluetoothAdvertisement>); |
| 30 ~BluetoothApiAdvertisement() override; |
| 31 |
| 32 device::BluetoothAdvertisement* advertisement() { |
| 33 return advertisement_.get(); |
| 34 } |
| 35 |
| 36 // Implementations of |BluetoothAdvertisement| require being called on the |
| 37 // UI thread. |
| 38 static const content::BrowserThread::ID kThreadId = |
| 39 content::BrowserThread::UI; |
| 40 |
| 41 private: |
| 42 friend class ApiResourceManager<BluetoothApiAdvertisement>; |
| 43 |
| 44 static const char* service_name() { |
| 45 return "BluetoothApiAdvertisementManager"; |
| 46 } |
| 47 |
| 48 // The underlying advertisement instance. |
| 49 scoped_refptr<device::BluetoothAdvertisement> advertisement_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(BluetoothApiAdvertisement); |
| 52 }; |
| 53 |
| 54 } // namespace extensions |
| 55 |
| 56 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_API_ADVERTISEME
NT_H_ |
OLD | NEW |