Index: remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
diff --git a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
index 264d8a2eab9e55ecc6636b4da0897c5ddec2d0aa..a9844190dd258ff3070f90aa370d51e4a3bb94a5 100644 |
--- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
+++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
@@ -38,7 +38,7 @@ import java.util.Scanner; |
* The user interface for querying and displaying a user's host list from the directory server. It |
* also requests and renews authentication tokens using the system account manager. |
*/ |
-public class Chromoting extends Activity { |
+public class Chromoting extends Activity implements JniInterface.ConnectionListener { |
/** Only accounts of this type will be selectable for authentication. */ |
private static final String ACCOUNT_TYPE = "com.google"; |
@@ -187,13 +187,7 @@ public class Chromoting extends Activity { |
try { |
synchronized (mLock) { |
JniInterface.connectToHost(mAccount.name, mToken, host.getString("jabberId"), |
- host.getString("hostId"), host.getString("publicKey"), |
- new Runnable() { |
- @Override |
- public void run() { |
- startActivity(new Intent(Chromoting.this, Desktop.class)); |
- } |
- }); |
+ host.getString("hostId"), host.getString("publicKey"), this); |
} |
} catch (JSONException ex) { |
Log.w("host", ex); |
@@ -360,4 +354,14 @@ public class Chromoting extends Activity { |
finish(); |
} |
} |
+ |
+ @Override |
+ public void onConnected() { |
+ startActivityForResult(new Intent(Chromoting.this, Desktop.class), 0); |
+ } |
+ |
+ @Override |
+ public void onDisconnected() { |
+ finishActivity(0); |
+ } |
} |