| 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 c91e6b921ada71dd42ea8f6f80839acc2b014dae..fafb73b72dd8e21139fa956d03697bc89fb0d9f0 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
|
| @@ -4,6 +4,7 @@
|
|
|
| package org.chromium.chrome.browser.ntp.snippets;
|
|
|
| +import org.chromium.base.Callback;
|
| import org.chromium.base.annotations.CalledByNative;
|
| import org.chromium.chrome.browser.profiles.Profile;
|
|
|
| @@ -73,6 +74,22 @@ public class SnippetsBridge {
|
| }
|
|
|
| /**
|
| + * Checks whether a snippet has been visited by querying the history for the snippet's URL.
|
| + */
|
| + public void getSnippedVisited(SnippetArticle snippet, Callback<Boolean> callback) {
|
| + assert mNativeSnippetsBridge != 0;
|
| + nativeSnippetVisited(mNativeSnippetsBridge, callback, snippet.mUrl);
|
| + }
|
| +
|
| + /**
|
| + * {@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
|
| @@ -110,4 +127,6 @@ public class SnippetsBridge {
|
| private static native void nativeRescheduleFetching();
|
| private native void nativeDiscardSnippet(long nativeNTPSnippetsBridge, String snippetUrl);
|
| private native void nativeSetObserver(long nativeNTPSnippetsBridge, SnippetsBridge bridge);
|
| + private static native void nativeSnippetVisited(long nativeNTPSnippetsBridge,
|
| + Callback<Boolean> callback, String url);
|
| }
|
|
|