Chromium Code Reviews| Index: extensions/browser/api/bluetooth_low_energy/bluetooth_api_advertisement.h |
| diff --git a/extensions/browser/api/bluetooth_low_energy/bluetooth_api_advertisement.h b/extensions/browser/api/bluetooth_low_energy/bluetooth_api_advertisement.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3293717a1bd6a928d47b92774c8ecd00ae391a94 |
| --- /dev/null |
| +++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_api_advertisement.h |
| @@ -0,0 +1,57 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
|
armansito
2015/05/08 22:46:13
nit: s/2014/2015/
rkc
2015/05/11 21:59:35
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_API_ADVERTISEMENT_H_ |
| +#define EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_API_ADVERTISEMENT_H_ |
| + |
| +#include <string> |
| + |
| +#include "device/bluetooth/bluetooth_advertisement.h" |
| +#include "extensions/browser/api/api_resource.h" |
| +#include "extensions/browser/api/api_resource_manager.h" |
| +#include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h" |
| + |
| +namespace device { |
| +class BluetoothAdvertisement; |
| +} |
|
armansito
2015/05/08 22:46:13
nit: "} // namespace device"
rkc
2015/05/11 21:59:35
Done.
|
| + |
| +namespace apibtle = extensions::core_api::bluetooth_low_energy; |
| + |
| +namespace extensions { |
| + |
| +// Representation of advertisement instances from the "bluetooth" namespace, |
| +// abstracting away platform differences from the underlying |
| +// BluetoothAdvertisementXxx class. All methods must be called on the |
|
armansito
2015/05/08 22:46:13
Probably no need to mention "platform differences"
rkc
2015/05/11 21:59:35
Done.
|
| +// |kThreadId| thread. |
| +class BluetoothApiAdvertisement : public ApiResource { |
| + public: |
| + BluetoothApiAdvertisement(const std::string& owner_extension_id, |
| + scoped_refptr<device::BluetoothAdvertisement>); |
| + ~BluetoothApiAdvertisement() override; |
| + |
| + device::BluetoothAdvertisement* advertisement() { |
| + return advertisement_.get(); |
| + } |
| + |
| + // Platform specific implementations of |BluetoothAdvertisement| require |
| + // being called on the UI thread. |
|
armansito
2015/05/08 22:46:13
Again, since there is no platform magic happening
rkc
2015/05/11 21:59:34
Done.
|
| + static const content::BrowserThread::ID kThreadId = |
| + content::BrowserThread::UI; |
| + |
| + private: |
| + friend class ApiResourceManager<BluetoothApiAdvertisement>; |
| + |
| + static const char* service_name() { |
| + return "BluetoothApiAdvertisementManager"; |
| + } |
| + |
| + // The underlying advertisement instance. |
| + scoped_refptr<device::BluetoothAdvertisement> advertisement_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BluetoothApiAdvertisement); |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_API_ADVERTISEMENT_H_ |