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

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

Issue 2860463002: [Suggestions] Remove TreeNode.getSuggestionAt() in favor of a visitor. (Closed)
Patch Set: review Created 3 years, 7 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/NodeVisitor.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NodeVisitor.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NodeVisitor.java
new file mode 100644
index 0000000000000000000000000000000000000000..1586e8d93cdf4a8206ca74195689856a89da65d7
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NodeVisitor.java
@@ -0,0 +1,70 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.ntp.cards;
+
+import org.chromium.chrome.browser.ntp.snippets.SnippetArticle;
+import org.chromium.chrome.browser.suggestions.ContentSuggestionsAdditionalAction;
+
+/**
+ * Allows implementing a visitor pattern to iterate over all items under a (sub-)tree.
+ */
+public class NodeVisitor {
+ /**
+ * Visits the above-the-fold item.
+ */
+ public void visitAboveTheFoldItem() {}
+
+ /**
+ * Visits an action item.
+ * @param currentAction The action enum value for the item.
+ */
+ public void visitActionItem(@ContentSuggestionsAdditionalAction int currentAction) {}
+
+ /**
+ * Visits the "all dimissed" item.
+ */
+ public void visitAllDismissedItem() {}
+
+ /**
+ * Visits the footer.
+ */
+ public void visitFooter() {}
+
+ /**
+ * Visits a progress item.
+ */
+ public void visitProgressItem() {}
+
+ /**
+ * Visits a sign-in promo.
+ */
+ public void visitSignInPromo() {}
+
+ /**
+ * Visits a spacing item.
+ */
+ public void visitSpacingItem() {}
+
+ /**
+ * Visits a "no suggestions" item.
+ */
+ public void visitNoSuggestionsItem() {}
+
+ /**
+ * Visits a suggestion.
+ * @param suggestion The {@link SnippetArticle} represented by the item.
+ */
+ public void visitSuggestion(SnippetArticle suggestion) {}
+
+ /**
+ * Visits a header.
+ */
+ public void visitHeader() {}
+
+ /**
+ * Visits the tile grid.
+ */
+ public void visitTileGrid() {}
+}

Powered by Google App Engine
This is Rietveld 408576698