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