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.
5 #ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_API_ADVERTISEMENT_H_
6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_API_ADVERTISEMENT_H_
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"
16 class BluetoothAdvertisement
;
19 namespace apibtle
= extensions::core_api::bluetooth_low_energy
;
21 namespace extensions
{
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
{
28 BluetoothApiAdvertisement(const std::string
& owner_extension_id
,
29 scoped_refptr
<device::BluetoothAdvertisement
>);
30 ~BluetoothApiAdvertisement() override
;
32 device::BluetoothAdvertisement
* advertisement() {
33 return advertisement_
.get();
36 // Implementations of |BluetoothAdvertisement| require being called on the
38 static const content::BrowserThread::ID kThreadId
=
39 content::BrowserThread::UI
;
42 friend class ApiResourceManager
<BluetoothApiAdvertisement
>;
44 static const char* service_name() {
45 return "BluetoothApiAdvertisementManager";
48 // The underlying advertisement instance.
49 scoped_refptr
<device::BluetoothAdvertisement
> advertisement_
;
51 DISALLOW_COPY_AND_ASSIGN(BluetoothApiAdvertisement
);
54 } // namespace extensions
56 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_API_ADVERTISEMENT_H_