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

Side by Side Diff: base/android/callback_android.cc

Issue 2804913003: Remove redundant code from Android context menu native. (Closed)
Patch Set: Address dtrainor@ comments Created 3 years, 8 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 | « base/android/callback_android.h ('k') | base/android/java/src/org/chromium/base/Callback.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/android/jni_array.h"
8 #include "base/android/scoped_java_ref.h"
7 #include "jni/Callback_jni.h" 9 #include "jni/Callback_jni.h"
8 10
9 namespace base { 11 namespace base {
10 namespace android { 12 namespace android {
11 13
12 void RunCallbackAndroid(const JavaRef<jobject>& callback, 14 void RunCallbackAndroid(const JavaRef<jobject>& callback,
13 const JavaRef<jobject>& arg) { 15 const JavaRef<jobject>& arg) {
14 Java_Callback_onResultFromNativeV_JLO(base::android::AttachCurrentThread(), 16 Java_Callback_onResultFromNativeV_JLO(base::android::AttachCurrentThread(),
15 callback, arg); 17 callback, arg);
16 } 18 }
17 19
18 void RunCallbackAndroid(const JavaRef<jobject>& callback, bool arg) { 20 void RunCallbackAndroid(const JavaRef<jobject>& callback, bool arg) {
19 Java_Callback_onResultFromNativeV_Z(base::android::AttachCurrentThread(), 21 Java_Callback_onResultFromNativeV_Z(base::android::AttachCurrentThread(),
20 callback, static_cast<jboolean>(arg)); 22 callback, static_cast<jboolean>(arg));
21 } 23 }
22 24
23 void RunCallbackAndroid(const JavaRef<jobject>& callback, int arg) { 25 void RunCallbackAndroid(const JavaRef<jobject>& callback, int arg) {
24 Java_Callback_onResultFromNativeV_I(base::android::AttachCurrentThread(), 26 Java_Callback_onResultFromNativeV_I(base::android::AttachCurrentThread(),
25 callback, arg); 27 callback, arg);
26 } 28 }
27 29
30 void RunCallbackAndroid(const JavaRef<jobject>& callback,
31 const std::vector<uint8_t>& arg) {
32 JNIEnv* env = base::android::AttachCurrentThread();
33 base::android::ScopedJavaLocalRef<jbyteArray> j_bytes =
34 base::android::ToJavaByteArray(env, arg);
35 Java_Callback_onResultFromNativeV_AB(env, callback, j_bytes);
36 }
37
28 } // namespace android 38 } // namespace android
29 } // namespace base 39 } // namespace base
OLDNEW
« no previous file with comments | « base/android/callback_android.h ('k') | base/android/java/src/org/chromium/base/Callback.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698