Chromium Code Reviews| 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 384133a92cc473837e0d7891ac514c99580f7353..8d2e523ccf63b2502fc4e6b90cdb1076c4d0c4dd 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 |
| @@ -7,7 +7,6 @@ |
| import android.graphics.Bitmap; |
| import org.chromium.base.Callback; |
| - |
| import org.chromium.base.annotations.CalledByNative; |
| import org.chromium.chrome.browser.profiles.Profile; |
| @@ -36,6 +35,9 @@ |
| */ |
| public interface SnippetsObserver { |
| void onSnippetsReceived(List<SnippetArticle> snippets); |
| + |
| + /** Called when the service wants to force clear the displayed snippets. */ |
| + void onSnippetsCleared(); |
| } |
| /** |
| @@ -139,6 +141,15 @@ private void onSnippetsAvailable(String[] ids, String[] titles, String[] urls, S |
| mObserver.onSnippetsReceived(newSnippets); |
| } |
| + @CalledByNative |
| + private void onSnippetsCleared() { |
| + // Don't notify observer if we've already been destroyed. |
| + if (mNativeSnippetsBridge == 0) return; |
|
Bernhard Bauer
2016/05/17 09:12:48
If the native side has been destroyed, this wouldn
dgn
2016/05/17 10:46:00
Removed the thing entirely. I'm not quite sure in
|
| + if (mObserver == null) return; |
| + |
| + mObserver.onSnippetsCleared(); |
| + } |
| + |
| private native long nativeInit(Profile profile); |
| private native void nativeDestroy(long nativeNTPSnippetsBridge); |
| private static native void nativeFetchSnippets(); |