# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Contributing to Chrome DevTools Protocol: https://goo.gle/devtools-contribution-guide-cdp

experimental domain DeviceAccess
  # Device request id.
  type RequestId extends string

  # A device id.
  type DeviceId extends string

  # Device information displayed in a user prompt to select a device.
  type PromptDevice extends object
    properties
      DeviceId id
      # Display name as it appears in a device request user prompt.
      string name

  # Enable events in this domain.
  command enable

  # Disable events in this domain.
  command disable

  # Select a device in response to a DeviceAccess.deviceRequestPrompted event.
  command selectPrompt
    parameters
      RequestId id
      DeviceId deviceId

  # Cancel a prompt in response to a DeviceAccess.deviceRequestPrompted event.
  command cancelPrompt
    parameters
      RequestId id

  # A device request opened a user prompt to select a device. Respond with the
  # selectPrompt or cancelPrompt command.
  event deviceRequestPrompted
    parameters
      RequestId id
      array of PromptDevice devices
