OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/callback_android.h" | 5 #include "base/android/callback_android.h" |
6 | 6 |
7 #include "jni/Callback_jni.h" | 7 #include "jni/Callback_jni.h" |
8 | 8 |
9 namespace base { | 9 namespace base { |
10 namespace android { | 10 namespace android { |
11 | 11 |
12 void RunCallbackAndroid(const JavaRef<jobject>& callback, | 12 void RunCallbackAndroid(const JavaRef<jobject>& callback, |
13 const JavaRef<jobject>& arg) { | 13 const JavaRef<jobject>& arg) { |
14 Java_Callback_onResultFromNativeV_JLO(base::android::AttachCurrentThread(), | 14 Java_Callback_onResultFromNativeV_JLO(base::android::AttachCurrentThread(), |
15 callback.obj(), | 15 callback.obj(), |
16 arg.obj()); | 16 arg.obj()); |
17 } | 17 } |
18 | 18 |
19 void RunCallbackAndroid(const JavaRef<jobject>& callback, bool arg) { | 19 void RunCallbackAndroid(const JavaRef<jobject>& callback, bool arg) { |
20 Java_Callback_onResultFromNativeV_Z(base::android::AttachCurrentThread(), | 20 Java_Callback_onResultFromNativeV_Z(base::android::AttachCurrentThread(), |
21 callback.obj(), | 21 callback.obj(), |
22 static_cast<jboolean>(arg)); | 22 static_cast<jboolean>(arg)); |
23 } | 23 } |
24 | 24 |
25 void RunCallbackAndroid(const JavaRef<jobject>& callback, int arg) { | 25 void RunCallbackAndroid(const JavaRef<jobject>& callback, int arg) { |
26 Java_Callback_onResultFromNativeV_I(base::android::AttachCurrentThread(), | 26 Java_Callback_onResultFromNativeV_I(base::android::AttachCurrentThread(), |
27 callback.obj(), arg); | 27 callback.obj(), arg); |
28 } | 28 } |
29 | 29 |
30 bool RegisterCallbackAndroid(JNIEnv* env) { | |
31 return RegisterNativesImpl(env); | |
32 } | |
33 | |
34 } // namespace android | 30 } // namespace android |
35 } // namespace base | 31 } // namespace base |
OLD | NEW |