Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: extensions/browser/api/bluetooth_low_energy/bluetooth_api_advertisement.h

Issue 1132173002: Implement the advertising functions for the BLE API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..6144bc274e338002596ef4e6ade15b31875d9046
--- /dev/null
+++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_api_advertisement.h
@@ -0,0 +1,56 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// 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;
+} // namespace device
+
+namespace apibtle = extensions::core_api::bluetooth_low_energy;
+
+namespace extensions {
+
+// Representation of advertisement instances from the "bluetooth" namespace,
+// abstracting the underlying BluetoothAdvertisementXxx class. All methods
+// must be called on the |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();
+ }
+
+ // Implementations of |BluetoothAdvertisement| require being called on the
+ // UI thread.
+ 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_

Powered by Google App Engine
This is Rietveld 408576698