#include "third_party/blink/renderer/modules/gamepad/gamepad_haptic_actuator.h"
#include "base/functional/callback_helpers.h"
#include "device/gamepad/public/cpp/gamepad.h"
#include "third_party/blink/public/mojom/devtools/console_message.mojom-blink.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gamepad_effect_parameters.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gamepad_haptics_result.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/modules/gamepad/gamepad_dispatcher.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
namespace {
GamepadHapticsResult;
GamepadHapticEffectType;
const char kGamepadHapticActuatorTypeVibration[] = …;
const char kGamepadHapticActuatorTypeDualRumble[] = …;
const char kGamepadHapticEffectTypeDualRumble[] = …;
const char kGamepadHapticEffectTypeTriggerRumble[] = …;
GamepadHapticEffectType EffectTypeFromString(const String& type) { … }
V8GamepadHapticsResult ResultToV8(GamepadHapticsResult result) { … }
}
GamepadHapticActuator::GamepadHapticActuator(
ExecutionContext& context,
int pad_index,
device::GamepadHapticActuatorType type)
: … { … }
GamepadHapticActuator::~GamepadHapticActuator() = default;
void GamepadHapticActuator::SetType(device::GamepadHapticActuatorType type) { … }
ScriptPromise<V8GamepadHapticsResult> GamepadHapticActuator::playEffect(
ScriptState* script_state,
const String& type,
const GamepadEffectParameters* params) { … }
void GamepadHapticActuator::OnPlayEffectCompleted(
ScriptPromiseResolver<V8GamepadHapticsResult>* resolver,
device::mojom::GamepadHapticsResult result) { … }
void GamepadHapticActuator::ResetVibrationIfNotPreempted() { … }
ScriptPromise<V8GamepadHapticsResult> GamepadHapticActuator::reset(
ScriptState* script_state) { … }
void GamepadHapticActuator::OnResetCompleted(
ScriptPromiseResolver<V8GamepadHapticsResult>* resolver,
device::mojom::GamepadHapticsResult result) { … }
void GamepadHapticActuator::Trace(Visitor* visitor) const { … }
}