#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/modules/gamepad/navigator_gamepad.h"
#include "base/auto_reset.h"
#include "device/gamepad/public/cpp/gamepad_features.h"
#include "device/gamepad/public/cpp/gamepads.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_metric_builder.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings.h"
#include "third_party/blink/public/mojom/frame/user_activation_notification_type.mojom-blink.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/navigator.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/loader/document_loader.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/modules/gamepad/gamepad.h"
#include "third_party/blink/renderer/modules/gamepad/gamepad_comparisons.h"
#include "third_party/blink/renderer/modules/gamepad/gamepad_dispatcher.h"
#include "third_party/blink/renderer/modules/gamepad/gamepad_event.h"
#include "third_party/blink/renderer/platform/privacy_budget/identifiability_digest_helpers.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
namespace blink {
namespace {
bool IsGamepadConnectionEvent(const AtomicString& event_type) { … }
bool HasConnectionEventListeners(LocalDOMWindow* window) { … }
}
const char NavigatorGamepad::kSupplementName[] = …;
const char kSecureContextBlocked[] = …;
const char kFeaturePolicyBlocked[] = …;
NavigatorGamepad& NavigatorGamepad::From(Navigator& navigator) { … }
namespace {
void RecordGamepadsForIdentifiabilityStudy(
ExecutionContext* context,
HeapVector<Member<Gamepad>> gamepads) { … }
}
HeapVector<Member<Gamepad>> NavigatorGamepad::getGamepads(
Navigator& navigator,
ExceptionState& exception_state) { … }
HeapVector<Member<Gamepad>> NavigatorGamepad::Gamepads() { … }
void NavigatorGamepad::SampleGamepads() { … }
GamepadHapticActuator* NavigatorGamepad::GetVibrationActuatorForGamepad(
const Gamepad& gamepad) { … }
void NavigatorGamepad::SetTouchEvents(const Gamepad& gamepad,
GamepadTouchVector& touch_events,
unsigned count,
const device::GamepadTouch* data) { … }
void NavigatorGamepad::Trace(Visitor* visitor) const { … }
bool NavigatorGamepad::StartUpdatingIfAttached() { … }
void NavigatorGamepad::DidUpdateData() { … }
NavigatorGamepad::NavigatorGamepad(Navigator& navigator)
: … { … }
NavigatorGamepad::~NavigatorGamepad() = default;
void NavigatorGamepad::RegisterWithDispatcher() { … }
void NavigatorGamepad::UnregisterWithDispatcher() { … }
bool NavigatorGamepad::HasLastData() { … }
void NavigatorGamepad::DidAddEventListener(LocalDOMWindow*,
const AtomicString& event_type) { … }
void NavigatorGamepad::DidRemoveEventListener(LocalDOMWindow* window,
const AtomicString& event_type) { … }
void NavigatorGamepad::DidRemoveAllEventListeners(LocalDOMWindow*) { … }
void NavigatorGamepad::DidRemoveGamepadEventListeners() { … }
void NavigatorGamepad::SampleAndCompareGamepadState() { … }
void NavigatorGamepad::DispatchGamepadEvent(const AtomicString& event_name,
Gamepad* gamepad) { … }
void NavigatorGamepad::PageVisibilityChanged() { … }
}