This directory contains the implementation of the Web Bluetooth specification using the Bluetooth abstraction module implemented in //device/bluetooth
. See the Bluetooth Abstraction README for more details on the cross-platform implementation of Bluetooth in Chromium.
This service is exposed to the Web through the Blink Bluetooth module, which accesses the Web Bluetooth Service through Mojo IPC. For more details, see the Web Bluetooth Blink Module README.
The legacy permissions system is implemented by bluetooth_allowed_devices.h
, which is created per origin.
The new permissions system is implemented by providing an implementation for the //content/public/browser/bluetooth_delegate.h
interface. In Chrome, the implementation of this interface is provided by //chrome/browser/chrome_bluetooth_delegate.h
which forwards permission queries to //chrome/browser/bluetooth/bluetooth_chooser_context.h
. This class uses //components/permissions/chooser_context_base.h
as the base. This base class is also in use by other device APIs, like WebUSB. The new permission system enables Web Bluetooth permissions to be persistent and to be exposed in the settings UI for users to manage more easily. For more details on the new permissions system, see the Web Bluetooth Persistent Permissions design document.
The Web Bluetooth Service is primarily tested using Blink Web Tests and Web Platform Tests. These tests are found in //third_party/blink/web_tests/bluetooth
and //third_party/blink/web_tests/external/wpt/bluetooth
. There is currently an ongoing effort to refactor the Web Bluetooth tests using the legacy BluetoothFakeAdapter test infrastructure to use the new FakeBluetooth Test API. For more details, see the Web Bluetooth Web Tests README and the Web Bluetooth Web Platform Tests README.
TODO(https://crbug.com/509038): Update this document when the remaining tests have been submitted to W3C Web Platform Tests.
The tests are run using content_shell
, which fakes the Bluetooth related UI and the new permissions system. For more details, see the following files in //content/shell/browser/web_test
:
Mailing list: web-bluetooth@chromium.org
Bug tracker: Blink>Bluetooth