#include "chrome/browser/ui/hid/hid_chooser_controller.h"
#include <utility>
#include <vector>
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/not_fatal_until.h"
#include "base/ranges/algorithm.h"
#include "chrome/browser/chooser_controller/title_util.h"
#include "chrome/browser/hid/hid_chooser_context.h"
#include "chrome/browser/hid/hid_chooser_context_factory.h"
#include "chrome/browser/hid/web_hid_histograms.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_contents.h"
#include "services/device/public/cpp/hid/hid_switches.h"
#include "ui/base/l10n/l10n_util.h"
namespace {
std::string PhysicalDeviceIdFromDeviceInfo(
const device::mojom::HidDeviceInfo& device) { … }
bool FilterMatch(const blink::mojom::HidDeviceFilterPtr& filter,
const device::mojom::HidDeviceInfo& device) { … }
}
HidChooserController::HidChooserController(
content::RenderFrameHost* render_frame_host,
std::vector<blink::mojom::HidDeviceFilterPtr> filters,
std::vector<blink::mojom::HidDeviceFilterPtr> exclusion_filters,
content::HidChooser::Callback callback)
: … { … }
HidChooserController::~HidChooserController() { … }
bool HidChooserController::ShouldShowHelpButton() const { … }
std::u16string HidChooserController::GetNoOptionsText() const { … }
std::u16string HidChooserController::GetOkButtonLabel() const { … }
std::pair<std::u16string, std::u16string>
HidChooserController::GetThrobberLabelAndTooltip() const { … }
size_t HidChooserController::NumOptions() const { … }
std::u16string HidChooserController::GetOption(size_t index) const { … }
bool HidChooserController::IsPaired(size_t index) const { … }
void HidChooserController::Select(const std::vector<size_t>& indices) { … }
void HidChooserController::Cancel() { … }
void HidChooserController::Close() { … }
void HidChooserController::OpenHelpCenterUrl() const { … }
void HidChooserController::OnDeviceAdded(
const device::mojom::HidDeviceInfo& device) { … }
void HidChooserController::OnDeviceRemoved(
const device::mojom::HidDeviceInfo& device) { … }
void HidChooserController::OnDeviceChanged(
const device::mojom::HidDeviceInfo& device) { … }
void HidChooserController::OnHidManagerConnectionError() { … }
void HidChooserController::OnHidChooserContextShutdown() { … }
void HidChooserController::OnGotDevices(
std::vector<device::mojom::HidDeviceInfoPtr> devices) { … }
bool HidChooserController::DisplayDevice(
const device::mojom::HidDeviceInfo& device) const { … }
bool HidChooserController::FilterMatchesAny(
const device::mojom::HidDeviceInfo& device) const { … }
bool HidChooserController::IsExcluded(
const device::mojom::HidDeviceInfo& device) const { … }
void HidChooserController::AddMessageToConsole(
blink::mojom::ConsoleMessageLevel level,
const std::string& message) const { … }
bool HidChooserController::AddDeviceInfo(
const device::mojom::HidDeviceInfo& device) { … }
bool HidChooserController::RemoveDeviceInfo(
const device::mojom::HidDeviceInfo& device) { … }
void HidChooserController::UpdateDeviceInfo(
const device::mojom::HidDeviceInfo& device) { … }