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

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: 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/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..1e094e20d2175eba56946cab173291035e1bbdaf
--- /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 interface NodeVisitor {
+ /**
+ * Visits the above-the-fold item.
+ */
+ void visitAboveTheFoldItem();
+
+ /**
+ * Visits an action item.
+ * @param currentAction The action enum value for the item.
+ */
+ void visitActionItem(@ContentSuggestionsAdditionalAction int currentAction);
+
+ /**
+ * Visits the "all dimissed" item.
+ */
+ void visitAllDismissedItem();
+
+ /**
+ * Visits the footer.
+ */
+ void visitFooter();
+
+ /**
+ * Visits a progress item.
+ */
+ void visitProgressItem();
+
+ /**
+ * Visits a sign-in promo.
+ */
+ void visitSignInPromo();
+
+ /**
+ * Visits a spacing item.
+ */
+ void visitSpacingItem();
+
+ /**
+ * Visits a "no suggestions" item.
+ */
+ void visitNoSuggestionsItem();
+
+ /**
+ * Visits a suggestion.
+ * @param suggestion The {@link SnippetArticle} represented by the item.
+ */
+ void visitSuggestion(SnippetArticle suggestion);
+
+ /**
+ * Visits a header.
+ */
+ void visitHeader();
+
+ /**
+ * Visits the tile grid.
+ */
+ void visitTileGrid();
+}

Powered by Google App Engine
This is Rietveld 408576698