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 7bda849695ebe655abc73973361dec34264e00d6..be350eecf430d3547bd4c6f4483304f97f33d8d6 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 |
@@ -58,6 +58,11 @@ public abstract class OptionalLeaf extends ChildNode { |
dismiss(itemRemovedCallback); |
} |
+ @Override |
+ public final void visitItems(NodeVisitor visitor) { |
+ if (mVisible) visitOptionalItem(visitor); |
+ } |
+ |
/** @return Whether the optional item is currently visible. */ |
public final boolean isVisible() { |
return mVisible; |
@@ -112,4 +117,10 @@ public abstract class OptionalLeaf extends ChildNode { |
protected void dismiss(Callback<String> itemRemovedCallback) { |
assert false; |
} |
+ |
+ /** |
+ * Visits this item. This method is called iff the optional item is currently visible. |
+ * @param visitor The visitor with which to visit this item. |
+ */ |
+ protected abstract void visitOptionalItem(NodeVisitor visitor); |
} |