From 4abd2d0ac13acfd8e49a5fbed28a26ff07620f88 Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Thu, 18 Apr 2019 11:14:58 -0700 Subject: [PATCH] device_orientation: Add requestPermission() to Device{Orientation,Motion}Event STILL WIP, BLOCKED ON https://crbug.com/952824 Implement https://github.com/w3c/deviceorientation/pull/68, which has added a static requestPermission() method to both DeviceOrientationEvent as well as DeviceMotionEvent. Scripts wishing to listen to these events (as well as deviceorientationabsolute) must first request permission from users by calling those methods; until then, any event listeners are registered but never triggered. 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). Implementing this requires changing how sensors permissions work in the browser: so far, users could choose between always allowing and always blocking sensor access. It is now possible to choose "Ask" as an option, in which case a modal prompt asks the user for access (dismissing the prompt or choosing "Block" both mean "Block" to the new web API). In any case, we keep "Allow" as the default option for backwards compatibility. Specifically: * In the desktop UI, it is possible to choose between "Allow", "Ask" and "Block" for sensors in chrome://settings/content/siteDetails and between "Allow" and "Ask" in chrome://settings/content/sensors. * On Android, it is currrently not possible to have per-site sensor settings; on the global site settings, we now have a tri-state choice between "Allow", "Ask" and "Block". Bug: 947112 Change-Id: I0e34b48fd21d56d6ac35ad55f69f992065a4bc62 --- ...rientationabsoluteevent-manual.https.html} | 24 ++++++----- ...eviceorientationabsolute-manual.https.html | 35 +++++++++++++++ .../ondeviceorientationabsolute.https.html | 43 ------------------- 3 files changed, 49 insertions(+), 53 deletions(-) rename orientation-event/{deviceorientationabsoluteevent.https.html => deviceorientationabsoluteevent-manual.https.html} (62%) create mode 100644 orientation-event/ondeviceorientationabsolute-manual.https.html delete mode 100644 orientation-event/ondeviceorientationabsolute.https.html diff --git a/orientation-event/deviceorientationabsoluteevent.https.html b/orientation-event/deviceorientationabsoluteevent-manual.https.html similarity index 62% rename from orientation-event/deviceorientationabsoluteevent.https.html rename to orientation-event/deviceorientationabsoluteevent-manual.https.html index 8ccf671cb3b846..d176fddb359140 100644 --- a/orientation-event/deviceorientationabsoluteevent.https.html +++ b/orientation-event/deviceorientationabsoluteevent-manual.https.html @@ -8,23 +8,27 @@

If an implementation can never provide absolute orientation information, the event should be fired with the alpha, beta and gamma attributes set to null.

+
diff --git a/orientation-event/ondeviceorientationabsolute-manual.https.html b/orientation-event/ondeviceorientationabsolute-manual.https.html new file mode 100644 index 00000000000000..ad5f3678e0050f --- /dev/null +++ b/orientation-event/ondeviceorientationabsolute-manual.https.html @@ -0,0 +1,35 @@ + + + + User agents must also provide an event handler IDL attribute named ondeviceorientationabsolute on the window object + + + + + +

Rotate the device to run the tests.

+ +
+ + + + diff --git a/orientation-event/ondeviceorientationabsolute.https.html b/orientation-event/ondeviceorientationabsolute.https.html deleted file mode 100644 index 73ce97ab5c1fd7..00000000000000 --- a/orientation-event/ondeviceorientationabsolute.https.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - User agents must also provide an event handler IDL attribute named ondeviceorientationabsolute on the window object - - - - - -

Rotate the device to run the tests.

-
- - - -