#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "content/web_test/renderer/gamepad_controller.h"
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "content/public/renderer/render_frame.h"
#include "gin/arguments.h"
#include "gin/handle.h"
#include "gin/object_template_builder.h"
#include "gin/wrappable.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/public/platform/scheduler/web_agent_group_scheduler.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "v8/include/v8.h"
Gamepad;
Gamepads;
namespace content {
namespace {
constexpr float kButtonPressedThreshold = …;
int64_t CurrentTimeInMicroseconds() { … }
}
class GamepadControllerBindings
: public gin::Wrappable<GamepadControllerBindings> { … };
gin::WrapperInfo GamepadControllerBindings::kWrapperInfo = …;
void GamepadControllerBindings::Install(
base::WeakPtr<GamepadController> controller,
blink::WebLocalFrame* frame) { … }
GamepadControllerBindings::GamepadControllerBindings(
base::WeakPtr<GamepadController> controller)
: … { … }
GamepadControllerBindings::~GamepadControllerBindings() { … }
gin::ObjectTemplateBuilder GamepadControllerBindings::GetObjectTemplateBuilder(
v8::Isolate* isolate) { … }
void GamepadControllerBindings::Connect(int index) { … }
void GamepadControllerBindings::DispatchConnected(int index) { … }
void GamepadControllerBindings::Disconnect(int index) { … }
void GamepadControllerBindings::SetId(int index, const std::string& src) { … }
void GamepadControllerBindings::SetButtonCount(int index, int buttons) { … }
void GamepadControllerBindings::SetButtonData(int index,
int button,
double data) { … }
void GamepadControllerBindings::SetAxisCount(int index, int axes) { … }
void GamepadControllerBindings::SetAxisData(int index, int axis, double data) { … }
void GamepadControllerBindings::SetDualRumbleVibrationActuator(int index,
bool enabled) { … }
void GamepadControllerBindings::SetTriggerRumbleVibrationActuator(
int index,
bool enabled) { … }
void GamepadControllerBindings::SetTouchData(int index,
int touch,
unsigned int touch_id,
float position_x,
float position_y) { … }
void GamepadControllerBindings::SetTouchCount(int index, int touches) { … }
GamepadController::MonitorImpl::MonitorImpl(
GamepadController* controller,
mojo::PendingReceiver<device::mojom::GamepadMonitor> receiver)
: … { … }
GamepadController::MonitorImpl::~MonitorImpl() = default;
bool GamepadController::MonitorImpl::HasPendingConnect(int index) { … }
void GamepadController::MonitorImpl::GamepadStartPolling(
GamepadStartPollingCallback callback) { … }
void GamepadController::MonitorImpl::GamepadStopPolling(
GamepadStopPollingCallback callback) { … }
void GamepadController::MonitorImpl::SetObserver(
mojo::PendingRemote<device::mojom::GamepadObserver> observer) { … }
void GamepadController::MonitorImpl::DispatchConnected(
int index,
const device::Gamepad& pad) { … }
void GamepadController::MonitorImpl::DispatchDisconnected(
int index,
const device::Gamepad& pad) { … }
void GamepadController::MonitorImpl::Reset() { … }
GamepadController::GamepadController() { … }
GamepadController::~GamepadController() = default;
void GamepadController::Reset() { … }
void GamepadController::Install(RenderFrame* frame) { … }
void GamepadController::OnInterfaceRequest(
mojo::ScopedMessagePipeHandle handle) { … }
base::ReadOnlySharedMemoryRegion GamepadController::GetSharedMemoryRegion()
const { … }
void GamepadController::OnConnectionError(
GamepadController::MonitorImpl* monitor) { … }
void GamepadController::NotifyForMissedDispatches(
GamepadController::MonitorImpl* monitor) { … }
void GamepadController::Connect(int index) { … }
void GamepadController::DispatchConnected(int index) { … }
void GamepadController::Disconnect(int index) { … }
void GamepadController::SetId(int index, const std::string& src) { … }
void GamepadController::SetButtonCount(int index, int buttons) { … }
void GamepadController::SetButtonData(int index, int button, double data) { … }
void GamepadController::SetAxisCount(int index, int axes) { … }
void GamepadController::SetAxisData(int index, int axis, double data) { … }
void GamepadController::SetDualRumbleVibrationActuator(int index,
bool enabled) { … }
void GamepadController::SetTriggerRumbleVibrationActuator(int index,
bool enabled) { … }
void GamepadController::SetTouchCount(int index, int touches) { … }
void GamepadController::SetTouchData(int index,
int touch,
unsigned int touch_id,
float position_x,
float position_y) { … }
}