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

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

Issue 21120005: Add Android Chromoting client keyboard input (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improve related comments Created 7 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 side-by-side diff with in-line comments
Download patch
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 ecf8632787543632105a3b295d526ebd93e552c9..dcec68fcaadc559336627485d9fda1acba48ff18 100644
--- a/remoting/client/jni/chromoting_jni_instance.cc
+++ b/remoting/client/jni/chromoting_jni_instance.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/logging.h"
#include "remoting/client/audio_player.h"
+#include "remoting/client/jni/android_keymap.h"
#include "remoting/client/jni/chromoting_jni_runtime.h"
#include "remoting/protocol/libjingle_transport_factory.h"
@@ -105,6 +106,28 @@ void ChromotingJniInstance::PerformMouseAction(
connection_->input_stub()->InjectMouseEvent(action);
}
+void ChromotingJniInstance::PerformKeyboardAction(int keyCode, bool keyDown) {
+ if (!jni_runtime_->network_task_runner()->BelongsToCurrentThread()) {
+ jni_runtime_->network_task_runner()->PostTask(
+ FROM_HERE,
+ base::Bind(&ChromotingJniInstance::PerformKeyboardAction,
+ this,
Sergey Ulanov 2013/07/30 19:19:27 two arguments below this one would fit on this lin
solb 2013/07/30 21:30:54 It's formatted in accordance with http://google-st
Sergey Ulanov 2013/07/30 21:42:10 "if this makes the code more readable". IMO it doe
+ keyCode,
+ keyDown));
+ return;
+ }
+
+ uint32 usbCode = AndroidKeycodeToUsbKeycode(keyCode);
+ if (usbCode) {
+ protocol::KeyEvent action;
+ action.set_usb_keycode(usbCode);
+ action.set_pressed(keyDown);
+ connection_->input_stub()->InjectKeyEvent(action);
+ }
+ else
+ LOG(WARNING) << "Ignoring unknown keycode: " << keyCode;
Sergey Ulanov 2013/07/30 19:19:27 nit: add {}
solb 2013/07/30 21:30:54 Done in https://codereview.chromium.org/21236002
+}
+
void ChromotingJniInstance::OnConnectionState(
protocol::ConnectionToHost::State state,
protocol::ErrorCode error) {

Powered by Google App Engine
This is Rietveld 408576698