Chromium Code Reviews| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 199 synchronized (sFrameLock) { | 199 synchronized (sFrameLock) { |
| 200 sFrameBitmap = null; | 200 sFrameBitmap = null; |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 | 203 |
| 204 /** Performs the native portion of the cleanup. */ | 204 /** Performs the native portion of the cleanup. */ |
| 205 private static native void nativeDisconnect(); | 205 private static native void nativeDisconnect(); |
| 206 | 206 |
| 207 /** Reports whenever the connection status changes. Called on the UI thread. */ | 207 /** Reports whenever the connection status changes. Called on the UI thread. */ |
| 208 @CalledByNative | 208 @CalledByNative |
| 209 private static void reportConnectionStatus(int state, int error) { | 209 private static void reportConnectionStatus(int stateCode, int errorCode) { |
| 210 sConnectionListener.onConnectionState(ConnectionListener.State.fromValue (state), | 210 ConnectionListener.State state = ConnectionListener.State.fromValue(stat eCode); |
| 211 ConnectionListener.Error.fromValue(error)); | 211 ConnectionListener.Error error = ConnectionListener.Error.fromValue(erro rCode); |
| 212 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.
| |
| 213 case FAILED: | |
| 214 case CLOSED: | |
| 215 // Clear the flag here, otherwise the next time connectToHost() is called, it will | |
| 216 // try to disconnect, triggering an incorrect status notificatio n. | |
| 217 sConnected = false; | |
| 218 break; | |
| 219 default: | |
| 220 break; | |
| 221 } | |
| 222 sConnectionListener.onConnectionState(state, error); | |
| 212 } | 223 } |
| 213 | 224 |
| 214 /** Prompts the user to enter a PIN. Called on the UI thread. */ | 225 /** Prompts the user to enter a PIN. Called on the UI thread. */ |
| 215 @CalledByNative | 226 @CalledByNative |
| 216 private static void displayAuthenticationPrompt(boolean pairingSupported) { | 227 private static void displayAuthenticationPrompt(boolean pairingSupported) { |
| 217 AlertDialog.Builder pinPrompt = new AlertDialog.Builder(sContext); | 228 AlertDialog.Builder pinPrompt = new AlertDialog.Builder(sContext); |
| 218 pinPrompt.setTitle(sContext.getString(R.string.title_authenticate)); | 229 pinPrompt.setTitle(sContext.getString(R.string.title_authenticate)); |
| 219 pinPrompt.setMessage(sContext.getString(R.string.pin_message_android)); | 230 pinPrompt.setMessage(sContext.getString(R.string.pin_message_android)); |
| 220 pinPrompt.setIcon(android.R.drawable.ic_lock_lock); | 231 pinPrompt.setIcon(android.R.drawable.ic_lock_lock); |
| 221 | 232 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 452 public static void fetchThirdPartyToken(String tokenUrl, String clientId, St ring scope) { | 463 public static void fetchThirdPartyToken(String tokenUrl, String clientId, St ring scope) { |
| 453 Chromoting app = (Chromoting) sContext; | 464 Chromoting app = (Chromoting) sContext; |
| 454 app.fetchThirdPartyToken(tokenUrl, clientId, scope); | 465 app.fetchThirdPartyToken(tokenUrl, clientId, scope); |
| 455 } | 466 } |
| 456 | 467 |
| 457 /** | 468 /** |
| 458 * Notify the native code to continue authentication with the |token| and th e |sharedSecret|. | 469 * Notify the native code to continue authentication with the |token| and th e |sharedSecret|. |
| 459 */ | 470 */ |
| 460 public static native void nativeOnThirdPartyTokenFetched(String token, Strin g sharedSecret); | 471 public static native void nativeOnThirdPartyTokenFetched(String token, Strin g sharedSecret); |
| 461 } | 472 } |
| OLD | NEW |