#include "content/browser/service_worker/service_worker_hid_delegate_observer.h"
#include <cstdint>
#include "base/functional/bind.h"
#include "base/memory/weak_ptr.h"
#include "content/browser/hid/hid_service.h"
#include "content/browser/service_worker/service_worker_context_core.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/service_worker/service_worker_registration.h"
#include "content/browser/service_worker/service_worker_version.h"
#include "content/public/browser/browser_context.h"
#include "third_party/blink/public/common/service_worker/embedded_worker_status.h"
#include "third_party/blink/public/common/service_worker/service_worker_status_code.h"
namespace content {
namespace {
bool HasDevicePermission(HidDelegate* delegate,
BrowserContext* browser_context,
const blink::StorageKey& key,
const device::mojom::HidDeviceInfo& device_info) { … }
}
ServiceWorkerHidDelegateObserver::ServiceWorkerHidDelegateObserver(
ServiceWorkerContextCore* context)
: … { … }
ServiceWorkerHidDelegateObserver::~ServiceWorkerHidDelegateObserver() = default;
void ServiceWorkerHidDelegateObserver::OnDeviceAdded(
const device::mojom::HidDeviceInfo& device_info) { … }
void ServiceWorkerHidDelegateObserver::OnDeviceRemoved(
const device::mojom::HidDeviceInfo& device_info) { … }
void ServiceWorkerHidDelegateObserver::OnDeviceChanged(
const device::mojom::HidDeviceInfo& device_info) { … }
void ServiceWorkerHidDelegateObserver::OnHidManagerConnectionError() { … }
void ServiceWorkerHidDelegateObserver::OnPermissionRevoked(
const url::Origin& origin) { … }
void ServiceWorkerHidDelegateObserver::RegisterHidService(
int64_t registration_id,
base::WeakPtr<HidService> hid_service) { … }
void ServiceWorkerHidDelegateObserver::RegistrationAdded(
int64_t registration_id) { … }
void ServiceWorkerHidDelegateObserver::RegistrationRemoved(
int64_t registration_id) { … }
void ServiceWorkerHidDelegateObserver::DispatchHidDeviceEventToWorkers(
const device::mojom::HidDeviceInfo& device_info,
HidServiceDeviceEventCallback callback) { … }
void ServiceWorkerHidDelegateObserver::WorkerStarted(
device::mojom::HidDeviceInfoPtr device_info,
HidServiceDeviceEventCallback callback,
scoped_refptr<ServiceWorkerVersion> version,
blink::ServiceWorkerStatusCode service_worker_status) { … }
HidService* ServiceWorkerHidDelegateObserver::GetHidService(
int64_t registration_id) { … }
}