Chromium Code Reviews| 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 928a3a04151d9eb0adc2e5ff7c0a4410834a5be2..bddbddc4001e719ccbd72528c89d7c9be0340e1b 100644 |
| --- a/components/ntp_snippets/content_suggestions_service.h |
| +++ b/components/ntp_snippets/content_suggestions_service.h |
| @@ -23,8 +23,10 @@ |
| #include "components/ntp_snippets/category_status.h" |
| #include "components/ntp_snippets/content_suggestions_provider.h" |
| #include "components/ntp_snippets/user_classifier.h" |
| +#include "components/prefs/pref_service.h" |
|
Marc Treib
2016/10/13 15:59:01
Is this needed? Note that there's already a forwar
dgn
2016/10/14 21:20:28
Done.
|
| class PrefService; |
| +class PrefRegistrySimple; |
| namespace gfx { |
| class Image; |
| @@ -92,6 +94,8 @@ class ContentSuggestionsService : public KeyedService, |
| // Inherited from KeyedService. |
| void Shutdown() override; |
| + static void RegisterProfilePrefs(PrefRegistrySimple* registry); |
| + |
| State state() { return state_; } |
| // Gets all categories for which a provider is registered. The categories |
| @@ -212,9 +216,13 @@ class ContentSuggestionsService : public KeyedService, |
| // 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. |
| + // false if it is dismissed or was present before. |
| bool RegisterCategoryIfRequired(ContentSuggestionsProvider* provider, |
|
Marc Treib
2016/10/13 15:59:01
Would RegisterProviderForCategory be a better name
dgn
2016/10/14 21:20:28
Done.
|
| Category category); |
| + void RegisterCategoryInternal(Category category, |
| + ContentSuggestionsProvider* provider); |
| + void UnregisterCategory(Category category, |
| + ContentSuggestionsProvider* provider); |
|
Marc Treib
2016/10/13 15:59:01
nit: These two have the arguments the other way ar
dgn
2016/10/14 21:20:28
Different names now. The category is the main thin
|
| // Removes a suggestion from the local store |suggestions_by_category_|, if it |
| // exists. Returns true if a suggestion was removed. |
| @@ -225,6 +233,14 @@ class ContentSuggestionsService : public KeyedService, |
| void SortCategories(); |
| + bool IsCategoryDismissed(Category category) const; |
| + |
| + // Re-enables a dismissed category, making querying its provider possible. |
| + void RestoreDismissedCategory(Category category); |
| + |
| + void RestoreDismissedCategoriesFromPrefs(); |
| + void StoreDismissedCategoriesToPrefs(); |
| + |
| // Whether the content suggestions feature is enabled. |
| State state_; |
| @@ -272,6 +288,8 @@ class ContentSuggestionsService : public KeyedService, |
| // loaded, it is also present in |providers_|, otherwise this is a nullptr. |
| NTPSnippetsService* ntp_snippets_service_; |
| + PrefService* pref_service_; |
| + |
| UserClassifier user_classifier_; |
| DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); |