summaryrefslogtreecommitdiffstats
path: root/remoting/client/jni/chromoting_jni_instance.cc
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/client/jni/chromoting_jni_instance.cc')
-rw-r--r--remoting/client/jni/chromoting_jni_instance.cc54
1 files changed, 33 insertions, 21 deletions
diff --git a/remoting/client/jni/chromoting_jni_instance.cc b/remoting/client/jni/chromoting_jni_instance.cc
index 92b7615..883df5a 100644
--- a/remoting/client/jni/chromoting_jni_instance.cc
+++ b/remoting/client/jni/chromoting_jni_instance.cc
@@ -128,62 +128,74 @@ void ChromotingJniInstance::RedrawDesktop() {
jni_runtime_->RedrawCanvas();
}
-void ChromotingJniInstance::PerformMouseAction(
+void ChromotingJniInstance::SendMouseEvent(
int x, int y,
protocol::MouseEvent_MouseButton button,
bool button_down) {
if (!jni_runtime_->network_task_runner()->BelongsToCurrentThread()) {
jni_runtime_->network_task_runner()->PostTask(
- FROM_HERE, base::Bind(&ChromotingJniInstance::PerformMouseAction,
+ FROM_HERE, base::Bind(&ChromotingJniInstance::SendMouseEvent,
this, x, y, button, button_down));
return;
}
- protocol::MouseEvent action;
- action.set_x(x);
- action.set_y(y);
- action.set_button(button);
+ protocol::MouseEvent event;
+ event.set_x(x);
+ event.set_y(y);
+ event.set_button(button);
if (button != protocol::MouseEvent::BUTTON_UNDEFINED)
- action.set_button_down(button_down);
+ event.set_button_down(button_down);
- connection_->input_stub()->InjectMouseEvent(action);
+ connection_->input_stub()->InjectMouseEvent(event);
}
-void ChromotingJniInstance::PerformMouseWheelDeltaAction(int delta_x,
- int delta_y) {
+void ChromotingJniInstance::SendMouseWheelEvent(int delta_x, int delta_y) {
if (!jni_runtime_->network_task_runner()->BelongsToCurrentThread()) {
jni_runtime_->network_task_runner()->PostTask(
FROM_HERE,
- base::Bind(&ChromotingJniInstance::PerformMouseWheelDeltaAction, this,
+ base::Bind(&ChromotingJniInstance::SendMouseWheelEvent, this,
delta_x, delta_y));
return;
}
- protocol::MouseEvent action;
- action.set_wheel_delta_x(delta_x);
- action.set_wheel_delta_y(delta_y);
- connection_->input_stub()->InjectMouseEvent(action);
+ protocol::MouseEvent event;
+ event.set_wheel_delta_x(delta_x);
+ event.set_wheel_delta_y(delta_y);
+ connection_->input_stub()->InjectMouseEvent(event);
}
-void ChromotingJniInstance::PerformKeyboardAction(int key_code, bool key_down) {
+void ChromotingJniInstance::SendKeyEvent(int key_code, bool key_down) {
if (!jni_runtime_->network_task_runner()->BelongsToCurrentThread()) {
jni_runtime_->network_task_runner()->PostTask(
- FROM_HERE, base::Bind(&ChromotingJniInstance::PerformKeyboardAction,
+ FROM_HERE, base::Bind(&ChromotingJniInstance::SendKeyEvent,
this, key_code, key_down));
return;
}
uint32 usb_code = AndroidKeycodeToUsbKeycode(key_code);
if (usb_code) {
- protocol::KeyEvent action;
- action.set_usb_keycode(usb_code);
- action.set_pressed(key_down);
- connection_->input_stub()->InjectKeyEvent(action);
+ protocol::KeyEvent event;
+ event.set_usb_keycode(usb_code);
+ event.set_pressed(key_down);
+ connection_->input_stub()->InjectKeyEvent(event);
} else {
LOG(WARNING) << "Ignoring unknown keycode: " << key_code;
}
}
+void ChromotingJniInstance::SendTextEvent(const std::string& text) {
+ if (!jni_runtime_->network_task_runner()->BelongsToCurrentThread()) {
+ jni_runtime_->network_task_runner()->PostTask(
+ FROM_HERE,
+ base::Bind(&ChromotingJniInstance::SendTextEvent, this, text));
+ return;
+ }
+
+ protocol::TextEvent event;
+ event.set_text(text);
+ connection_->input_stub()->InjectTextEvent(event);
+}
+
void ChromotingJniInstance::RecordPaintTime(int64 paint_time_ms) {
if (!jni_runtime_->network_task_runner()->BelongsToCurrentThread()) {
jni_runtime_->network_task_runner()->PostTask(