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

Unified Diff: components/ntp_snippets/content_suggestions_service.h

Issue 2194203002: Make ContentSuggestionsService recognize new/removed categories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@renaming
Patch Set: Marc's comments Created 4 years, 4 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: components/ntp_snippets/content_suggestions_service.h
diff --git a/components/ntp_snippets/content_suggestions_service.h b/components/ntp_snippets/content_suggestions_service.h
index 24be9beacb519b6e7af1ceda6490aad8c2a964c5..9c7645cfb412cbc51d554597b73c19cad6fdc975 100644
--- a/components/ntp_snippets/content_suggestions_service.h
+++ b/components/ntp_snippets/content_suggestions_service.h
@@ -126,14 +126,19 @@ class ContentSuggestionsService : public KeyedService,
};
// Implementation of ContentSuggestionsProvider::Observer.
- void OnNewSuggestions(Category changed_category,
+ void OnNewSuggestions(ContentSuggestionsProvider* provider,
+ Category category,
std::vector<ContentSuggestion> suggestions) override;
- void OnCategoryStatusChanged(Category changed_category,
+ void OnCategoryStatusChanged(ContentSuggestionsProvider* provider,
+ Category category,
CategoryStatus new_status) override;
void OnProviderShutdown(ContentSuggestionsProvider* provider) override;
- // Checks whether a provider for the given |category| is registered.
- bool IsCategoryRegistered(Category category) const;
+ // Registers the given |provider| for the given |category|, unless it is
+ // already registered. Returns true if the category was newly registered or
+ // false if it was present before.
+ bool RegisterCategoryIfRequired(ContentSuggestionsProvider* provider,
+ Category category);
// Fires the OnCategoryStatusChanged event for the given |category|.
void NotifyCategoryStatusChanged(Category category);
@@ -148,7 +153,7 @@ class ContentSuggestionsService : public KeyedService,
// provides multiple categories. The keys of this map are exactly the entries
// of |categories_|.
std::map<Category, ContentSuggestionsProvider*, CompareCategoriesByID>
- providers_;
+ providers_by_category_;
// All current suggestion categories, in an order determined by the
// |category_factory_|. This vector contains exactly the same categories as
« no previous file with comments | « components/ntp_snippets/content_suggestions_provider.h ('k') | components/ntp_snippets/content_suggestions_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698