blob: d10d99e3ef3c5f1181bec0a83f571a6c456eac01 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module blink.mojom;
import "services/device/public/mojom/usb_device.mojom";
import "services/device/public/mojom/usb_enumeration_options.mojom";
import "services/device/public/mojom/usb_manager_client.mojom";
// This is a parallel interface with UsbDeviceManager aimed to handle extra work
// such as permission checking, chooser showing, etc. in browser.
// WebUsbServiceImpl in //chrome/browser/usb will implement this interface, and
// it will be used by webusb module in //third_party/blink/renderer/modules/.
interface WebUsbService {
// Retrieves information about all devices available.
GetDevices() => (array<device.mojom.UsbDeviceInfo> results);
// Requests a device by guid.
GetDevice(string guid,
pending_receiver<device.mojom.UsbDevice> device_receiver);
// Get permission from user to use a device.
//
// |device_filters| filters the available devices and the filtered
// devices will be listed for user to grant permission.
//
// |result| is the device that user grants permission to use.
GetPermission(array<device.mojom.UsbDeviceFilter> device_filters)
=> (device.mojom.UsbDeviceInfo? result);
// Sets the client for this WebUsbService.
SetClient(
pending_associated_remote<device.mojom.UsbDeviceManagerClient> client);
};