OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014 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 // Mirrored in src/chrome/test/remoting/remote_test_helper.h | |
6 var ACTIONS = { | |
Jamie
2014/12/17 03:15:41
Call this Action for consistency with the C++ code
Mike Meade
2014/12/18 18:54:25
Done.
| |
7 Error: -1, | |
Jamie
2014/12/17 03:15:41
Nit: Indentation. Also, the values are not consist
Mike Meade
2014/12/18 18:54:25
Done.
| |
8 None: 0, | |
9 keyDown: 1, | |
10 buttonPress: 2, | |
11 mouseMove: 3, | |
12 mouseWheel: 4, | |
13 drag: 5 | |
14 }; | |
15 | |
16 /** | |
17 * Method to handle sending keypress events to the server. | |
18 * @param {Event} event The event handler event. | |
19 **/ | |
20 function handleKeyPress(event) { | |
21 jsonRpc.setLastEvent(ACTIONS.keyDown, event.keyCode, 0); | |
22 } | |
23 | |
24 /** | |
25 * Method to handle sending mouse down events to the server. | |
26 * @param {Event} event The event handler event. | |
27 **/ | |
28 function handleMouseDown(event) { | |
29 jsonRpc.setLastEvent(ACTIONS.buttonPress, event.button, 0); | |
30 } | |
31 | |
32 /** | |
33 * Method to handle sending mouse move events to the server. | |
34 * @param {Event} event The event handler event. | |
35 **/ | |
36 function handleMouseMove(event) { | |
37 jsonRpc.setLastEvent(ACTIONS.mouseMove, event.keyCode, 0); | |
38 } | |
39 | |
40 /** | |
41 * Method to handle sending mouse wheel events to the server. | |
42 * @param {Event} event The event handler event. | |
43 **/ | |
44 function handleMouseWheel(event) { | |
45 jsonRpc.setLastEvent(ACTIONS.mouseWheel, 0, 0); | |
46 } | |
47 | |
48 /** | |
49 * Method to handle sending drag events to the server. | |
50 * @param {Event} event The event handler event. | |
51 **/ | |
52 function handleDrag(event) { | |
53 jsonRpc.setLastEvent(ACTIONS.drag, 0, 0); | |
54 } | |
55 | |
56 window.addEventListener('keydown', handleKeyPress, false); | |
57 window.addEventListener('mousedown', handleMouseDown, false); | |
58 window.addEventListener('mousewheel', handleMouseWheel, false); | |
59 window.addEventListener('drag', handleDrag, false); | |
60 // window.addEventListener('mousemove', handleMouseMove, false) | |
OLD | NEW |