#include "content/browser/renderer_host/input/touch_emulator_impl.h"
#include <memory>
#include <utility>
#include "base/containers/queue.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/input/render_widget_host_view_input.h"
#include "components/input/web_touch_event_traits.h"
#include "content/browser/renderer_host/input/motion_event_web.h"
#include "content/common/input/events_helper.h"
#include "content/grit/content_resources.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "third_party/blink/public/common/input/web_keyboard_event.h"
#include "third_party/blink/public/common/input/web_mouse_event.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
#include "ui/base/ui_base_types.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/blink/blink_event_util.h"
#include "ui/events/gesture_detection/gesture_provider_config_helper.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gfx/image/image.h"
WebGestureEvent;
WebInputEvent;
WebKeyboardEvent;
WebMouseEvent;
WebMouseWheelEvent;
WebTouchEvent;
WebTouchPoint;
namespace content {
namespace {
ui::GestureProvider::Config GetEmulatorGestureProviderConfig(
ui::GestureProviderConfigType config_type,
input::TouchEmulator::Mode mode) { … }
int ModifiersWithoutMouseButtons(const WebInputEvent& event) { … }
constexpr base::TimeDelta kMouseMoveDropInterval = …;
}
TouchEmulatorImpl::TouchEmulatorImpl(input::TouchEmulatorClient* client,
float device_scale_factor)
: … { … }
TouchEmulatorImpl::~TouchEmulatorImpl() { … }
void TouchEmulatorImpl::ResetState() { … }
void TouchEmulatorImpl::Enable(Mode mode,
ui::GestureProviderConfigType config_type) { … }
void TouchEmulatorImpl::Disable() { … }
void TouchEmulatorImpl::SetDeviceScaleFactor(float device_scale_factor) { … }
void TouchEmulatorImpl::SetDoubleTapSupportForPageEnabled(bool enabled) { … }
bool TouchEmulatorImpl::IsEnabled() const { … }
void TouchEmulatorImpl::InitCursors() { … }
ui::Cursor TouchEmulatorImpl::InitCursorFromResource(int resource_id) { … }
bool TouchEmulatorImpl::HandleMouseEvent(
const WebMouseEvent& mouse_event,
input::RenderWidgetHostViewInput* target_view) { … }
bool TouchEmulatorImpl::HandleMouseWheelEvent(const WebMouseWheelEvent& event) { … }
bool TouchEmulatorImpl::HandleKeyboardEvent(const WebKeyboardEvent& event) { … }
bool TouchEmulatorImpl::HandleTouchEvent(const blink::WebTouchEvent& event) { … }
bool TouchEmulatorImpl::HandleEmulatedTouchEvent(
blink::WebTouchEvent event,
input::RenderWidgetHostViewInput* target_view) { … }
bool TouchEmulatorImpl::HandleTouchEventAck(
const blink::WebTouchEvent& event,
blink::mojom::InputEventResultState ack_result) { … }
void TouchEmulatorImpl::OnGestureEventAck(const WebGestureEvent& event,
input::RenderWidgetHostViewInput*) { … }
void TouchEmulatorImpl::OnViewDestroyed(
input::RenderWidgetHostViewInput* destroyed_view) { … }
void TouchEmulatorImpl::OnGestureEvent(const ui::GestureEventData& gesture) { … }
bool TouchEmulatorImpl::RequiresDoubleTapGestureEvents() const { … }
void TouchEmulatorImpl::InjectTouchEvent(
const blink::WebTouchEvent& event,
input::RenderWidgetHostViewInput* target_view,
base::OnceClosure callback) { … }
void TouchEmulatorImpl::OnInjectedTouchCompleted() { … }
void TouchEmulatorImpl::CancelTouch() { … }
void TouchEmulatorImpl::UpdateCursor() { … }
bool TouchEmulatorImpl::UpdateShiftPressed(bool shift_pressed) { … }
void TouchEmulatorImpl::PinchBegin(const WebGestureEvent& event) { … }
void TouchEmulatorImpl::PinchUpdate(const WebGestureEvent& event) { … }
void TouchEmulatorImpl::PinchEnd(const WebGestureEvent& event) { … }
void TouchEmulatorImpl::ScrollEnd(const WebGestureEvent& event) { … }
WebGestureEvent TouchEmulatorImpl::GetPinchGestureEvent(
WebInputEvent::Type type,
const WebGestureEvent& original_event) { … }
void TouchEmulatorImpl::FillTouchEventAndPoint(const WebMouseEvent& mouse_event,
const gfx::PointF& pos_in_root) { … }
bool TouchEmulatorImpl::InPinchGestureMode() const { … }
void TouchEmulatorImpl::SetPinchGestureModeForTesting(bool pinch_gesture_mode) { … }
}