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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/OptionalLeaf.java

Issue 2860463002: [Suggestions] Remove TreeNode.getSuggestionAt() in favor of a visitor. (Closed)
Patch Set: rebase Created 3 years, 8 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/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);
}

Powered by Google App Engine
This is Rietveld 408576698