| 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/input_handler.h" | 5 #include "remoting/client/input_handler.h" |
| 6 | 6 |
| 7 #include "remoting/client/chromoting_view.h" | 7 #include "remoting/client/chromoting_view.h" |
| 8 #include "remoting/proto/event.pb.h" | 8 #include "remoting/proto/event.pb.h" |
| 9 #include "remoting/protocol/connection_to_host.h" | 9 #include "remoting/protocol/connection_to_host.h" |
| 10 | 10 |
| 11 namespace remoting { | 11 namespace remoting { |
| 12 | 12 |
| 13 using protocol::KeyEvent; | 13 using protocol::KeyEvent; |
| 14 using protocol::MouseEvent; | 14 using protocol::MouseEvent; |
| 15 | 15 |
| 16 InputHandler::InputHandler(ClientContext* context, | 16 InputHandler::InputHandler(ClientContext* context, |
| 17 protocol::ConnectionToHost* connection, | 17 protocol::ConnectionToHost* connection, |
| 18 ChromotingView* view) | 18 ChromotingView* view) |
| 19 : context_(context), | 19 : context_(context), |
| 20 connection_(connection), | 20 connection_(connection), |
| 21 view_(view) { | 21 view_(view) { |
| 22 } | 22 } |
| 23 | 23 |
| 24 void InputHandler::SendKeyEvent(bool press, int keycode) { | 24 void InputHandler::SendKeyEvent(bool press, int keycode) { |
| 25 protocol::InputStub* stub = connection_->input_stub(); | 25 protocol::InputStub* stub = connection_->input_stub(); |
| 26 if (stub) { | 26 if (stub) { |
| 27 KeyEvent* event = new KeyEvent(); | 27 KeyEvent* event = new KeyEvent(); |
| 28 event->set_key(keycode); | 28 event->set_keycode(keycode); |
| 29 event->set_pressed(press); | 29 event->set_pressed(press); |
| 30 | 30 |
| 31 stub->InjectKeyEvent(event, new DeleteTask<KeyEvent>(event)); | 31 stub->InjectKeyEvent(event, new DeleteTask<KeyEvent>(event)); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 void InputHandler::SendMouseMoveEvent(int x, int y) { | 35 void InputHandler::SendMouseMoveEvent(int x, int y) { |
| 36 protocol::InputStub* stub = connection_->input_stub(); | 36 protocol::InputStub* stub = connection_->input_stub(); |
| 37 if (stub) { | 37 if (stub) { |
| 38 MouseEvent* event = new MouseEvent(); | 38 MouseEvent* event = new MouseEvent(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 49 if (stub) { | 49 if (stub) { |
| 50 MouseEvent* event = new MouseEvent(); | 50 MouseEvent* event = new MouseEvent(); |
| 51 event->set_button(button); | 51 event->set_button(button); |
| 52 event->set_button_down(button_down); | 52 event->set_button_down(button_down); |
| 53 | 53 |
| 54 stub->InjectMouseEvent(event, new DeleteTask<MouseEvent>(event)); | 54 stub->InjectMouseEvent(event, new DeleteTask<MouseEvent>(event)); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace remoting | 58 } // namespace remoting |
| OLD | NEW |