#include "extensions/common/permissions/usb_device_permission.h"
#include <string>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "extensions/common/extension.h"
#include "extensions/common/features/behavior_feature.h"
#include "extensions/common/features/feature.h"
#include "extensions/common/features/feature_provider.h"
#include "extensions/common/permissions/permissions_info.h"
#include "extensions/strings/grit/extensions_strings.h"
#include "services/device/public/cpp/usb/usb_ids.h"
#include "ui/base/l10n/l10n_util.h"
namespace extensions {
namespace {
const int kHidInterfaceClass = …;
bool IsInterfaceClassPermissionAlowed(const Extension* extension) { … }
}
std::unique_ptr<UsbDevicePermission::CheckParam>
UsbDevicePermission::CheckParam::ForUsbDevice(
const Extension* extension,
const device::mojom::UsbDeviceInfo& device_info) { … }
std::unique_ptr<UsbDevicePermission::CheckParam>
UsbDevicePermission::CheckParam::ForDeviceWithAnyInterfaceClass(
const Extension* extension,
uint16_t vendor_id,
uint16_t product_id,
int interface_id) { … }
std::unique_ptr<UsbDevicePermission::CheckParam>
UsbDevicePermission::CheckParam::ForUsbDeviceAndInterface(
const Extension* extension,
const device::mojom::UsbDeviceInfo& device_info,
int interface_id) { … }
std::unique_ptr<UsbDevicePermission::CheckParam>
UsbDevicePermission::CheckParam::ForHidDevice(const Extension* extension,
uint16_t vendor_id,
uint16_t product_id) { … }
UsbDevicePermission::CheckParam::CheckParam(
const Extension* extension,
uint16_t vendor_id,
uint16_t product_id,
std::unique_ptr<std::set<int>> interface_classes,
int interface_id)
: … { … }
UsbDevicePermission::CheckParam::~CheckParam() = default;
UsbDevicePermission::UsbDevicePermission(const APIPermissionInfo* info)
: … { … }
UsbDevicePermission::~UsbDevicePermission() = default;
bool UsbDevicePermission::FromValue(
const base::Value* value,
std::string* error,
std::vector<std::string>* unhandled_permissions) { … }
PermissionIDSet UsbDevicePermission::GetPermissions() const { … }
}