| 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.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 | 9 |
| 10 import org.chromium.base.ContextUtils; | 10 import org.chromium.base.ContextUtils; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 */ | 39 */ |
| 40 public static void loadLibrary(Context context) { | 40 public static void loadLibrary(Context context) { |
| 41 ContextUtils.initApplicationContext(context.getApplicationContext()); | 41 ContextUtils.initApplicationContext(context.getApplicationContext()); |
| 42 sLoggerTokenConsumer = new OAuthTokenConsumer(context.getApplicationCont
ext(), TOKEN_SCOPE); | 42 sLoggerTokenConsumer = new OAuthTokenConsumer(context.getApplicationCont
ext(), TOKEN_SCOPE); |
| 43 try { | 43 try { |
| 44 System.loadLibrary(LIBRARY_NAME); | 44 System.loadLibrary(LIBRARY_NAME); |
| 45 } catch (UnsatisfiedLinkError e) { | 45 } catch (UnsatisfiedLinkError e) { |
| 46 Log.w(TAG, "Couldn't load " + LIBRARY_NAME + ", trying " + LIBRARY_N
AME + ".cr"); | 46 Log.w(TAG, "Couldn't load " + LIBRARY_NAME + ", trying " + LIBRARY_N
AME + ".cr"); |
| 47 System.loadLibrary(LIBRARY_NAME + ".cr"); | 47 System.loadLibrary(LIBRARY_NAME + ".cr"); |
| 48 } | 48 } |
| 49 ContextUtils.initApplicationContextForNative(); | |
| 50 nativeLoadNative(); | 49 nativeLoadNative(); |
| 51 } | 50 } |
| 52 | 51 |
| 53 public static void setAccountForLogging(String account) { | 52 public static void setAccountForLogging(String account) { |
| 54 sAccount = account; | 53 sAccount = account; |
| 55 fetchAuthToken(); | 54 fetchAuthToken(); |
| 56 } | 55 } |
| 57 | 56 |
| 58 /** | 57 /** |
| 59 * Fetch the OAuth token and feed it to the native interface. | 58 * Fetch the OAuth token and feed it to the native interface. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 79 } | 78 } |
| 80 }); | 79 }); |
| 81 } | 80 } |
| 82 | 81 |
| 83 /** Performs the native portion of the initialization. */ | 82 /** Performs the native portion of the initialization. */ |
| 84 private static native void nativeLoadNative(); | 83 private static native void nativeLoadNative(); |
| 85 | 84 |
| 86 /** Notifies the native client with the new auth token */ | 85 /** Notifies the native client with the new auth token */ |
| 87 private static native void nativeOnAuthTokenFetched(String token); | 86 private static native void nativeOnAuthTokenFetched(String token); |
| 88 } | 87 } |
| OLD | NEW |