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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java

Issue 1996193003: Add support for calling the java Callback from native. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java
index 92e089fe14376b9865524324923985b51f00dc82..a712773c9dab21a03b3ab8867b9bdc9b55bc193f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java
@@ -23,14 +23,6 @@ public class SnippetsBridge {
private SnippetsObserver mObserver;
/**
- * A callback that is called after a snippet image was fetched from the snippets service.
- */
- public interface FetchSnippetImageCallback {
- @CalledByNative("FetchSnippetImageCallback")
- void onSnippetImageAvailable(Bitmap image);
- }
-
- /**
* An observer for events in the snippets service.
*/
public interface SnippetsObserver {
@@ -89,7 +81,7 @@ public class SnippetsBridge {
/**
* Fetches the thumbnail image for a snippet.
*/
- public void fetchSnippetImage(SnippetArticle snippet, FetchSnippetImageCallback callback) {
+ public void fetchSnippetImage(SnippetArticle snippet, Callback<Bitmap> callback) {
nativeFetchImage(mNativeSnippetsBridge, snippet.mId, callback);
}
@@ -102,14 +94,6 @@ public class SnippetsBridge {
}
/**
- * {@link Callback#onResult} is not annotated with CalledByNative, so we must use this wrapper.
- */
- @CalledByNative
- private static void runCallback(Callback<Boolean> callback, boolean result) {
- callback.onResult(result);
- }
-
- /**
* Sets the recipient for the fetched snippets.
*
* An observer needs to be set before the native code attempts to transmit snippets them to
@@ -155,5 +139,5 @@ public class SnippetsBridge {
private static native void nativeSnippetVisited(long nativeNTPSnippetsBridge,
Callback<Boolean> callback, String url);
private native void nativeFetchImage(
- long nativeNTPSnippetsBridge, String snippetId, FetchSnippetImageCallback callback);
+ long nativeNTPSnippetsBridge, String snippetId, Callback<Bitmap> callback);
}

Powered by Google App Engine
This is Rietveld 408576698