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

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

Issue 2761983002: [Remoting Android] Fix crash caused by fetchAuthToken() (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.content.Context; 7 import android.content.Context;
8 8
9 import org.chromium.base.ContextUtils; 9 import org.chromium.base.ContextUtils;
10 import org.chromium.base.Log; 10 import org.chromium.base.Log;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 sAccount = account; 52 sAccount = account;
53 fetchAuthToken(); 53 fetchAuthToken();
54 } 54 }
55 55
56 /** 56 /**
57 * Fetch the OAuth token and feed it to the native interface. 57 * Fetch the OAuth token and feed it to the native interface.
58 */ 58 */
59 @CalledByNative 59 @CalledByNative
60 private static void fetchAuthToken() { 60 private static void fetchAuthToken() {
61 if (sAccount == null) { 61 if (sAccount == null) {
62 throw new IllegalStateException("Account is not set before fetching the auth token."); 62 Log.w(TAG, "Account is not set before fetching the auth token.");
Sergey Ulanov 2017/03/21 18:39:37 Maybe add a comment here to explain why we can ign
Yuwei 2017/03/21 19:02:24 Done.
63 return;
63 } 64 }
64 sLoggerTokenConsumer.consume(sAccount, new OAuthTokenFetcher.Callback() { 65 sLoggerTokenConsumer.consume(sAccount, new OAuthTokenFetcher.Callback() {
65 @Override 66 @Override
66 public void onTokenFetched(String token) { 67 public void onTokenFetched(String token) {
67 nativeOnAuthTokenFetched(token); 68 nativeOnAuthTokenFetched(token);
68 } 69 }
69 70
70 @Override 71 @Override
71 public void onError(OAuthTokenFetcher.Error error) { 72 public void onError(OAuthTokenFetcher.Error error) {
72 Log.e(TAG, "Failed to fetch auth token for native client."); 73 Log.e(TAG, "Failed to fetch auth token for native client.");
73 } 74 }
74 }); 75 });
75 } 76 }
76 77
77 /** Performs the native portion of the initialization. */ 78 /** Performs the native portion of the initialization. */
78 private static native void nativeLoadNative(); 79 private static native void nativeLoadNative();
79 80
80 /** Notifies the native client with the new auth token */ 81 /** Notifies the native client with the new auth token */
81 private static native void nativeOnAuthTokenFetched(String token); 82 private static native void nativeOnAuthTokenFetched(String token);
82 } 83 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698