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

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java

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, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chromoting.jni; 5 package org.chromium.chromoting.jni;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.app.AlertDialog; 8 import android.app.AlertDialog;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.DialogInterface; 10 import android.content.DialogInterface;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 * Sets the redraw callback to the provided functor. Provide a value of null whenever the 172 * Sets the redraw callback to the provided functor. Provide a value of null whenever the
173 * window is no longer visible so that we don't continue to draw onto it. 173 * window is no longer visible so that we don't continue to draw onto it.
174 */ 174 */
175 public static void provideRedrawCallback(Runnable redrawCallback) { 175 public static void provideRedrawCallback(Runnable redrawCallback) {
176 sRedrawCallback = redrawCallback; 176 sRedrawCallback = redrawCallback;
177 } 177 }
178 178
179 /** Forces the native graphics thread to redraw to the canvas. */ 179 /** Forces the native graphics thread to redraw to the canvas. */
180 public static boolean redrawGraphics() { 180 public static boolean redrawGraphics() {
181 synchronized(JniInterface.class) { 181 synchronized(JniInterface.class) {
182 if (!sConnected) return false; 182 if (!sConnected || sRedrawCallback == null) return false;
183 } 183 }
184 184
185 scheduleRedrawNative(); 185 scheduleRedrawNative();
186 return true; 186 return true;
187 } 187 }
188 188
189 /** Performs the redrawing callback. This is a no-op if the window isn't vis ible. */ 189 /** Performs the redrawing callback. This is a no-op if the window isn't vis ible. */
190 private static void redrawGraphicsInternal() { 190 private static void redrawGraphicsInternal() {
191 if (sRedrawCallback != null) 191 if (sRedrawCallback != null)
192 sRedrawCallback.run(); 192 sRedrawCallback.run();
(...skipping 22 matching lines...) Expand all
215 215
216 /** Moves the mouse cursor, possibly while clicking. */ 216 /** Moves the mouse cursor, possibly while clicking. */
217 public static void mouseAction(int x, int y, int whichButton, boolean button Down) { 217 public static void mouseAction(int x, int y, int whichButton, boolean button Down) {
218 if (!sConnected) { 218 if (!sConnected) {
219 return; 219 return;
220 } 220 }
221 221
222 mouseActionNative(x, y, whichButton, buttonDown); 222 mouseActionNative(x, y, whichButton, buttonDown);
223 } 223 }
224 224
225 /** Presses and releases the specified key. */
226 public static void keyboardAction(int keyCode, boolean keyDown) {
227 if (!sConnected) {
228 return;
229 }
230
231 keyboardActionNative(keyCode, keyDown);
232 }
233
225 /** Performs the native response to the user's PIN. */ 234 /** Performs the native response to the user's PIN. */
226 private static native void authenticationResponse(String pin); 235 private static native void authenticationResponse(String pin);
227 236
228 /** Schedules a redraw on the native graphics thread. */ 237 /** Schedules a redraw on the native graphics thread. */
229 private static native void scheduleRedrawNative(); 238 private static native void scheduleRedrawNative();
230 239
231 /** Passes mouse information to the native handling code. */ 240 /** Passes mouse information to the native handling code. */
232 private static native void mouseActionNative(int x, int y, int whichButton, boolean buttonDown); 241 private static native void mouseActionNative(int x, int y, int whichButton, boolean buttonDown);
242
243 /** Passes key press information to the native handling code. */
244 private static native void keyboardActionNative(int keyCode, boolean keyDown );
233 } 245 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698