blob: 0c9fdd3e92275a5a964aa3cae4b6336b5d968ef7 [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 "device/usb/public/mojom/device.mojom";
import "device/usb/public/mojom/device_manager.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, device.mojom.UsbDevice& device_requestd);
// 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(device.mojom.UsbDeviceManagerClient client);
};