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

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: 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..6d611b4b87d25a593cbac9de6018c19eee54fdb0 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> provided_categories() = 0;
Marc Treib 2016/07/28 11:41:46 GetProvidedCategories - let's use hacker_style met
Philipp Keck 2016/07/28 13:50:54 Done.
+
// 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,14 @@ 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);
- private:
- const std::vector<ContentSuggestionsCategory> provided_categories_;
+ ContentSuggestionsCategoryFactory* category_factory_;
Marc Treib 2016/07/28 11:41:46 Non-private members aren't allowed. You'll have to
Philipp Keck 2016/07/28 13:50:54 Done.
};
} // namespace ntp_snippets

Powered by Google App Engine
This is Rietveld 408576698