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

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

Issue 341693004: Fix Desktop.dispatchKeyEvent() to return correct result. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 9a929dd037318dba87a1ce9c0bdee721afb416b9..32aaa4be2c7fdd025ae32a933971d543b03f9c2e 100644
--- a/remoting/client/jni/chromoting_jni_instance.cc
+++ b/remoting/client/jni/chromoting_jni_instance.cc
@@ -210,23 +210,15 @@ void ChromotingJniInstance::SendMouseWheelEvent(int delta_x, int delta_y) {
connection_->input_stub()->InjectMouseEvent(event);
}
-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::SendKeyEvent,
- this, key_code, key_down));
- return;
- }
-
- uint32 usb_code = AndroidKeycodeToUsbKeycode(key_code);
- if (usb_code) {
- protocol::KeyEvent event;
- event.set_usb_keycode(usb_code);
- event.set_pressed(key_down);
- connection_->input_stub()->InjectKeyEvent(event);
- } else {
+bool ChromotingJniInstance::SendKeyEvent(int key_code, bool key_down) {
+ uint32 usb_key_code = AndroidKeycodeToUsbKeycode(key_code);
+ if (!usb_key_code) {
LOG(WARNING) << "Ignoring unknown keycode: " << key_code;
+ return false;
}
+
+ SendKeyEventInternal(usb_key_code, key_down);
+ return true;
}
void ChromotingJniInstance::SendTextEvent(const std::string& text) {
@@ -449,6 +441,22 @@ void ChromotingJniInstance::SetDeviceName(const std::string& device_name) {
device_name_ = device_name;
}
+void ChromotingJniInstance::SendKeyEventInternal(int usb_key_code,
+ bool key_down) {
+ if (!jni_runtime_->network_task_runner()->BelongsToCurrentThread()) {
+ jni_runtime_->network_task_runner()->PostTask(
+ FROM_HERE, base::Bind(&ChromotingJniInstance::SendKeyEventInternal,
+ this, usb_key_code, key_down));
+ return;
+ }
+
+
+ protocol::KeyEvent event;
+ event.set_usb_keycode(usb_key_code);
+ event.set_pressed(key_down);
+ connection_->input_stub()->InjectKeyEvent(event);
+}
+
void ChromotingJniInstance::EnableStatsLogging(bool enabled) {
DCHECK(jni_runtime_->network_task_runner()->BelongsToCurrentThread());
« 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