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

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

Issue 2573173002: 📰 Split TreeNode#init into SetParent and SetChildren (Closed)
Patch Set: revert getChildren() change Created 4 years 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/SuggestionsSection.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java
index f237cfb9d739240a192c728abcd1e127d1a2d0d7..cac3245b80a694fdebec4049f3515cfd3a0dca5d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java
@@ -20,7 +20,6 @@
import org.chromium.chrome.browser.offlinepages.OfflinePageItem;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -41,35 +40,21 @@
private final ActionItem mMoreButton;
private final ProgressItem mProgressIndicator;
- private final List<TreeNode> mChildren;
-
private boolean mIsNtpDestroyed;
- public SuggestionsSection(NodeParent parent, NewTabPageManager manager,
- OfflinePageBridge offlinePageBridge, SuggestionsCategoryInfo info) {
- super(parent);
+ public SuggestionsSection(NewTabPageManager manager, OfflinePageBridge offlinePageBridge,
+ SuggestionsCategoryInfo info) {
mCategoryInfo = info;
mOfflinePageBridge = offlinePageBridge;
mHeader = new SectionHeader(info.getTitle());
- mSuggestionsList = new SuggestionsList(this, info);
- mStatus = StatusItem.createNoSuggestionsItem(this);
+ mSuggestionsList = new SuggestionsList(info);
+ mStatus = StatusItem.createNoSuggestionsItem(info);
mMoreButton = new ActionItem(this);
- mProgressIndicator = new ProgressItem(this);
-
- mChildren = Arrays.asList(
- mHeader,
- mSuggestionsList,
- mStatus,
- mMoreButton,
- mProgressIndicator);
+ mProgressIndicator = new ProgressItem();
+ addChildren(mHeader, mSuggestionsList, mStatus, mMoreButton, mProgressIndicator);
setupOfflinePageBridgeObserver(manager);
- }
-
- @Override
- public void init() {
- super.init();
refreshChildrenVisibility();
}
@@ -77,8 +62,7 @@ public void init() {
private final List<SnippetArticle> mSuggestions = new ArrayList<>();
private final SuggestionsCategoryInfo mCategoryInfo;
- public SuggestionsList(NodeParent parent, SuggestionsCategoryInfo categoryInfo) {
- super(parent);
+ public SuggestionsList(SuggestionsCategoryInfo categoryInfo) {
mCategoryInfo = categoryInfo;
}
@@ -140,11 +124,6 @@ public void addAll(List<SnippetArticle> suggestions) {
}
}
- @Override
- protected List<TreeNode> getChildren() {
- return mChildren;
- }
-
private void setupOfflinePageBridgeObserver(NewTabPageManager manager) {
final OfflinePageBridge.OfflinePageModelObserver observer =
new OfflinePageBridge.OfflinePageModelObserver() {

Powered by Google App Engine
This is Rietveld 408576698