summaryrefslogtreecommitdiffstats
path: root/remoting/android
diff options
context:
space:
mode:
authorlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-18 11:48:43 +0000
committerlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-18 11:48:43 +0000
commit98c46e917aad8f941f826c1653625cf84442c607 (patch)
tree3fee7f4351653606ac50e1e363829d16e6222305 /remoting/android
parent18d1d6aeac82f8246a304dcfc078dc51512191a3 (diff)
downloadchromium_src-98c46e917aad8f941f826c1653625cf84442c607.zip
chromium_src-98c46e917aad8f941f826c1653625cf84442c607.tar.gz
chromium_src-98c46e917aad8f941f826c1653625cf84442c607.tar.bz2
Reorder fields/methods in JniInterface
Preparation for future cleanup CLs. No code changes here. Variables at the top, methods at the bottom. Cursor-related fields/methods grouped together. Native counterparts of methods moved next to their counterparts. Methods called on Display thread moved to the bottom. Review URL: https://codereview.chromium.org/73193007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235712 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/android')
-rw-r--r--remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java139
1 files changed, 68 insertions, 71 deletions
diff --git a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
index d8ca6a7..59a536b 100644
--- a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
+++ b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
@@ -38,15 +38,42 @@ public class JniInterface {
/** The status code indicating successful connection. */
private static final int SUCCESSFUL_CONNECTION = 3;
- /** The application context. */
- private static Activity sContext = null;
-
/*
* Library-loading state machine.
*/
/** Whether we've already loaded the library. */
private static boolean sLoaded = false;
+ /** The application context. */
+ private static Activity sContext = null;
+
+ /*
+ * Connection-initiating state machine.
+ */
+ /** Whether the native code is attempting a connection. */
+ private static boolean sConnected = false;
+
+ /** Callback to signal upon successful connection. */
+ private static Runnable sSuccessCallback = null;
+
+ /** Dialog for reporting connection progress. */
+ private static ProgressDialog sProgressIndicator = null;
+
+ /** Callback to signal whenever we need to redraw. */
+ private static Runnable sRedrawCallback = null;
+
+ /** Bitmap holding a copy of the latest video frame. */
+ private static Bitmap sFrameBitmap = null;
+
+ /** Lock to protect the frame bitmap reference. */
+ private static final Object sFrameLock = new Object();
+
+ /** Position of cursor hot-spot. */
+ private static Point sCursorHotspot = new Point();
+
+ /** Bitmap holding the cursor shape. */
+ private static Bitmap sCursorBitmap = null;
+
/**
* To be called once from the main Activity. Any subsequent calls will update the application
* context, but not reload the library. This is useful e.g. when the activity is closed and the
@@ -75,18 +102,6 @@ public class JniInterface {
public static native String nativeGetClientId();
public static native String nativeGetClientSecret();
- /*
- * Connection-initiating state machine.
- */
- /** Whether the native code is attempting a connection. */
- private static boolean sConnected = false;
-
- /** Callback to signal upon successful connection. */
- private static Runnable sSuccessCallback = null;
-
- /** Dialog for reporting connection progress. */
- private static ProgressDialog sProgressIndicator = null;
-
/** Attempts to form a connection to the user-selected host. */
public static void connectToHost(String username, String authToken,
String hostJid, String hostId, String hostPubkey, Runnable successCallback) {
@@ -105,6 +120,10 @@ public class JniInterface {
sConnected = true;
}
+ /** Performs the native portion of the connection. */
+ private static native void nativeConnect(String username, String authToken, String hostJid,
+ String hostId, String hostPubkey, String pairId, String pairSecret);
+
/** Severs the connection and cleans up. */
public static void disconnectFromHost() {
synchronized(JniInterface.class) {
@@ -126,37 +145,9 @@ public class JniInterface {
}
}
- /** Performs the native portion of the connection. */
- private static native void nativeConnect(String username, String authToken, String hostJid,
- String hostId, String hostPubkey, String pairId, String pairSecret);
-
/** Performs the native portion of the cleanup. */
private static native void nativeDisconnect();
- /** Position of cursor hotspot within cursor image. */
- public static Point getCursorHotspot() { return sCursorHotspot; }
-
- /** Returns the current cursor shape. */
- public static Bitmap getCursorBitmap() { return sCursorBitmap; }
-
- /*
- * Entry points *from* the native code.
- */
- /** Callback to signal whenever we need to redraw. */
- private static Runnable sRedrawCallback = null;
-
- /** Bitmap holding a copy of the latest video frame. */
- private static Bitmap sFrameBitmap = null;
-
- /** Lock to protect the frame bitmap reference. */
- private static final Object sFrameLock = new Object();
-
- /** Position of cursor hot-spot. */
- private static Point sCursorHotspot = new Point();
-
- /** Bitmap holding the cursor shape. */
- private static Bitmap sCursorBitmap = null;
-
/** Reports whenever the connection status changes. */
@CalledByNative
private static void reportConnectionStatus(int state, int error) {
@@ -271,6 +262,9 @@ public class JniInterface {
pinDialog.show();
}
+ /** Performs the native response to the user's PIN. */
+ private static native void nativeAuthenticationResponse(String pin, boolean createPair);
+
/** Saves newly-received pairing credentials to permanent storage. */
@CalledByNative
private static void commitPairingCredentials(String host, byte[] id, byte[] secret) {
@@ -282,6 +276,30 @@ public class JniInterface {
}
}
+ /** Moves the mouse cursor, possibly while clicking the specified (nonnegative) button. */
+ public static void mouseAction(int x, int y, int whichButton, boolean buttonDown) {
+ if (!sConnected) {
+ return;
+ }
+
+ nativeMouseAction(x, y, whichButton, buttonDown);
+ }
+
+ /** Passes mouse information to the native handling code. */
+ private static native void nativeMouseAction(int x, int y, int whichButton, boolean buttonDown);
+
+ /** Presses and releases the specified (nonnegative) key. */
+ public static void keyboardAction(int keyCode, boolean keyDown) {
+ if (!sConnected) {
+ return;
+ }
+
+ nativeKeyboardAction(keyCode, keyDown);
+ }
+
+ /** Passes key press information to the native handling code. */
+ private static native void nativeKeyboardAction(int keyCode, boolean keyDown);
+
/**
* Sets the redraw callback to the provided functor. Provide a value of null whenever the
* window is no longer visible so that we don't continue to draw onto it.
@@ -300,6 +318,9 @@ public class JniInterface {
return true;
}
+ /** Schedules a redraw on the native graphics thread. */
+ private static native void nativeScheduleRedraw();
+
/** Performs the redrawing callback. This is a no-op if the window isn't visible. */
@CalledByNative
private static void redrawGraphicsInternal() {
@@ -364,33 +385,9 @@ public class JniInterface {
sCursorBitmap = Bitmap.createBitmap(data, width, height, Bitmap.Config.ARGB_8888);
}
- /** Moves the mouse cursor, possibly while clicking the specified (nonnegative) button. */
- public static void mouseAction(int x, int y, int whichButton, boolean buttonDown) {
- if (!sConnected) {
- return;
- }
-
- nativeMouseAction(x, y, whichButton, buttonDown);
- }
-
- /** Presses and releases the specified (nonnegative) key. */
- public static void keyboardAction(int keyCode, boolean keyDown) {
- if (!sConnected) {
- return;
- }
-
- nativeKeyboardAction(keyCode, keyDown);
- }
-
- /** Performs the native response to the user's PIN. */
- private static native void nativeAuthenticationResponse(String pin, boolean createPair);
-
- /** Schedules a redraw on the native graphics thread. */
- private static native void nativeScheduleRedraw();
-
- /** Passes mouse information to the native handling code. */
- private static native void nativeMouseAction(int x, int y, int whichButton, boolean buttonDown);
+ /** Position of cursor hotspot within cursor image. */
+ public static Point getCursorHotspot() { return sCursorHotspot; }
- /** Passes key press information to the native handling code. */
- private static native void nativeKeyboardAction(int keyCode, boolean keyDown);
+ /** Returns the current cursor shape. */
+ public static Bitmap getCursorBitmap() { return sCursorBitmap; }
}