From 3ad86aa0218867114a984e361bc25f98825d1200 Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Thu, 20 Jun 2019 01:17:16 -0700 Subject: [PATCH] device_orientation: Add requestPermission() to Device{Orientation,Motion}Event Implement https://github.com/w3c/deviceorientation/pull/68, which has added a static requestPermission() method to both DeviceOrientationEvent as well as DeviceMotionEvent. Permission granted via requestPermission() is checked for after other existing checks (if the requires feature policy checks fail, for example, we still do not register the event handler at all). The spec is somewhat vague in how permission handling should be implemented. For Chromium, we have settled on the following behavior: * If sensor access is set to "Allow", event listeners can be registered at any time, and calling requestPermission() returns a promise that resolves to "granted". * If sensor access is set to "Block", event listeners will only receive a single null event, and calling requestPermission() returns a promise that resolves to "blocked". * If sensor access is set to "Ask", event listeners will only receive a single null event until requestPermission() is called and access is granted (i.e. the user explicitly clicked "Allow" in the permission bubble, any other behavior including dismissing the bubble results in denial). If requestPermission() is NOT called through a user gesture, it will return a promise that rejecs with a NotAllowedError DOMException. If access is granted, requestPermission() returns a promise that resolves to "granted"; if access is denied, requestPermission() returns a promise that resolves to "blocked". Bug: 947112 Change-Id: Ibb6ad43b78ca54189cf8f7ef802a4f812c5030df --- ...ttps.html => deviceorientationabsoluteevent-manual.https.html} | 0 ...e.https.html => ondeviceorientationabsolute-manual.https.html} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename orientation-event/{deviceorientationabsoluteevent.https.html => deviceorientationabsoluteevent-manual.https.html} (100%) rename orientation-event/{ondeviceorientationabsolute.https.html => ondeviceorientationabsolute-manual.https.html} (100%) diff --git a/orientation-event/deviceorientationabsoluteevent.https.html b/orientation-event/deviceorientationabsoluteevent-manual.https.html similarity index 100% rename from orientation-event/deviceorientationabsoluteevent.https.html rename to orientation-event/deviceorientationabsoluteevent-manual.https.html diff --git a/orientation-event/ondeviceorientationabsolute.https.html b/orientation-event/ondeviceorientationabsolute-manual.https.html similarity index 100% rename from orientation-event/ondeviceorientationabsolute.https.html rename to orientation-event/ondeviceorientationabsolute-manual.https.html