Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(669)

Side by Side Diff: remoting/client/plugin/pepper_input_handler.cc

Issue 7466002: Reland http://codereview.chromium.org/7452002/, update chromoting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/client/plugin/pepper_input_handler.h ('k') | webkit/plugins/ppapi/event_conversion.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ppapi/c/pp_input_event.h" 7 #include "ppapi/c/pp_input_event.h"
8 #include "ppapi/cpp/input_event.h"
9 #include "ppapi/cpp/point.h"
8 #include "remoting/client/chromoting_view.h" 10 #include "remoting/client/chromoting_view.h"
9 #include "ui/gfx/point.h" 11 #include "ui/gfx/point.h"
10 12
11 namespace remoting { 13 namespace remoting {
12 14
15 using pp::KeyboardInputEvent;
16 using pp::MouseInputEvent;
13 using protocol::KeyEvent; 17 using protocol::KeyEvent;
14 using protocol::MouseEvent; 18 using protocol::MouseEvent;
15 19
16 PepperInputHandler::PepperInputHandler(ClientContext* context, 20 PepperInputHandler::PepperInputHandler(ClientContext* context,
17 protocol::ConnectionToHost* connection, 21 protocol::ConnectionToHost* connection,
18 ChromotingView* view) 22 ChromotingView* view)
19 : InputHandler(context, connection, view) { 23 : InputHandler(context, connection, view) {
20 } 24 }
21 25
22 PepperInputHandler::~PepperInputHandler() { 26 PepperInputHandler::~PepperInputHandler() {
23 } 27 }
24 28
25 void PepperInputHandler::Initialize() { 29 void PepperInputHandler::Initialize() {
26 } 30 }
27 31
28 void PepperInputHandler::HandleKeyEvent(bool keydown, 32 void PepperInputHandler::HandleKeyEvent(bool keydown,
29 const PP_InputEvent_Key& event) { 33 const KeyboardInputEvent& event) {
30 SendKeyEvent(keydown, event.key_code); 34 SendKeyEvent(keydown, event.GetKeyCode());
31 } 35 }
32 36
33 void PepperInputHandler::HandleCharacterEvent( 37 void PepperInputHandler::HandleCharacterEvent(const KeyboardInputEvent& event) {
34 const PP_InputEvent_Character& event) {
35 // TODO(garykac): Coordinate key and char events. 38 // TODO(garykac): Coordinate key and char events.
36 } 39 }
37 40
38 void PepperInputHandler::HandleMouseMoveEvent( 41 void PepperInputHandler::HandleMouseMoveEvent(const MouseInputEvent& event) {
39 const PP_InputEvent_Mouse& event) { 42 gfx::Point p(static_cast<int>(event.GetMousePosition().x()),
40 gfx::Point p(static_cast<int>(event.x), static_cast<int>(event.y)); 43 static_cast<int>(event.GetMousePosition().y()));
41 // Pepper gives co-ordinates in the plugin instance's co-ordinate system, 44 // Pepper gives co-ordinates in the plugin instance's co-ordinate system,
42 // which may be different from the host desktop's co-ordinate system. 45 // which may be different from the host desktop's co-ordinate system.
43 p = view_->ConvertScreenToHost(p); 46 p = view_->ConvertScreenToHost(p);
44 SendMouseMoveEvent(p.x(), p.y()); 47 SendMouseMoveEvent(p.x(), p.y());
45 } 48 }
46 49
47 void PepperInputHandler::HandleMouseButtonEvent( 50 void PepperInputHandler::HandleMouseButtonEvent(bool button_down,
48 bool button_down, 51 const MouseInputEvent& event) {
49 const PP_InputEvent_Mouse& event) {
50 MouseEvent::MouseButton button = MouseEvent::BUTTON_UNDEFINED; 52 MouseEvent::MouseButton button = MouseEvent::BUTTON_UNDEFINED;
51 if (event.button == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { 53 if (event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) {
52 button = MouseEvent::BUTTON_LEFT; 54 button = MouseEvent::BUTTON_LEFT;
53 } else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) { 55 } else if (event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) {
54 button = MouseEvent::BUTTON_MIDDLE; 56 button = MouseEvent::BUTTON_MIDDLE;
55 } else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) { 57 } else if (event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) {
56 button = MouseEvent::BUTTON_RIGHT; 58 button = MouseEvent::BUTTON_RIGHT;
57 } 59 }
58 60
59 if (button != MouseEvent::BUTTON_UNDEFINED) { 61 if (button != MouseEvent::BUTTON_UNDEFINED) {
60 SendMouseButtonEvent(button_down, button); 62 SendMouseButtonEvent(button_down, button);
61 } 63 }
62 } 64 }
63 65
64 } // namespace remoting 66 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/pepper_input_handler.h ('k') | webkit/plugins/ppapi/event_conversion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698