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 Action = { |
| 7 Error: 0, |
| 8 None: 1, |
| 9 Keydown: 2, |
| 10 Buttonpress: 3, |
| 11 Mousemove: 4, |
| 12 Mousewheel: 5, |
| 13 Drag: 6 |
| 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(Action.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(Action.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(Action.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(Action.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(Action.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 |