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

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

Issue 2617133002: [Android NTP] Move more of the dismissal logic into the tree. (Closed)
Patch Set: annotation 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 side-by-side diff with in-line comments
Download patch
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 e6c76f06703d00f9a68b8c809e17266a9ca4f733..7f333ef22256a8410a369c0c8ef9a9776634b584 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
@@ -5,11 +5,15 @@
package org.chromium.chrome.browser.ntp.cards;
import org.chromium.base.Log;
+import org.chromium.chrome.browser.ntp.ContextMenuManager;
+import org.chromium.chrome.browser.ntp.ContextMenuManager.ContextMenuItemId;
import org.chromium.chrome.browser.ntp.snippets.CategoryInt;
import org.chromium.chrome.browser.ntp.snippets.ContentSuggestionsCardLayout.ContentSuggestionsCardLayoutEnum;
import org.chromium.chrome.browser.ntp.snippets.KnownCategories;
import org.chromium.chrome.browser.suggestions.SuggestionsNavigationDelegate;
+import javax.annotation.Nullable;
+
/**
* Contains meta information about a Category. Equivalent of the CategoryInfo class in
* components/ntp_snippets/category_info.h.
@@ -109,14 +113,32 @@ 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.
+ * 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;
}
/**
+ * @param menuItemId The ID for a context menu item.
+ * @return Whether the given context menu item is supported by this category, or null if that
+ * decision does not depend on the category.
+ */
+ @Nullable
+ public Boolean isContextMenuItemSupported(@ContextMenuItemId int menuItemId) {
+ if (menuItemId == ContextMenuManager.ID_REMOVE) return null;
+
+ if (mCategory == KnownCategories.RECENT_TABS) return false;
+
+ if (mCategory == KnownCategories.DOWNLOADS) {
+ if (menuItemId == ContextMenuManager.ID_OPEN_IN_INCOGNITO_TAB) return false;
+ if (menuItemId == ContextMenuManager.ID_SAVE_FOR_OFFLINE) return false;
+ }
+ return true;
+ }
+
+ /**
* Performs the View All action for the provided category, navigating navigating to the view
* showing all the content.
*/

Powered by Google App Engine
This is Rietveld 408576698