#include "services/device/public/cpp/hid/hid_collection.h"
#include <algorithm>
#include <limits>
#include <utility>
#include "base/format_macros.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ref.h"
#include "base/strings/stringprintf.h"
#include "services/device/public/cpp/hid/hid_item_state_table.h"
namespace device {
namespace {
static constexpr uint32_t kMaxItemReportSizeBits = …;
static constexpr uint64_t kMaxReasonableReportLengthBits = …;
static constexpr int kMaxReasonableCollectionDepth = …;
}
HidCollection::HidCollection(HidCollection* parent,
uint32_t usage_page,
uint32_t usage,
uint32_t type)
: … { … }
HidCollection::~HidCollection() = default;
std::vector<std::unique_ptr<HidCollection>> HidCollection::BuildCollections(
const std::vector<std::unique_ptr<HidReportDescriptorItem>>& items) { … }
void HidCollection::AddCollection(
const HidReportDescriptorItem& item,
std::vector<std::unique_ptr<HidCollection>>& collections,
HidItemStateTable& state) { … }
void HidCollection::AddChildForTesting(
std::unique_ptr<HidCollection> collection) { … }
void HidCollection::AddReportItem(HidReportDescriptorItem::Tag tag,
uint32_t report_info,
const HidItemStateTable& state) { … }
void HidCollection::GetMaxReportSizes(size_t* max_input_report_bits,
size_t* max_output_report_bits,
size_t* max_feature_report_bits) const { … }
mojom::HidCollectionInfoPtr HidCollection::ToMojo() const { … }
}