| 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 #include "third_party/ppapi/c/pp_input_event.h" | 7 #include "third_party/ppapi/c/pp_input_event.h" |
| 8 | 8 |
| 9 namespace remoting { | 9 namespace remoting { |
| 10 | 10 |
| 11 PepperInputHandler::PepperInputHandler(ClientContext* context, | 11 PepperInputHandler::PepperInputHandler(ClientContext* context, |
| 12 HostConnection* connection, | 12 HostConnection* connection, |
| 13 ChromotingView* view) | 13 ChromotingView* view) |
| 14 : InputHandler(context, connection, view) { | 14 : InputHandler(context, connection, view) { |
| 15 } | 15 } |
| 16 | 16 |
| 17 PepperInputHandler::~PepperInputHandler() { | 17 PepperInputHandler::~PepperInputHandler() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 void PepperInputHandler::Initialize() { | 20 void PepperInputHandler::Initialize() { |
| 21 } | 21 } |
| 22 | 22 |
| 23 void PepperInputHandler::HandleKeyEvent(bool keydown, | 23 void PepperInputHandler::HandleKeyEvent(bool keydown, |
| 24 const PP_InputEvent_Key& event) { | 24 const PP_InputEvent_Key& event) { |
| 25 SendKeyEvent(keydown, event.key_code); | 25 SendKeyEvent(keydown, event.key_code); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void PepperInputHandler::HandleCharacterEvent(const PP_InputEvent_Character& eve
nt) { | 28 void PepperInputHandler::HandleCharacterEvent( |
| 29 const PP_InputEvent_Character& event) { |
| 29 // TODO(garykac): Coordinate key and char events. | 30 // TODO(garykac): Coordinate key and char events. |
| 30 } | 31 } |
| 31 | 32 |
| 32 void PepperInputHandler::HandleMouseMoveEvent(const PP_InputEvent_Mouse& event)
{ | 33 void PepperInputHandler::HandleMouseMoveEvent(const PP_InputEvent_Mouse& event)
{ |
| 33 SendMouseMoveEvent(static_cast<int>(event.x), | 34 SendMouseMoveEvent(static_cast<int>(event.x), |
| 34 static_cast<int>(event.y)); | 35 static_cast<int>(event.y)); |
| 35 } | 36 } |
| 36 | 37 |
| 37 void PepperInputHandler::HandleMouseButtonEvent( | 38 void PepperInputHandler::HandleMouseButtonEvent( |
| 38 bool button_down, | 39 bool button_down, |
| 39 const PP_InputEvent_Mouse& event) { | 40 const PP_InputEvent_Mouse& event) { |
| 40 MouseButton button = MouseButtonUndefined; | 41 MouseButton button = MouseButtonUndefined; |
| 41 if (event.button == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { | 42 if (event.button == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { |
| 42 button = MouseButtonLeft; | 43 button = MouseButtonLeft; |
| 43 } else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) { | 44 } else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) { |
| 44 button = MouseButtonMiddle; | 45 button = MouseButtonMiddle; |
| 45 } else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) { | 46 } else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) { |
| 46 button = MouseButtonRight; | 47 button = MouseButtonRight; |
| 47 } | 48 } |
| 48 | 49 |
| 49 if (button != MouseButtonUndefined) { | 50 if (button != MouseButtonUndefined) { |
| 50 SendMouseButtonEvent(button_down, button); | 51 SendMouseButtonEvent(button_down, button); |
| 51 } | 52 } |
| 52 } | 53 } |
| 53 | 54 |
| 54 } // namespace remoting | 55 } // namespace remoting |
| OLD | NEW |