| Index: third_party/WebKit/Source/modules/permissions/Permissions.cpp
|
| diff --git a/third_party/WebKit/Source/modules/permissions/Permissions.cpp b/third_party/WebKit/Source/modules/permissions/Permissions.cpp
|
| index f9a49940254a69240cbb17a52e311b23c9a8f6cb..f02914b204cd5294284a8bfec5c47942b830591c 100644
|
| --- a/third_party/WebKit/Source/modules/permissions/Permissions.cpp
|
| +++ b/third_party/WebKit/Source/modules/permissions/Permissions.cpp
|
| @@ -20,6 +20,7 @@
|
| #include "modules/permissions/PermissionDescriptor.h"
|
| #include "modules/permissions/PermissionStatus.h"
|
| #include "modules/permissions/PermissionUtils.h"
|
| +#include "platform/RuntimeEnabledFeatures.h"
|
| #include "platform/UserGestureIndicator.h"
|
| #include "platform/wtf/Functional.h"
|
| #include "platform/wtf/NotFound.h"
|
| @@ -91,6 +92,23 @@ PermissionDescriptorPtr ParsePermission(ScriptState* script_state,
|
| }
|
| if (name == "background-sync")
|
| return CreatePermissionDescriptor(PermissionName::BACKGROUND_SYNC);
|
| + // TODO(riju): Remove runtime flag check when Generic Sensor feature is
|
| + // stable.
|
| + if (name == "ambient-light-sensor" || name == "accelerometer" ||
|
| + name == "gyroscope" || name == "magnetometer") {
|
| + if (!RuntimeEnabledFeatures::sensorEnabled()) {
|
| + exception_state.ThrowTypeError("GenericSensor flag is not enabled.");
|
| + return nullptr;
|
| + }
|
| + if (name == "ambient-light-sensor")
|
| + return CreatePermissionDescriptor(PermissionName::AMBIENT_LIGHT_SENSOR);
|
| + if (name == "accelerometer")
|
| + return CreatePermissionDescriptor(PermissionName::ACCELEROMETER);
|
| + if (name == "gyroscope")
|
| + return CreatePermissionDescriptor(PermissionName::GYROSCOPE);
|
| + if (name == "magnetometer")
|
| + return CreatePermissionDescriptor(PermissionName::MAGNETOMETER);
|
| + }
|
|
|
| return nullptr;
|
| }
|
|
|