chromium/services/device/public/cpp/hid/hid_blocklist.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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) {}

// Iterates over |collections| to find reports of type |report_type| that should
// be protected according to the blocklist rule |entry|. |vendor_id| and
// |product_id| are the vendor and product IDs of the device with these reports.
// The report IDs of the protected reports are inserted into |protected_ids|.
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) {}

// Returns true if the passed string is exactly |digits| digits long and only
// contains valid hexadecimal characters (no leading 0x).
bool IsHexComponent(std::string_view string, size_t digits) {}

// Returns true if the passed string is "I" (input report), "O" (output report),
// "F" (feature report), or "" (any report type).
bool IsReportTypeComponent(std::string_view string) {}

}  // namespace

BASE_FEATURE();

constexpr base::FeatureParam<std::string> kWebHidBlocklistAdditions{};

// static
HidBlocklist& HidBlocklist::Get() {}

bool HidBlocklist::IsVendorProductBlocked(uint16_t vendor_id,
                                          uint16_t product_id) {}

// static
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() {}

}  // namespace device