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

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

Issue 384523003: Cleanups in ChromotingClient (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
« no previous file with comments | « no previous file | remoting/client/chromoting_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6d1dfd1274018508a93e68f676902ba33e3a2985..f5ce54ad8299adfd6df49443fd105b263ca1f871 100644
--- a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
+++ b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
@@ -286,11 +286,19 @@ public class JniInterface {
/** Saves newly-received pairing credentials to permanent storage. Called on the UI thread. */
@CalledByNative
- private static void commitPairingCredentials(String host, byte[] id, byte[] secret) {
- sContext.getPreferences(Activity.MODE_PRIVATE).edit().
- putString(host + "_id", new String(id)).
- putString(host + "_secret", new String(secret)).
- apply();
+ private static void commitPairingCredentials(String host, String id, String secret) {
+ // Empty |id| indicates that pairing needs to be removed.
+ if (id.isEmpty()) {
+ sContext.getPreferences(Activity.MODE_PRIVATE).edit().
+ remove(host + "_id").
+ remove(host + "_secret").
+ apply();
+ } else {
+ sContext.getPreferences(Activity.MODE_PRIVATE).edit().
+ putString(host + "_id", id).
+ putString(host + "_secret", secret).
+ apply();
+ }
}
/**
« no previous file with comments | « no previous file | remoting/client/chromoting_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698