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

Unified Diff: remoting/android/java/src/org/chromium/chromoting/InputInjector.java

Issue 2066683003: [Chromoting] Add InputInjector and InputInjectorWrapper for easy unittesting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix FindBugs errors Created 4 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
Index: remoting/android/java/src/org/chromium/chromoting/InputInjector.java
diff --git a/remoting/android/java/src/org/chromium/chromoting/InputInjector.java b/remoting/android/java/src/org/chromium/chromoting/InputInjector.java
new file mode 100644
index 0000000000000000000000000000000000000000..ddd39692b712f4dbcc3450352b9d99ea0fd49fc5
--- /dev/null
+++ b/remoting/android/java/src/org/chromium/chromoting/InputInjector.java
@@ -0,0 +1,34 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chromoting;
+
+import org.chromium.chromoting.jni.TouchEventData;
+
+/**
+ * A set of functions to send client users' activities to remote host machine. This interface
+ * represents low level functions without relationships with Android system. Consumers can use
+ * {@link InputInjectorWrapper} to avoid conversions between Android classes and JNI types. The
+ * implementations of this interface are not required to be thread-safe. All these functions should
+ * be called from Android UI thread.
+ */
+public interface InputInjector {
+ /** Sends a mouse event. */
+ void sendMouseEvent(int x, int y, int whichButton, boolean buttonDown);
+ /** Sends a mouse wheel event. */
Lambros 2016/06/17 23:00:09 Blank lines before comments please (here and elsew
Hzj_jie 2016/06/19 23:41:38 Done.
+ void sendMouseWheelEvent(int deltaX, int deltaY);
+ /**
+ * Sends a key event, and returns false if both scanCode and keyCode are not able to be
+ * converted to a known usb key code. Nothing will be sent to remote host, if this function
+ * returns false.
+ */
+ boolean sendKeyEvent(int scanCode, int keyCode, boolean keyDown);
+ /**
+ * Sends a string literal. This function is useful to handle outputs from Android input
+ * methods.
+ */
+ void sendTextEvent(String text);
+ /** Sends a set of {@link TouchEventData}. */
+ void sendTouchEvent(TouchEventData.EventType eventType, TouchEventData[] data);
+}

Powered by Google App Engine
This is Rietveld 408576698