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

Unified Diff: components/ntp_snippets/content_suggestions_provider.h

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
Index: components/ntp_snippets/content_suggestions_provider.h
diff --git a/components/ntp_snippets/content_suggestions_provider.h b/components/ntp_snippets/content_suggestions_provider.h
index 995db450679bf008f38f2340dadc230ac4887f4b..eb03afa5425a46aeb5f76421b697e9683c04c409 100644
--- a/components/ntp_snippets/content_suggestions_provider.h
+++ b/components/ntp_snippets/content_suggestions_provider.h
@@ -66,6 +66,11 @@ class ContentSuggestionsProvider {
// ownership of the observer and the observer must outlive this provider.
virtual void SetObserver(Observer* observer) = 0;
+ // Returns the categories provided by this provider.
+ // TODO(pke): "The value returned by this getter must not change unless
+ // OnXxx is called on the observer."
+ virtual std::vector<ContentSuggestionsCategory> GetProvidedCategories() = 0;
+
// Determines the status of the given |category|, see
// ContentSuggestionsCategoryStatus.
virtual ContentSuggestionsCategoryStatus GetCategoryStatus(
@@ -94,13 +99,9 @@ class ContentSuggestionsProvider {
// have been permanently deleted, depending on the provider implementation.
virtual void ClearDismissedSuggestionsForDebugging() = 0;
- const std::vector<ContentSuggestionsCategory>& provided_categories() const {
- return provided_categories_;
- }
-
protected:
ContentSuggestionsProvider(
- const std::vector<ContentSuggestionsCategory>& provided_categories);
+ ContentSuggestionsCategoryFactory* category_factory);
virtual ~ContentSuggestionsProvider();
// Creates a unique ID. The given |within_category_id| must be unique among
@@ -108,16 +109,19 @@ class ContentSuggestionsProvider {
// combines it with the |category| to form an ID that is unique
// application-wide, because this provider is the only one that provides
// suggestions for that category.
- static std::string MakeUniqueID(ContentSuggestionsCategory category,
- const std::string& within_category_id);
+ std::string MakeUniqueID(ContentSuggestionsCategory category,
+ const std::string& within_category_id);
// Reverse functions for MakeUniqueID()
- static ContentSuggestionsCategory GetCategoryFromUniqueID(
- const std::string& unique_id);
- static std::string GetWithinCategoryIDFromUniqueID(
+ ContentSuggestionsCategory GetCategoryFromUniqueID(
const std::string& unique_id);
+ std::string GetWithinCategoryIDFromUniqueID(const std::string& unique_id);
+
+ ContentSuggestionsCategoryFactory* category_factory() const {
+ return category_factory_;
+ }
private:
- const std::vector<ContentSuggestionsCategory> provided_categories_;
+ ContentSuggestionsCategoryFactory* category_factory_;
};
} // namespace ntp_snippets
« no previous file with comments | « components/ntp_snippets/content_suggestions_category_status.h ('k') | components/ntp_snippets/content_suggestions_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698