| Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/OptionalLeaf.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/OptionalLeaf.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/OptionalLeaf.java
|
| index fe95e48e7e90c380b6cdbf1ddee706011752f1a6..0cad55604f3771dbf850cc1f7448669a3f13136b 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/OptionalLeaf.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/OptionalLeaf.java
|
| @@ -9,6 +9,9 @@ import android.support.annotation.CallSuper;
|
| import org.chromium.base.Callback;
|
| import org.chromium.chrome.browser.ntp.snippets.SnippetArticle;
|
|
|
| +import java.util.Collections;
|
| +import java.util.Set;
|
| +
|
| /**
|
| * An optional leaf (i.e. single item) in the tree. Depending on its internal state (see
|
| * {@link #isVisible()}), the item will be present or absent from the tree, by manipulating the
|
| @@ -44,15 +47,15 @@ public abstract class OptionalLeaf extends ChildNode {
|
| }
|
|
|
| @Override
|
| - public void dismissItem(int position, Callback<String> itemRemovedCallback) {
|
| + public Set<Integer> getItemDismissalGroup(int position) {
|
| checkIndex(position);
|
| - dismiss(itemRemovedCallback);
|
| + return canBeDismissed() ? Collections.singleton(0) : Collections.<Integer>emptySet();
|
| }
|
|
|
| @Override
|
| - public int getDismissSiblingPosDelta(int position) {
|
| + public void dismissItem(int position, Callback<String> itemRemovedCallback) {
|
| checkIndex(position);
|
| - return 0;
|
| + dismiss(itemRemovedCallback);
|
| }
|
|
|
| /** @return Whether the optional item is currently visible. */
|
| @@ -93,6 +96,13 @@ public abstract class OptionalLeaf extends ChildNode {
|
| protected abstract int getItemViewType();
|
|
|
| /**
|
| + * @return Whether the item can be dismissed.
|
| + */
|
| + protected boolean canBeDismissed() {
|
| + return false;
|
| + }
|
| +
|
| + /**
|
| * Dismiss this item. The default implementation asserts, as by default items can't be
|
| * dismissed.
|
| * @param itemRemovedCallback Should be called with the title of the dismissed item, to announce
|
|
|