tree: 74b730a9f96da19f39b2e6d0d4016d913fb25ea5 [path history] [tgz]
  1. DIR_METADATA
  2. frame_sensor_provider_proxy.cc
  3. frame_sensor_provider_proxy.h
  4. generic_sensor_browsertest.cc
  5. OWNERS
  6. README.md
  7. web_contents_sensor_provider_proxy.cc
  8. web_contents_sensor_provider_proxy.h
  9. web_contents_sensor_provider_proxy_unittest.cc
content/browser/generic_sensor/README.md

Generic Sensors, //content part

This directory contains part of the Generic Sensors API implementation in Chromium. See the Blink README.md and the services README.md for more information about the architecture.

From a spec perspective, the code here implements the following steps together with Blink:

//content/browser/generic_sensor implements permission checks invoked by the Blink code, and acts as a bridge between Blink and //services/device/generic_sensor. It also translates calls to the WebSensorProvider Mojo interface to SensorProvider ones.

When code in Blink invokes WebSensorProvider::GetSensor(), it reaches FrameSensorProviderProxy::GetSensor() in //content/browser/generic_sensor rather than SensorProviderImpl::GetSensor() in //services/device/generic_sensor. If all permission checks pass, FrameSensorProviderProxy will forward the request from Blink to WebContentsSensorProviderProxy::GetSensor(), which ultimately invokes SensorProviderImpl::GetSensor() via Mojo.

WebContentsSensorProviderProxy itself does not implement any Mojo interface, but it contains the required mojo::Remotes that invoke sensor operations in SensorProviderImpl.

WebContentsSensorProviderProxy exists on a per-WebContents basis; the Mojo binding between Blink and this class goes through FrameSensorProviderProxy, which exists on a per-RenderFrameHost basis.

This directory also contains a few browser tests for the permission checks in generic_sensor_browsertest.cc. They are complemented by device_sensor_browsertest.cc.