Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsCategoryInfo.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsCategoryInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsCategoryInfo.java |
index 3a3113d4ce3f4c9ae441a780756eaffa0d046ea4..c5d86a1c20f1ebe01dbaffdd653963ff8a574004 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsCategoryInfo.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsCategoryInfo.java |
@@ -4,10 +4,7 @@ |
package org.chromium.chrome.browser.ntp.cards; |
-import android.support.annotation.StringRes; |
- |
import org.chromium.base.Log; |
-import org.chromium.chrome.R; |
import org.chromium.chrome.browser.ntp.NewTabPageView.NewTabPageManager; |
import org.chromium.chrome.browser.ntp.snippets.CategoryInt; |
import org.chromium.chrome.browser.ntp.snippets.ContentSuggestionsCardLayout.ContentSuggestionsCardLayoutEnum; |
@@ -48,14 +45,20 @@ public class SuggestionsCategoryInfo { |
/** Whether this category should be shown if it offers no suggestions. */ |
private final boolean mShowIfEmpty; |
+ /** |
+ * Description text to use on the status card when there are no suggestions in this category. |
+ */ |
+ private final String mNoSuggestionsMessage; |
+ |
public SuggestionsCategoryInfo(@CategoryInt int category, String title, |
@ContentSuggestionsCardLayoutEnum int cardLayout, boolean hasMoreButton, |
- boolean showIfEmpty) { |
+ boolean showIfEmpty, String noSuggestionsMessage) { |
mCategory = category; |
mTitle = title; |
mCardLayout = cardLayout; |
mHasMoreButton = hasMoreButton; |
mShowIfEmpty = showIfEmpty; |
+ mNoSuggestionsMessage = noSuggestionsMessage; |
} |
public String getTitle() { |
@@ -81,6 +84,14 @@ public class SuggestionsCategoryInfo { |
} |
/** |
+ * Returns the string to use as description for the status card that is displayed when there |
+ * are no suggestions available for the provided category. |
+ */ |
+ public String getNoSuggestionsMessage() { |
+ return mNoSuggestionsMessage; |
+ } |
+ |
+ /** |
* Performs the appropriate action for the provided category, for the case where there are no |
* suggestions available. In general, this consists in navigating to the view showing all the |
* content, or fetching new content. |
@@ -108,26 +119,4 @@ public class SuggestionsCategoryInfo { |
break; |
} |
} |
- |
- /** |
- * Returns the string to use as description for the status card that is displayed when there |
- * are no suggestions available for the provided category. |
- */ |
- @StringRes |
- public int getNoSuggestionDescription() { |
- switch (mCategory) { |
- case KnownCategories.BOOKMARKS: |
- return R.string.ntp_status_card_no_bookmarks; |
- case KnownCategories.DOWNLOADS: |
- case KnownCategories.FOREIGN_TABS: |
- case KnownCategories.PHYSICAL_WEB_PAGES: |
- case KnownCategories.RECENT_TABS: |
- Log.wtf(TAG, "Requested description for unsupported category: %d", mCategory); |
- return 0; |
- case KnownCategories.ARTICLES: |
- return R.string.ntp_status_card_no_articles; |
- default: |
- return R.string.ntp_status_card_no_suggestions; |
- } |
- } |
} |