| Index: chrome/browser/android/ntp/ntp_snippets_bridge.cc
|
| diff --git a/chrome/browser/android/ntp/ntp_snippets_bridge.cc b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
|
| index faba81df0f75d39368a2fba4325d4443346c64c9..5e9e257a3544e37602e81a6182b113809d54629c 100644
|
| --- a/chrome/browser/android/ntp/ntp_snippets_bridge.cc
|
| +++ b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include <jni.h>
|
|
|
| +#include "base/android/callback_android.h"
|
| #include "base/android/jni_android.h"
|
| #include "base/android/jni_array.h"
|
| #include "base/android/jni_string.h"
|
| @@ -38,10 +39,7 @@ void SnippetVisitedHistoryRequestCallback(
|
| const history::URLRow& row,
|
| const history::VisitVector& visitVector) {
|
| bool visited = success && row.visit_count() != 0;
|
| -
|
| - JNIEnv* env = base::android::AttachCurrentThread();
|
| - Java_SnippetsBridge_runCallback(env, callback.obj(),
|
| - static_cast<jboolean>(visited));
|
| + base::android::RunCallbackAndroid(callback, visited);
|
| }
|
|
|
| } // namespace
|
| @@ -178,14 +176,11 @@ void NTPSnippetsBridge::NTPSnippetsServiceDisabled() {
|
| void NTPSnippetsBridge::OnImageFetched(ScopedJavaGlobalRef<jobject> callback,
|
| const std::string& snippet_id,
|
| const gfx::Image& image) {
|
| - JNIEnv* env = AttachCurrentThread();
|
| -
|
| ScopedJavaLocalRef<jobject> j_bitmap;
|
| if (!image.IsEmpty())
|
| j_bitmap = gfx::ConvertToJavaBitmap(image.ToSkBitmap());
|
|
|
| - Java_FetchSnippetImageCallback_onSnippetImageAvailable(env, callback.obj(),
|
| - j_bitmap.obj());
|
| + base::android::RunCallbackAndroid(callback, j_bitmap);
|
| }
|
|
|
| // static
|
|
|