| OLD | NEW |
| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 * @param pin The entered PIN. | 279 * @param pin The entered PIN. |
| 280 * @param createPair Whether to create a new pairing for this client. | 280 * @param createPair Whether to create a new pairing for this client. |
| 281 * @param deviceName The device name to appear in the pairing registry. Only
used if createPair | 281 * @param deviceName The device name to appear in the pairing registry. Only
used if createPair |
| 282 * is true. | 282 * is true. |
| 283 */ | 283 */ |
| 284 private static native void nativeAuthenticationResponse(String pin, boolean
createPair, | 284 private static native void nativeAuthenticationResponse(String pin, boolean
createPair, |
| 285 String deviceName); | 285 String deviceName); |
| 286 | 286 |
| 287 /** Saves newly-received pairing credentials to permanent storage. Called on
the UI thread. */ | 287 /** Saves newly-received pairing credentials to permanent storage. Called on
the UI thread. */ |
| 288 @CalledByNative | 288 @CalledByNative |
| 289 private static void commitPairingCredentials(String host, byte[] id, byte[]
secret) { | 289 private static void commitPairingCredentials(String host, String id, String
secret) { |
| 290 sContext.getPreferences(Activity.MODE_PRIVATE).edit(). | 290 // Empty |id| indicates that pairing needs to be removed. |
| 291 putString(host + "_id", new String(id)). | 291 if (id.isEmpty()) { |
| 292 putString(host + "_secret", new String(secret)). | 292 sContext.getPreferences(Activity.MODE_PRIVATE).edit(). |
| 293 apply(); | 293 remove(host + "_id"). |
| 294 remove(host + "_secret"). |
| 295 apply(); |
| 296 } else { |
| 297 sContext.getPreferences(Activity.MODE_PRIVATE).edit(). |
| 298 putString(host + "_id", id). |
| 299 putString(host + "_secret", secret). |
| 300 apply(); |
| 301 } |
| 294 } | 302 } |
| 295 | 303 |
| 296 /** | 304 /** |
| 297 * Moves the mouse cursor, possibly while clicking the specified (nonnegativ
e) button. Called | 305 * Moves the mouse cursor, possibly while clicking the specified (nonnegativ
e) button. Called |
| 298 * on the UI thread. | 306 * on the UI thread. |
| 299 */ | 307 */ |
| 300 public static void sendMouseEvent(int x, int y, int whichButton, boolean but
tonDown) { | 308 public static void sendMouseEvent(int x, int y, int whichButton, boolean but
tonDown) { |
| 301 if (!sConnected) { | 309 if (!sConnected) { |
| 302 return; | 310 return; |
| 303 } | 311 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 public static void fetchThirdPartyToken(String tokenUrl, String clientId, St
ring scope) { | 452 public static void fetchThirdPartyToken(String tokenUrl, String clientId, St
ring scope) { |
| 445 Chromoting app = (Chromoting) sContext; | 453 Chromoting app = (Chromoting) sContext; |
| 446 app.fetchThirdPartyToken(tokenUrl, clientId, scope); | 454 app.fetchThirdPartyToken(tokenUrl, clientId, scope); |
| 447 } | 455 } |
| 448 | 456 |
| 449 /** | 457 /** |
| 450 * Notify the native code to continue authentication with the |token| and th
e |sharedSecret|. | 458 * Notify the native code to continue authentication with the |token| and th
e |sharedSecret|. |
| 451 */ | 459 */ |
| 452 public static native void nativeOnThirdPartyTokenFetched(String token, Strin
g sharedSecret); | 460 public static native void nativeOnThirdPartyTokenFetched(String token, Strin
g sharedSecret); |
| 453 } | 461 } |
| OLD | NEW |