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

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

Issue 2421823003: [NTP Snippets] Fix UI crash on empty remote sections (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7872f7b2e2070de3481e26b76d80eb168eb41ec6..687a67efae5a59a3187a46948acaab475a2b2464 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
@@ -87,9 +87,6 @@ public class SuggestionsCategoryInfo {
*/
public void performEmptyStateAction(NewTabPageManager manager, NewTabPageAdapter adapter) {
switch (mCategory) {
- case KnownCategories.ARTICLES:
- adapter.reloadSnippets();
- break;
case KnownCategories.BOOKMARKS:
manager.navigateToBookmarks();
break;
@@ -99,9 +96,16 @@ public class SuggestionsCategoryInfo {
case KnownCategories.FOREIGN_TABS:
manager.navigateToRecentTabs();
break;
- default:
+ case KnownCategories.PHYSICAL_WEB_PAGES:
+ case KnownCategories.RECENT_TABS:
Log.wtf(TAG, "'Empty State' action called for unsupported category: %d", mCategory);
break;
+ case KnownCategories.ARTICLES:
+ default:
+ // TODO(dgn): For now, we assume any unknown sections are remote sections and just
+ // reload all remote sections. crbug.com/656008
+ adapter.reloadSnippets();
+ break;
}
}
@@ -112,13 +116,19 @@ public class SuggestionsCategoryInfo {
@StringRes
public int getNoSuggestionDescription() {
switch (mCategory) {
- case KnownCategories.ARTICLES:
- return R.string.ntp_status_card_no_articles;
case KnownCategories.BOOKMARKS:
return R.string.ntp_status_card_no_bookmarks;
- default:
+ 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);
Marc Treib 2016/10/14 14:46:22 Not quite sure what's best to do here... this will
dgn 2016/10/14 14:48:29 Can they be enabled remotely? In that case it woul
Marc Treib 2016/10/14 15:10:44 They could in principle be enabled through Finch,
Marc Treib 2016/10/14 15:12:17 ...but generally I'd prefer crashing, so authors o
return 0;
+ case KnownCategories.ARTICLES:
+ default:
+ // TODO(dgn): For now, we assume any unknown sections are remote sections and just
+ // reuse the string for ARTICLES. crbug.com/656008
+ return R.string.ntp_status_card_no_articles;
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698