chromium/chromecast/browser/bluetooth/public/mojom/web_bluetooth.mojom

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module chromecast.mojom;

// When WebBluetooth is enabled for a Cast Activity, this interface must be
// provided by the Activity's host, which may be running in a remote service.
// This interface is responsible for granting the Activity access to Bluetooth
// devices.
interface BluetoothDeviceAccessProvider {
  // Request that the host begin granting |client| access to approved devices.
  RequestDeviceAccess(
      pending_remote<BluetoothDeviceAccessProviderClient> client);
};

// The client for BluetoothDeviceAccessProvider, provided by the Activity,
// and passed to the host via RequestDeviceAccess().
interface BluetoothDeviceAccessProviderClient {
  // Grant the Activity access to the device at |address|. This is a Bluetooth
  // mac address in canonical format. This method may be invoked multiple times,
  // or zero times, during this object's lifetime.
  GrantAccess(string address);

  // Grant the Activity access to any device discovered by the WebBluetooth
  // stack. GrantAccess() will not be called on this interface after this method
  // is called.
  GrantAccessToAllDevices();
};