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

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

Issue 2760373003: [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 // It is safe to ignore this request since setAccountForLogging() wi ll be called later
63 // and will request the auth token. Logs will be queued up and sent once the auth token
64 // is set.
65 Log.w(TAG, "Account is not set before fetching the auth token.");
66 return;
63 } 67 }
64 sLoggerTokenConsumer.consume(sAccount, new OAuthTokenFetcher.Callback() { 68 sLoggerTokenConsumer.consume(sAccount, new OAuthTokenFetcher.Callback() {
65 @Override 69 @Override
66 public void onTokenFetched(String token) { 70 public void onTokenFetched(String token) {
67 nativeOnAuthTokenFetched(token); 71 nativeOnAuthTokenFetched(token);
68 } 72 }
69 73
70 @Override 74 @Override
71 public void onError(OAuthTokenFetcher.Error error) { 75 public void onError(OAuthTokenFetcher.Error error) {
72 Log.e(TAG, "Failed to fetch auth token for native client."); 76 Log.e(TAG, "Failed to fetch auth token for native client.");
73 } 77 }
74 }); 78 });
75 } 79 }
76 80
77 /** Performs the native portion of the initialization. */ 81 /** Performs the native portion of the initialization. */
78 private static native void nativeLoadNative(); 82 private static native void nativeLoadNative();
79 83
80 /** Notifies the native client with the new auth token */ 84 /** Notifies the native client with the new auth token */
81 private static native void nativeOnAuthTokenFetched(String token); 85 private static native void nativeOnAuthTokenFetched(String token);
82 } 86 }
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