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(); |
+} |