#include "services/device/public/cpp/hid/hid_blocklist.h"
#include <string_view>
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/no_destructor.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "components/variations/variations_associated_data.h"
#include "services/device/public/cpp/hid/hid_switches.h"
#include "services/device/public/mojom/hid.mojom.h"
namespace device {
namespace {
#define VENDOR_PRODUCT_RULE(vid, pid) …
constexpr HidBlocklist::Entry kStaticEntries[] = …;
bool IsValidBlocklistEntry(const HidBlocklist::Entry& entry) { … }
const std::vector<mojom::HidReportDescriptionPtr>& GetReportsForType(
HidBlocklist::ReportType report_type,
const mojom::HidCollectionInfo& collection) { … }
void CheckBlocklistEntry(
const HidBlocklist::Entry& entry,
HidBlocklist::ReportType report_type,
uint16_t vendor_id,
uint16_t product_id,
const std::vector<mojom::HidCollectionInfoPtr>& collections,
std::set<uint8_t>& protected_ids) { … }
bool IsHexComponent(std::string_view string, size_t digits) { … }
bool IsReportTypeComponent(std::string_view string) { … }
}
BASE_FEATURE(…);
constexpr base::FeatureParam<std::string> kWebHidBlocklistAdditions{ … };
HidBlocklist& HidBlocklist::Get() { … }
bool HidBlocklist::IsVendorProductBlocked(uint16_t vendor_id,
uint16_t product_id) { … }
bool HidBlocklist::IsVendorProductBlockedByEntry(
const HidBlocklist::Entry& entry,
uint16_t vendor_id,
uint16_t product_id) { … }
std::vector<uint8_t> HidBlocklist::GetProtectedReportIds(
HidBlocklist::ReportType report_type,
uint16_t vendor_id,
uint16_t product_id,
const std::vector<mojom::HidCollectionInfoPtr>& collections) { … }
void HidBlocklist::PopulateWithServerProvidedValues() { … }
void HidBlocklist::ResetToDefaultValuesForTest() { … }
HidBlocklist::HidBlocklist() { … }
}