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

Side by Side Diff: components/ntp_snippets/content_suggestions_service.h

Issue 2223073002: Add per-section clearing and dismissed suggestions to snippets-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix non-Debug builds 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_
6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ 6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 void AddObserver(Observer* observer); 98 void AddObserver(Observer* observer);
99 void RemoveObserver(Observer* observer); 99 void RemoveObserver(Observer* observer);
100 100
101 // Registers a new ContentSuggestionsProvider. It must be ensured that at most 101 // Registers a new ContentSuggestionsProvider. It must be ensured that at most
102 // one provider is registered for every category and that this method is 102 // one provider is registered for every category and that this method is
103 // called only once per provider. 103 // called only once per provider.
104 void RegisterProvider(std::unique_ptr<ContentSuggestionsProvider> provider); 104 void RegisterProvider(std::unique_ptr<ContentSuggestionsProvider> provider);
105 105
106 // Only for debugging use through the internals page. 106 // Only for debugging use through the internals page.
107 // Removes all suggestions from all caches or internal stores in all 107 // Removes all suggestions from all caches or internal stores in all
108 // providers. It does, however, not remove any suggestions from the provider's 108 // providers. See |ClearCachedSuggestionsForDebugging|.
109 // sources, so if their configuration hasn't changed, they should return the 109 void ClearAllCachedSuggestionsForDebugging();
110 // same results when they fetch the next time. In particular, calling this 110
111 // method will not mark any suggestions as dismissed. 111 // Only for debugging use through the internals page.
112 void ClearCachedSuggestionsForDebugging(); 112 // Removes all suggestions of the given |category| from all caches or internal
113 // stores in the service and the corresponding provider. It does, however, not
114 // remove any suggestions from the provider's sources, so if its configuration
115 // hasn't changed, it might return the same results when it fetches the next
116 // time. In particular, calling this method will not mark any suggestions as
117 // dismissed.
118 void ClearCachedSuggestionsForDebugging(Category category);
119
120 // Only for debugging use through the internals page.
121 // Retrieves suggestions of the given |category| that have previously been
122 // dismissed and are still stored in the respective provider. If the
123 // provider doesn't store dismissed suggestions, this returns an empty vector.
124 std::vector<ContentSuggestion> GetDismissedSuggestionsForDebugging(
125 Category category);
113 126
114 // Only for debugging use through the internals page. Some providers 127 // Only for debugging use through the internals page. Some providers
115 // internally store a list of dismissed suggestions to prevent them from 128 // internally store a list of dismissed suggestions to prevent them from
116 // reappearing. This function clears all such lists in all providers, making 129 // reappearing. This function clears all suggestions of the given |category|
117 // dismissed suggestions reappear (only for certain providers). 130 // from such lists, making dismissed suggestions reappear (if the provider
118 void ClearDismissedSuggestionsForDebugging(); 131 // supports it).
132 void ClearDismissedSuggestionsForDebugging(Category category);
119 133
120 CategoryFactory* category_factory() { return &category_factory_; } 134 CategoryFactory* category_factory() { return &category_factory_; }
121 135
122 // The reference to the NTPSnippetsService provider should only be set by the 136 // The reference to the NTPSnippetsService provider should only be set by the
123 // factory and only be used for scheduling, periodic fetching and debugging. 137 // factory and only be used for scheduling, periodic fetching and debugging.
124 NTPSnippetsService* ntp_snippets_service() { return ntp_snippets_service_; } 138 NTPSnippetsService* ntp_snippets_service() { return ntp_snippets_service_; }
125 void set_ntp_snippets_service(NTPSnippetsService* ntp_snippets_service) { 139 void set_ntp_snippets_service(NTPSnippetsService* ntp_snippets_service) {
126 ntp_snippets_service_ = ntp_snippets_service; 140 ntp_snippets_service_ = ntp_snippets_service;
127 } 141 }
128 142
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // background fetching and debugging calls to it. If the NTPSnippetsService is 207 // background fetching and debugging calls to it. If the NTPSnippetsService is
194 // loaded, it is also present in |providers_|, otherwise this is a nullptr. 208 // loaded, it is also present in |providers_|, otherwise this is a nullptr.
195 NTPSnippetsService* ntp_snippets_service_; 209 NTPSnippetsService* ntp_snippets_service_;
196 210
197 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); 211 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService);
198 }; 212 };
199 213
200 } // namespace ntp_snippets 214 } // namespace ntp_snippets
201 215
202 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ 216 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_
OLDNEW
« 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