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

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

Issue 407403002: Chromoting: Synchronize connected/disconnected state between Java/C++ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/android/java/src/org/chromium/chromoting/jni/JniInterface.java
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 f5ce54ad8299adfd6df49443fd105b263ca1f871..0c1b78d72231e74efa35dfe16e2b5b278b1a40ab 100644
--- a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
+++ b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
@@ -206,9 +206,20 @@ public class JniInterface {
/** Reports whenever the connection status changes. Called on the UI thread. */
@CalledByNative
- private static void reportConnectionStatus(int state, int error) {
- sConnectionListener.onConnectionState(ConnectionListener.State.fromValue(state),
- ConnectionListener.Error.fromValue(error));
+ private static void reportConnectionStatus(int stateCode, int errorCode) {
+ ConnectionListener.State state = ConnectionListener.State.fromValue(stateCode);
+ ConnectionListener.Error error = ConnectionListener.Error.fromValue(errorCode);
+ switch (state) {
Sergey Ulanov 2014/07/24 02:47:02 Don't really need switch statement here. if would
Lambros 2014/07/26 00:42:35 Done.
+ case FAILED:
+ case CLOSED:
+ // Clear the flag here, otherwise the next time connectToHost() is called, it will
+ // try to disconnect, triggering an incorrect status notification.
+ sConnected = false;
+ break;
+ default:
+ break;
+ }
+ sConnectionListener.onConnectionState(state, error);
}
/** Prompts the user to enter a PIN. Called on the UI thread. */
« no previous file with comments | « no previous file | remoting/client/jni/chromoting_jni_runtime.h » ('j') | remoting/client/jni/chromoting_jni_runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698