Chromium Code Reviews| 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( |
|
not at google - send to devlin
2015/05/06 22:16:18
You could do this check on construction instead, u
rkc
2015/05/07 17:16:28
Discussed offline.
|
| + BehaviorFeature::kBluetoothPeripheral) |
| + ->IsAvailableToExtension(extension) |
| + .is_available()) |
| + return false; |
| + return peripheral_; |
| +} |
| + |
| std::string BluetoothManifestPermission::name() const { |
| return manifest_keys::kBluetooth; |
| } |