#include "services/device/hid/hid_service.h"
#include "base/at_exit.h"
#include "base/base64.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/observer_list.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "build/build_config.h"
#include "components/device_event_log/device_event_log.h"
#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && defined(USE_UDEV)
#include "services/device/hid/hid_service_linux.h"
#elif BUILDFLAG(IS_MAC)
#include "services/device/hid/hid_service_mac.h"
#elif BUILDFLAG(IS_WIN)
#include "services/device/hid/hid_service_win.h"
#elif BUILDFLAG(IS_FUCHSIA)
#include "services/device/hid/hid_service_fuchsia.h"
#endif
namespace device {
namespace {
std::string PlatformDeviceIdsToString(
const HidDeviceInfo::PlatformDeviceIdMap& platform_device_id_map) { … }
}
void HidService::Observer::OnDeviceAdded(mojom::HidDeviceInfoPtr device_info) { … }
void HidService::Observer::OnDeviceRemoved(
mojom::HidDeviceInfoPtr device_info) { … }
void HidService::Observer::OnDeviceChanged(
mojom::HidDeviceInfoPtr device_info) { … }
constexpr base::TaskTraits HidService::kBlockingTaskTraits;
std::unique_ptr<HidService> HidService::Create() { … }
void HidService::GetDevices(GetDevicesCallback callback) { … }
void HidService::AddObserver(HidService::Observer* observer) { … }
void HidService::RemoveObserver(HidService::Observer* observer) { … }
HidService::HidService() = default;
HidService::~HidService() { … }
void HidService::AddDevice(scoped_refptr<HidDeviceInfo> device_info) { … }
void HidService::RemoveDevice(const HidPlatformDeviceId& platform_device_id) { … }
void HidService::RunPendingEnumerations() { … }
void HidService::FirstEnumerationComplete() { … }
std::optional<std::string> HidService::FindDeviceGuidInDeviceMap(
const HidPlatformDeviceId& platform_device_id) { … }
scoped_refptr<HidDeviceInfo> HidService::FindSiblingDevice(
const HidDeviceInfo& device_info) const { … }
}