#include "content/browser/hid/hid_service.h"
#include <map>
#include <memory>
#include <utility>
#include "base/containers/contains.h"
#include "base/debug/stack_trace.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "content/browser/service_worker/service_worker_hid_delegate_observer.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/document_service.h"
#include "content/public/browser/hid_chooser.h"
#include "content/public/browser/hid_delegate.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/common/content_client.h"
#include "mojo/public/cpp/bindings/message.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom.h"
namespace content {
class DocumentHelper
: public content::DocumentService<blink::mojom::HidService> { … };
HidService::HidService(
RenderFrameHostImpl* render_frame_host,
base::WeakPtr<ServiceWorkerVersion> service_worker_version,
const url::Origin& origin)
: … { … }
HidService::HidService(RenderFrameHostImpl* render_frame_host)
: … { … }
HidService::HidService(
base::WeakPtr<ServiceWorkerVersion> service_worker_version,
const url::Origin& origin)
: … { … }
HidService::~HidService() { … }
void HidService::Create(
RenderFrameHostImpl* render_frame_host,
mojo::PendingReceiver<blink::mojom::HidService> receiver) { … }
void HidService::Create(
base::WeakPtr<ServiceWorkerVersion> service_worker_version,
const url::Origin& origin,
mojo::PendingReceiver<blink::mojom::HidService> receiver) { … }
void HidService::RemoveProtectedReports(device::mojom::HidDeviceInfo& device,
bool is_fido_allowed) { … }
void HidService::RegisterClient(
mojo::PendingAssociatedRemote<device::mojom::HidManagerClient> client) { … }
void HidService::GetDevices(GetDevicesCallback callback) { … }
void HidService::RequestDevice(
std::vector<blink::mojom::HidDeviceFilterPtr> filters,
std::vector<blink::mojom::HidDeviceFilterPtr> exclusion_filters,
RequestDeviceCallback callback) { … }
void HidService::Connect(
const std::string& device_guid,
mojo::PendingRemote<device::mojom::HidConnectionClient> client,
ConnectCallback callback) { … }
void HidService::Forget(device::mojom::HidDeviceInfoPtr device_info,
ForgetCallback callback) { … }
void HidService::OnWatcherRemoved(bool cleanup_watcher_ids,
size_t watchers_removed) { … }
void HidService::IncrementActivityCount() { … }
void HidService::DecrementActivityCount() { … }
void HidService::OnDeviceAdded(
const device::mojom::HidDeviceInfo& device_info) { … }
void HidService::OnDeviceRemoved(
const device::mojom::HidDeviceInfo& device_info) { … }
void HidService::OnDeviceChanged(
const device::mojom::HidDeviceInfo& device_info) { … }
void HidService::OnHidManagerConnectionError() { … }
void HidService::OnPermissionRevoked(const url::Origin& origin) { … }
void HidService::FinishGetDevices(
GetDevicesCallback callback,
std::vector<device::mojom::HidDeviceInfoPtr> devices) { … }
void HidService::FinishRequestDevice(
RequestDeviceCallback callback,
std::vector<device::mojom::HidDeviceInfoPtr> devices) { … }
void HidService::FinishConnect(
ConnectCallback callback,
mojo::PendingRemote<device::mojom::HidConnection> connection) { … }
BrowserContext* HidService::GetBrowserContext() { … }
}