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

Unified Diff: extensions/common/api/bluetooth/bluetooth_manifest_permission.cc

Issue 1096393002: API stubs for the BLE advertisement API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge 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/common/api/bluetooth/bluetooth_manifest_permission.cc
diff --git a/extensions/common/api/bluetooth/bluetooth_manifest_permission.cc b/extensions/common/api/bluetooth/bluetooth_manifest_permission.cc
index 677206096ed5269d3ae0f9c3a3c05b8ac032436b..60fb04d35eb42f5dc039f1624e566fdffdbc2cb9 100644
--- a/extensions/common/api/bluetooth/bluetooth_manifest_permission.cc
+++ b/extensions/common/api/bluetooth/bluetooth_manifest_permission.cc
@@ -12,6 +12,8 @@
#include "extensions/common/api/bluetooth/bluetooth_manifest_data.h"
#include "extensions/common/api/extensions_manifest_types.h"
#include "extensions/common/error_utils.h"
+#include "extensions/common/features/behavior_feature.h"
+#include "extensions/common/features/feature_provider.h"
#include "extensions/common/manifest_constants.h"
#include "grit/extensions_strings.h"
#include "ipc/ipc_message.h"
@@ -56,8 +58,8 @@ bool ParseUuidArray(BluetoothManifestPermission* permission,
} // namespace
BluetoothManifestPermission::BluetoothManifestPermission()
- : socket_(false),
- low_energy_(false) {}
+ : socket_(false), low_energy_(false), peripheral_(false) {
+}
BluetoothManifestPermission::~BluetoothManifestPermission() {}
@@ -83,6 +85,9 @@ scoped_ptr<BluetoothManifestPermission> BluetoothManifestPermission::FromValue(
if (bluetooth->low_energy) {
result->low_energy_ = *(bluetooth->low_energy);
}
+ if (bluetooth->peripheral) {
+ result->peripheral_ = *(bluetooth->peripheral);
+ }
return result.Pass();
}
@@ -111,6 +116,16 @@ bool BluetoothManifestPermission::CheckLowEnergyPermitted(
return low_energy_;
}
+bool BluetoothManifestPermission::CheckPeripheralPermitted(
+ const Extension* extension) const {
+ if (!FeatureProvider::GetBehaviorFeature(
+ BehaviorFeature::kBluetoothPeripheral)
+ ->IsAvailableToExtension(extension)
+ .is_available())
+ return false;
+ return peripheral_;
+}
+
std::string BluetoothManifestPermission::name() const {
return manifest_keys::kBluetooth;
}
« no previous file with comments | « extensions/common/api/bluetooth/bluetooth_manifest_permission.h ('k') | extensions/common/api/bluetooth_low_energy.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698