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

Unified Diff: chrome/browser/android/ntp/ntp_snippets_bridge.cc

Issue 2187233002: Add ContentSuggestionsCategoryFactory; Store categories as ints (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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 | chrome/browser/android/ntp/offline_page_suggestions_provider_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/ntp/ntp_snippets_bridge.cc
diff --git a/chrome/browser/android/ntp/ntp_snippets_bridge.cc b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
index 5f9cbf85b7f411f2d3751301aee002ac1df9f7ea..c4509a3de3aeab503649e6cb394e0c155ceebc57 100644
--- a/chrome/browser/android/ntp/ntp_snippets_bridge.cc
+++ b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
@@ -34,6 +34,7 @@ using base::android::ScopedJavaGlobalRef;
using base::android::ScopedJavaLocalRef;
using ntp_snippets::ContentSuggestionsCategory;
using ntp_snippets::ContentSuggestionsCategoryStatus;
+using ntp_snippets::KnownSuggestionsCategories;
namespace {
@@ -128,7 +129,8 @@ void NTPSnippetsBridge::SnippetVisited(JNIEnv* env,
int NTPSnippetsBridge::GetCategoryStatus(JNIEnv* env,
const JavaParamRef<jobject>& obj) {
return static_cast<int>(content_suggestions_service_->GetCategoryStatus(
- ContentSuggestionsCategory::ARTICLES));
+ content_suggestions_service_->category_factory()->FromKnownCategory(
+ KnownSuggestionsCategories::ARTICLES)));
}
NTPSnippetsBridge::~NTPSnippetsBridge() {}
@@ -190,7 +192,7 @@ void NTPSnippetsBridge::OnNewSuggestions() {
void NTPSnippetsBridge::OnCategoryStatusChanged(
ContentSuggestionsCategory category,
ContentSuggestionsCategoryStatus new_status) {
- if (category != ContentSuggestionsCategory::ARTICLES)
+ if (!category.IsKnownCategory(KnownSuggestionsCategories::ARTICLES))
return;
JNIEnv* env = base::android::AttachCurrentThread();
« no previous file with comments | « no previous file | chrome/browser/android/ntp/offline_page_suggestions_provider_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698