1// Copyright (c) 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_TEST_CHROMEDRIVER_CHROME_UI_EVENTS_H_
6#define CHROME_TEST_CHROMEDRIVER_CHROME_UI_EVENTS_H_
7
8#include <string>
9
10#include "ui/events/keycodes/keyboard_codes.h"
11
12// Specifies the type of the mouse event.
13enum MouseEventType {
14  kPressedMouseEventType = 0,
15  kReleasedMouseEventType,
16  kMovedMouseEventType
17};
18
19// Specifies the mouse buttons.
20enum MouseButton {
21  kLeftMouseButton = 0,
22  kMiddleMouseButton,
23  kRightMouseButton,
24  kNoneMouseButton
25};
26
27struct MouseEvent {
28  MouseEvent(MouseEventType type,
29             MouseButton button,
30             int x,
31             int y,
32             int modifiers,
33             int click_count);
34  ~MouseEvent();
35
36  MouseEventType type;
37  MouseButton button;
38  int x;
39  int y;
40  int modifiers;
41  // |click_count| should not be negative.
42  int click_count;
43};
44
45// Specifies the type of the touch event.
46enum TouchEventType {
47  kTouchStart = 0,
48  kTouchEnd,
49  kTouchMove,
50};
51
52struct TouchEvent {
53  TouchEvent(TouchEventType type,
54             int x,
55             int y);
56  ~TouchEvent();
57
58  TouchEventType type;
59  int x;
60  int y;
61};
62
63// Specifies the type of the keyboard event.
64enum KeyEventType {
65  kKeyDownEventType = 0,
66  kKeyUpEventType,
67  kRawKeyDownEventType,
68  kCharEventType
69};
70
71// Specifies modifier keys as stated in
72// third_party/WebKit/Source/WebCore/inspector/Inspector.json.
73// Notice: |kNumLockKeyModifierMask| is for usage in the key_converter.cc
74//         and keycode_text_conversion_x.cc only, not for inspector.
75enum KeyModifierMask {
76  kAltKeyModifierMask = 1 << 0,
77  kControlKeyModifierMask = 1 << 1,
78  kMetaKeyModifierMask = 1 << 2,
79  kShiftKeyModifierMask = 1 << 3,
80  kNumLockKeyModifierMask = 1 << 4
81};
82
83struct KeyEvent {
84  KeyEvent(KeyEventType type,
85           int modifiers,
86           const std::string& modified_text,
87           const std::string& unmodified_text,
88           ui::KeyboardCode key_code);
89  ~KeyEvent();
90
91  KeyEventType type;
92  int modifiers;
93  std::string modified_text;
94  std::string unmodified_text;
95  ui::KeyboardCode key_code;
96};
97
98#endif  // CHROME_TEST_CHROMEDRIVER_CHROME_UI_EVENTS_H_
99