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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/TreeNode.java

Issue 2860463002: [Suggestions] Remove TreeNode.getSuggestionAt() in favor of a visitor. (Closed)
Patch Set: review Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.ntp.cards; 5 package org.chromium.chrome.browser.ntp.cards;
6 6
7 import org.chromium.base.Callback; 7 import org.chromium.base.Callback;
8 import org.chromium.chrome.browser.ntp.snippets.SnippetArticle;
9 8
10 import java.util.Set; 9 import java.util.Set;
11 10
12 /** 11 /**
13 * A tree interface to allow the New Tab Page RecyclerView to delegate to other components. 12 * A tree interface to allow the New Tab Page RecyclerView to delegate to other components.
14 */ 13 */
15 public interface TreeNode { 14 public interface TreeNode {
16 /** 15 /**
17 * Sets the parent of this node. This method should be called at most once. Before the parent 16 * Sets the parent of this node. This method should be called at most once. Before the parent
18 * has been set, the node will not send any notifications about changes to i ts subtree. 17 * has been set, the node will not send any notifications about changes to i ts subtree.
(...skipping 26 matching lines...) Expand all
45 44
46 /** 45 /**
47 * Display the data at {@code position} under this subtree. 46 * Display the data at {@code position} under this subtree.
48 * @param holder The view holder that should be updated. 47 * @param holder The view holder that should be updated.
49 * @param position The position of the item under this subtree. 48 * @param position The position of the item under this subtree.
50 * @see android.support.v7.widget.RecyclerView.Adapter#onBindViewHolder 49 * @see android.support.v7.widget.RecyclerView.Adapter#onBindViewHolder
51 */ 50 */
52 void onBindViewHolder(NewTabPageViewHolder holder, int position); 51 void onBindViewHolder(NewTabPageViewHolder holder, int position);
53 52
54 /** 53 /**
55 * @param position The position to query.
56 * @return The article at {@code position} under this subtree, or null if th e item is not
57 * an article.
58 */
59 SnippetArticle getSuggestionAt(int position);
60
61 /**
62 * @param position the position of an item to be dismissed. 54 * @param position the position of an item to be dismissed.
63 * @return the set of item positions that should be dismissed simultaneously when dismissing the 55 * @return the set of item positions that should be dismissed simultaneously when dismissing the
64 * item at the given {@code position} (including the position itself ), or an empty set 56 * item at the given {@code position} (including the position itself ), or an empty set
65 * if the item can't be dismissed. 57 * if the item can't be dismissed.
66 * @see NewTabPageAdapter#getItemDismissalGroup 58 * @see NewTabPageAdapter#getItemDismissalGroup
67 */ 59 */
68 Set<Integer> getItemDismissalGroup(int position); 60 Set<Integer> getItemDismissalGroup(int position);
69 61
70 /** 62 /**
71 * Dismiss the item at the given {@code position}. 63 * Dismiss the item at the given {@code position}.
72 * @param position The position of the item to be dismissed. 64 * @param position The position of the item to be dismissed.
73 * @param itemRemovedCallback Should be called with the title of the dismiss ed item, to announce 65 * @param itemRemovedCallback Should be called with the title of the dismiss ed item, to announce
74 * it for accessibility purposes. 66 * it for accessibility purposes.
75 * @see NewTabPageAdapter#dismissItem 67 * @see NewTabPageAdapter#dismissItem
76 */ 68 */
77 public void dismissItem(int position, Callback<String> itemRemovedCallback); 69 void dismissItem(int position, Callback<String> itemRemovedCallback);
70
71 /**
72 * Iterates over all items under this subtree and visits them with the given
73 * {@link NodeVisitor}.
74 * @param visitor The {@link NodeVisitor} with which to visit all items unde r this subtree.
75 */
76 void visitItems(NodeVisitor visitor);
78 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698