1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127

content / common / input / input_injector.mojom [blame]

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module content.mojom;

import "ui/gfx/geometry/mojom/geometry.mojom";
import "ui/events/mojom/scroll_granularity.mojom";
import "mojo/public/mojom/base/time.mojom";

// Describes which type of input events synthetic gesture objects should
// generate. When specifying DEFAULT_INPUT the platform will be queried for
// the preferred input event type.
enum GestureSourceType {
  kDefaultInput,
  kTouchInput,
  kMouseInput,
  kTouchpadInput = kMouseInput,
  kPenInput,
  kGestureSourceTypeMax = kPenInput,
};

enum PointerActionType {
  kNotInitialized,
  kPress,
  kMove,
  kRelease,
  kCancel,
  kLeave,
  kIdle,
};

enum SyntheticButton {
  kNoButton,
  kLeft,
  kMiddle,
  kRight,
  kBack,
  kForward,
};

enum InputEventPattern {
  kDefaultPattern,
  kOnePerVsync,
  kTwoPerVsync,
  kEveryOtherVsync,
};

// The smooth drag gesture parameters sent by the renderer to the browser, that
// are needed to queue the synthetic smooth drag gesture.
struct SyntheticSmoothDrag {
  GestureSourceType gesture_source_type;
  gfx.mojom.PointF start_point;
  array<gfx.mojom.Vector2dF> distances;
  float speed_in_pixels_s;
  float vsync_offset_ms;
  InputEventPattern input_event_pattern;
};

// The smooth drag gesture parameters sent by the renderer to the browser, that
// are needed to queue the synthetic smooth drag gesture.
struct SyntheticSmoothScroll {
  GestureSourceType gesture_source_type;
  gfx.mojom.PointF anchor;
  array<gfx.mojom.Vector2dF> distances;
  bool prevent_fling;
  float speed_in_pixels_s;
  float fling_velocity_x;
  float fling_velocity_y;
  ui.mojom.ScrollGranularity granularity;
  int32 modifiers;
  float vsync_offset_ms;
  InputEventPattern input_event_pattern;
};

// The pinth parameters sent by the renderer to the browser, that are needed to
// queue the synthetic pinch.
struct SyntheticPinch {
  float scale_factor;
  gfx.mojom.PointF anchor;
  float relative_pointer_speed_in_pixels_s;
  float vsync_offset_ms;
  InputEventPattern input_event_pattern;
};

// The tap parameters sent by the renderer to the browser, that are needed to
// queue the synthetic tap.
struct SyntheticTap {
  GestureSourceType gesture_source_type;
  gfx.mojom.PointF position;
  float duration_ms;
};

// It contains all the parameters to create the synthetic events of touch,
// mouse and pen inputs in SyntheticPointerAction::ForwardInputEvents function.
struct SyntheticPointerActionParams {
  PointerActionType pointer_action_type;
  gfx.mojom.PointF position;
  uint32 pointer_id;
  SyntheticButton button;
  int32 key_modifiers;
  float width;
  float height;
  float rotation_angle;
  float force;
  float tangential_pressure;
  int32 tilt_x;
  int32 tilt_y;
  mojo_base.mojom.TimeTicks timestamp;
  mojo_base.mojom.TimeDelta duration;
};

struct SyntheticPointerAction {
  GestureSourceType gesture_source_type;
  array<array<SyntheticPointerActionParams>> params;
};

// Host interface representing the ability to inject input
// from a less priviledged application. Available when
// --enable-gpu-benchmarking command line flag is provided.
interface InputInjector {
  QueueSyntheticSmoothDrag(SyntheticSmoothDrag drag) => ();
  QueueSyntheticSmoothScroll(SyntheticSmoothScroll scroll) => ();
  QueueSyntheticPinch(SyntheticPinch pinch) => ();
  QueueSyntheticTap(SyntheticTap tap) => ();
  QueueSyntheticPointerAction(SyntheticPointerAction pointer_action) => ();
};