OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "base/android/context_utils.h" | 5 #include "base/android/context_utils.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 | 8 |
9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 g_application_context.Get().Reset(context); | 31 g_application_context.Get().Reset(context); |
32 } | 32 } |
33 | 33 |
34 } // namespace | 34 } // namespace |
35 | 35 |
36 jobject GetApplicationContext() { | 36 jobject GetApplicationContext() { |
37 DCHECK(!g_application_context.Get().is_null()); | 37 DCHECK(!g_application_context.Get().is_null()); |
38 return g_application_context.Get().obj(); | 38 return g_application_context.Get().obj(); |
39 } | 39 } |
40 | 40 |
41 void InitApplicationContext(JNIEnv* env, const JavaRef<jobject>& context) { | 41 void InitApplicationContext(JNIEnv* env, const JavaRef<jobject>& context) { |
Yaron
2016/04/25 14:09:45
header file needs to be updated
Peter Wen
2016/04/25 15:30:30
Done.
| |
42 SetNativeApplicationContext(env, context); | 42 SetNativeApplicationContext(env, context); |
43 Java_ContextUtils_initJavaSideApplicationContext(env, context.obj()); | |
44 } | 43 } |
45 | 44 |
46 static void InitNativeSideApplicationContext( | 45 static void InitNativeSideApplicationContext( |
47 JNIEnv* env, | 46 JNIEnv* env, |
48 const JavaParamRef<jclass>& clazz, | 47 const JavaParamRef<jclass>& clazz, |
49 const JavaParamRef<jobject>& context) { | 48 const JavaParamRef<jobject>& context) { |
50 SetNativeApplicationContext(env, context); | 49 SetNativeApplicationContext(env, context); |
51 } | 50 } |
52 | 51 |
53 bool RegisterContextUtils(JNIEnv* env) { | 52 bool RegisterContextUtils(JNIEnv* env) { |
54 return RegisterNativesImpl(env); | 53 return RegisterNativesImpl(env); |
55 } | 54 } |
56 | 55 |
57 } // namespace android | 56 } // namespace android |
58 } // namespace base | 57 } // namespace base |
OLD | NEW |