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

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

Issue 1879013002: 🍈 Unify application context usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix caller/callee relationship in resource_provider. Created 4 years, 7 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
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 import android.graphics.Bitmap; 8 import android.graphics.Bitmap;
9 9
10 import org.chromium.base.ContextUtils; 10 import org.chromium.base.ContextUtils;
11 import org.chromium.base.annotations.CalledByNative; 11 import org.chromium.base.annotations.CalledByNative;
12 import org.chromium.base.annotations.JNINamespace; 12 import org.chromium.base.annotations.JNINamespace;
13 13
14 import java.nio.ByteBuffer; 14 import java.nio.ByteBuffer;
15 15
16 /** 16 /**
17 * Initializes the Chromium remoting library, and provides JNI calls into it. 17 * Initializes the Chromium remoting library, and provides JNI calls into it.
18 * All interaction with the native code is centralized in this class. 18 * All interaction with the native code is centralized in this class.
19 */ 19 */
20 @JNINamespace("remoting") 20 @JNINamespace("remoting")
21 public class JniInterface { 21 public class JniInterface {
22 /** 22 /**
23 * To be called once from the Application context singleton. Loads and initi alizes the native 23 * To be called once from the Application context singleton. Loads and initi alizes the native
24 * code. Called on the UI thread. 24 * code. Called on the UI thread.
25 * @param context The Application context. 25 * @param context The Application context.
26 */ 26 */
27 public static void loadLibrary(Context context) { 27 public static void loadLibrary(Context context) {
28 ContextUtils.initApplicationContext(context.getApplicationContext());
28 System.loadLibrary("remoting_client_jni"); 29 System.loadLibrary("remoting_client_jni");
29
30 ContextUtils.initApplicationContext(context);
31 nativeLoadNative(); 30 nativeLoadNative();
32 } 31 }
33 32
34 /** Performs the native portion of the initialization. */ 33 /** Performs the native portion of the initialization. */
35 private static native void nativeLoadNative(); 34 private static native void nativeLoadNative();
36 35
37 /** Performs the native portion of the connection. */ 36 /** Performs the native portion of the connection. */
38 static native void nativeConnect(String username, String authToken, String h ostJid, 37 static native void nativeConnect(String username, String authToken, String h ostJid,
39 String hostId, String hostPubkey, String pairId, String pairSecret, 38 String hostId, String hostPubkey, String pairId, String pairSecret,
40 String capabilities, String flags); 39 String capabilities, String flags);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 @CalledByNative 173 @CalledByNative
175 private static void handleExtensionMessage(String type, String data) { 174 private static void handleExtensionMessage(String type, String data) {
176 if (Client.getInstance() != null) { 175 if (Client.getInstance() != null) {
177 Client.getInstance().handleExtensionMessage(type, data); 176 Client.getInstance().handleExtensionMessage(type, data);
178 } 177 }
179 } 178 }
180 179
181 /** Passes extension message to the native code. */ 180 /** Passes extension message to the native code. */
182 static native void nativeSendExtensionMessage(String type, String data); 181 static native void nativeSendExtensionMessage(String type, String data);
183 } 182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698