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

Unified Diff: remoting/client/jni/chromoting_jni_instance.cc

Issue 214173002: Send TextEvent message from Android client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/client/jni/chromoting_jni_instance.h ('k') | remoting/client/jni/chromoting_jni_runtime.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/jni/chromoting_jni_instance.cc
diff --git a/remoting/client/jni/chromoting_jni_instance.cc b/remoting/client/jni/chromoting_jni_instance.cc
index 92b7615830674a2e249127b30ed5a47e3dff107b..883df5af5d2602a7b01325a350bba415539bd012 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(
« no previous file with comments | « remoting/client/jni/chromoting_jni_instance.h ('k') | remoting/client/jni/chromoting_jni_runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698