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 DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_CHROMEOS_H_ | |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_CHROMEOS_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "device/bluetooth/bluetooth_adapter.h" | |
10 #include "device/bluetooth/bluetooth_advertisement.h" | |
11 #include "device/bluetooth/bluetooth_export.h" | |
12 #include "device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h" | |
13 | |
14 namespace bluez { | |
15 class BluetoothLEAdvertisementServiceProvider; | |
16 } | |
17 | |
18 namespace chromeos { | |
19 | |
20 class BluetoothAdapterChromeOS; | |
21 | |
22 // The BluetoothAdvertisementChromeOS class implements BluetoothAdvertisement | |
23 // for the Chrome OS platform. | |
24 class DEVICE_BLUETOOTH_EXPORT BluetoothAdvertisementChromeOS | |
25 : public device::BluetoothAdvertisement, | |
26 public bluez::BluetoothLEAdvertisementServiceProvider::Delegate { | |
27 public: | |
28 BluetoothAdvertisementChromeOS( | |
29 scoped_ptr<device::BluetoothAdvertisement::Data> data, | |
30 scoped_refptr<BluetoothAdapterChromeOS> adapter); | |
31 | |
32 // BluetoothAdvertisement overrides: | |
33 void Unregister(const SuccessCallback& success_callback, | |
34 const ErrorCallback& error_callback) override; | |
35 | |
36 // bluez::BluetoothLEAdvertisementServiceProvider::Delegate overrides: | |
37 void Released() override; | |
38 | |
39 void Register( | |
40 const base::Closure& success_callback, | |
41 const device::BluetoothAdapter::CreateAdvertisementErrorCallback& | |
42 error_callback); | |
43 | |
44 // Used from tests to be able to trigger events on the fake advertisement | |
45 // provider. | |
46 bluez::BluetoothLEAdvertisementServiceProvider* provider() { | |
47 return provider_.get(); | |
48 } | |
49 | |
50 private: | |
51 ~BluetoothAdvertisementChromeOS() override; | |
52 | |
53 // Adapter this advertisement is advertising on. | |
54 scoped_refptr<BluetoothAdapterChromeOS> adapter_; | |
55 scoped_ptr<bluez::BluetoothLEAdvertisementServiceProvider> provider_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(BluetoothAdvertisementChromeOS); | |
58 }; | |
59 | |
60 } // namespace chromeos | |
61 | |
62 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_CHROMEOS_H_ | |
OLD | NEW |