OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/client/plugin/pepper_input_handler.h" | 5 #include "remoting/client/plugin/pepper_input_handler.h" |
6 | 6 |
7 namespace remoting { | 7 namespace remoting { |
8 | 8 |
9 PepperInputHandler::PepperInputHandler(ClientContext* context, | 9 PepperInputHandler::PepperInputHandler(ClientContext* context, |
10 HostConnection* connection, | 10 HostConnection* connection, |
11 ChromotingView* view) | 11 ChromotingView* view) |
12 : InputHandler(context, connection, view) { | 12 : InputHandler(context, connection, view) { |
13 } | 13 } |
14 | 14 |
15 PepperInputHandler::~PepperInputHandler() { | 15 PepperInputHandler::~PepperInputHandler() { |
16 } | 16 } |
17 | 17 |
18 void PepperInputHandler::Initialize() { | 18 void PepperInputHandler::Initialize() { |
19 } | 19 } |
20 | 20 |
| 21 void PepperInputHandler::HandleKeyEvent(bool keydown, |
| 22 const PP_Event_Key& event) { |
| 23 SendKeyEvent(keydown, event.normalizedKeyCode); |
| 24 } |
| 25 |
| 26 void PepperInputHandler::HandleCharacterEvent(const PP_Event_Character& event) { |
| 27 // TODO(garykac): Coordinate key and char events. |
| 28 } |
| 29 |
21 void PepperInputHandler::HandleMouseMoveEvent(const PP_Event_Mouse& event) { | 30 void PepperInputHandler::HandleMouseMoveEvent(const PP_Event_Mouse& event) { |
22 SendMouseMoveEvent(static_cast<int>(event.x), | 31 SendMouseMoveEvent(static_cast<int>(event.x), |
23 static_cast<int>(event.y)); | 32 static_cast<int>(event.y)); |
24 } | 33 } |
25 | 34 |
26 void PepperInputHandler::HandleMouseButtonEvent(bool button_down, | 35 void PepperInputHandler::HandleMouseButtonEvent(bool button_down, |
27 const PP_Event_Mouse& event) { | 36 const PP_Event_Mouse& event) { |
28 MouseButton button = MouseButtonUndefined; | 37 MouseButton button = MouseButtonUndefined; |
29 if (event.button == PP_EVENT_MOUSEBUTTON_LEFT) { | 38 if (event.button == PP_EVENT_MOUSEBUTTON_LEFT) { |
30 button = MouseButtonLeft; | 39 button = MouseButtonLeft; |
31 } else if (event.button == PP_EVENT_MOUSEBUTTON_MIDDLE) { | 40 } else if (event.button == PP_EVENT_MOUSEBUTTON_MIDDLE) { |
32 button = MouseButtonMiddle; | 41 button = MouseButtonMiddle; |
33 } else if (event.button == PP_EVENT_MOUSEBUTTON_RIGHT) { | 42 } else if (event.button == PP_EVENT_MOUSEBUTTON_RIGHT) { |
34 button = MouseButtonRight; | 43 button = MouseButtonRight; |
35 } | 44 } |
36 | 45 |
37 if (button != MouseButtonUndefined) { | 46 if (button != MouseButtonUndefined) { |
38 SendMouseButtonEvent(button_down, button); | 47 SendMouseButtonEvent(button_down, button); |
39 } | 48 } |
40 } | 49 } |
41 | 50 |
42 } // namespace remoting | 51 } // namespace remoting |
OLD | NEW |