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

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

Issue 7471006: Revert 93223 - Reland http://codereview.chromium.org/7452002/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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"
10 #include "remoting/client/chromoting_view.h" 8 #include "remoting/client/chromoting_view.h"
11 #include "ui/gfx/point.h" 9 #include "ui/gfx/point.h"
12 10
13 namespace remoting { 11 namespace remoting {
14 12
15 using pp::KeyboardInputEvent;
16 using pp::MouseInputEvent;
17 using protocol::KeyEvent; 13 using protocol::KeyEvent;
18 using protocol::MouseEvent; 14 using protocol::MouseEvent;
19 15
20 PepperInputHandler::PepperInputHandler(ClientContext* context, 16 PepperInputHandler::PepperInputHandler(ClientContext* context,
21 protocol::ConnectionToHost* connection, 17 protocol::ConnectionToHost* connection,
22 ChromotingView* view) 18 ChromotingView* view)
23 : InputHandler(context, connection, view) { 19 : InputHandler(context, connection, view) {
24 } 20 }
25 21
26 PepperInputHandler::~PepperInputHandler() { 22 PepperInputHandler::~PepperInputHandler() {
27 } 23 }
28 24
29 void PepperInputHandler::Initialize() { 25 void PepperInputHandler::Initialize() {
30 } 26 }
31 27
32 void PepperInputHandler::HandleKeyEvent(bool keydown, 28 void PepperInputHandler::HandleKeyEvent(bool keydown,
33 const KeyboardInputEvent& event) { 29 const PP_InputEvent_Key& event) {
34 SendKeyEvent(keydown, event.GetKeyCode()); 30 SendKeyEvent(keydown, event.key_code);
35 } 31 }
36 32
37 void PepperInputHandler::HandleCharacterEvent(const KeyboardInputEvent& event) { 33 void PepperInputHandler::HandleCharacterEvent(
34 const PP_InputEvent_Character& event) {
38 // TODO(garykac): Coordinate key and char events. 35 // TODO(garykac): Coordinate key and char events.
39 } 36 }
40 37
41 void PepperInputHandler::HandleMouseMoveEvent(const MouseInputEvent& event) { 38 void PepperInputHandler::HandleMouseMoveEvent(
42 gfx::Point p(static_cast<int>(event.GetMousePosition().x()), 39 const PP_InputEvent_Mouse& event) {
43 static_cast<int>(event.GetMousePosition().y())); 40 gfx::Point p(static_cast<int>(event.x), static_cast<int>(event.y));
44 // Pepper gives co-ordinates in the plugin instance's co-ordinate system, 41 // Pepper gives co-ordinates in the plugin instance's co-ordinate system,
45 // which may be different from the host desktop's co-ordinate system. 42 // which may be different from the host desktop's co-ordinate system.
46 p = view_->ConvertScreenToHost(p); 43 p = view_->ConvertScreenToHost(p);
47 SendMouseMoveEvent(p.x(), p.y()); 44 SendMouseMoveEvent(p.x(), p.y());
48 } 45 }
49 46
50 void PepperInputHandler::HandleMouseButtonEvent(bool button_down, 47 void PepperInputHandler::HandleMouseButtonEvent(
51 const MouseInputEvent& event) { 48 bool button_down,
49 const PP_InputEvent_Mouse& event) {
52 MouseEvent::MouseButton button = MouseEvent::BUTTON_UNDEFINED; 50 MouseEvent::MouseButton button = MouseEvent::BUTTON_UNDEFINED;
53 if (event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { 51 if (event.button == PP_INPUTEVENT_MOUSEBUTTON_LEFT) {
54 button = MouseEvent::BUTTON_LEFT; 52 button = MouseEvent::BUTTON_LEFT;
55 } else if (event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) { 53 } else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) {
56 button = MouseEvent::BUTTON_MIDDLE; 54 button = MouseEvent::BUTTON_MIDDLE;
57 } else if (event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) { 55 } else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) {
58 button = MouseEvent::BUTTON_RIGHT; 56 button = MouseEvent::BUTTON_RIGHT;
59 } 57 }
60 58
61 if (button != MouseEvent::BUTTON_UNDEFINED) { 59 if (button != MouseEvent::BUTTON_UNDEFINED) {
62 SendMouseButtonEvent(button_down, button); 60 SendMouseButtonEvent(button_down, button);
63 } 61 }
64 } 62 }
65 63
66 } // namespace remoting 64 } // 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