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

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

Issue 2623993007: 🏠 Extract the ContentSuggestionManager interface from NTP (Closed)
Patch Set: aaaand rebase again Created 3 years, 11 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.Log; 7 import org.chromium.base.Log;
8 import org.chromium.chrome.browser.ntp.NewTabPageView.NewTabPageManager;
9 import org.chromium.chrome.browser.ntp.snippets.CategoryInt; 8 import org.chromium.chrome.browser.ntp.snippets.CategoryInt;
10 import org.chromium.chrome.browser.ntp.snippets.ContentSuggestionsCardLayout.Con tentSuggestionsCardLayoutEnum; 9 import org.chromium.chrome.browser.ntp.snippets.ContentSuggestionsCardLayout.Con tentSuggestionsCardLayoutEnum;
11
12 import org.chromium.chrome.browser.ntp.snippets.KnownCategories; 10 import org.chromium.chrome.browser.ntp.snippets.KnownCategories;
11 import org.chromium.chrome.browser.suggestions.SuggestionsNavigationDelegate;
13 12
14 /** 13 /**
15 * Contains meta information about a Category. Equivalent of the CategoryInfo cl ass in 14 * Contains meta information about a Category. Equivalent of the CategoryInfo cl ass in
16 * components/ntp_snippets/category_info.h. 15 * components/ntp_snippets/category_info.h.
17 */ 16 */
18 public class SuggestionsCategoryInfo { 17 public class SuggestionsCategoryInfo {
19 private static final String TAG = "NtpCards"; 18 private static final String TAG = "NtpCards";
20 19
21 /** 20 /**
22 * Id of the category. 21 * Id of the category.
(...skipping 23 matching lines...) Expand all
46 * Whether the category supports a "Reload" action, that triggers fetching n ew suggestions to 45 * Whether the category supports a "Reload" action, that triggers fetching n ew suggestions to
47 * replace the current ones. 46 * replace the current ones.
48 * @see ActionItem 47 * @see ActionItem
49 */ 48 */
50 private final boolean mHasReloadAction; 49 private final boolean mHasReloadAction;
51 50
52 /** 51 /**
53 * Whether the category supports a "ViewAll" action, that triggers displayin g all the content 52 * Whether the category supports a "ViewAll" action, that triggers displayin g all the content
54 * related to the current categories. 53 * related to the current categories.
55 * @see ActionItem 54 * @see ActionItem
56 * @see #performViewAllAction(NewTabPageManager) 55 * @see #performViewAllAction(SuggestionsNavigationDelegate)
57 */ 56 */
58 private final boolean mHasViewAllAction; 57 private final boolean mHasViewAllAction;
59 58
60 /** Whether this category should be shown if it offers no suggestions. */ 59 /** Whether this category should be shown if it offers no suggestions. */
61 private final boolean mShowIfEmpty; 60 private final boolean mShowIfEmpty;
62 61
63 /** 62 /**
64 * Description text to use on the status card when there are no suggestions in this category. 63 * Description text to use on the status card when there are no suggestions in this category.
65 */ 64 */
66 private final String mNoSuggestionsMessage; 65 private final String mNoSuggestionsMessage;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 * are no suggestions available for the provided category. 113 * are no suggestions available for the provided category.
115 */ 114 */
116 public String getNoSuggestionsMessage() { 115 public String getNoSuggestionsMessage() {
117 return mNoSuggestionsMessage; 116 return mNoSuggestionsMessage;
118 } 117 }
119 118
120 /** 119 /**
121 * Performs the View All action for the provided category, navigating naviga ting to the view 120 * Performs the View All action for the provided category, navigating naviga ting to the view
122 * showing all the content. 121 * showing all the content.
123 */ 122 */
124 public void performViewAllAction(NewTabPageManager manager) { 123 public void performViewAllAction(SuggestionsNavigationDelegate navigationDel egate) {
125 switch (mCategory) { 124 switch (mCategory) {
126 case KnownCategories.BOOKMARKS: 125 case KnownCategories.BOOKMARKS:
127 manager.navigateToBookmarks(); 126 navigationDelegate.navigateToBookmarks();
128 break; 127 break;
129 case KnownCategories.DOWNLOADS: 128 case KnownCategories.DOWNLOADS:
130 manager.navigateToDownloadManager(); 129 navigationDelegate.navigateToDownloadManager();
131 break; 130 break;
132 case KnownCategories.FOREIGN_TABS: 131 case KnownCategories.FOREIGN_TABS:
133 manager.navigateToRecentTabs(); 132 navigationDelegate.navigateToRecentTabs();
134 break; 133 break;
135 case KnownCategories.PHYSICAL_WEB_PAGES: 134 case KnownCategories.PHYSICAL_WEB_PAGES:
136 case KnownCategories.RECENT_TABS: 135 case KnownCategories.RECENT_TABS:
137 case KnownCategories.ARTICLES: 136 case KnownCategories.ARTICLES:
138 default: 137 default:
139 Log.wtf(TAG, "'Empty State' action called for unsupported catego ry: %d", mCategory); 138 Log.wtf(TAG, "'Empty State' action called for unsupported catego ry: %d", mCategory);
140 break; 139 break;
141 } 140 }
142 } 141 }
143 } 142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698