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

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

Issue 2225753003: Revert of Add per-section clearing and dismissed suggestions to snippets-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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. See |ClearCachedSuggestionsForDebugging|. 108 // providers. It does, however, not remove any suggestions from the provider's
109 void ClearAllCachedSuggestionsForDebugging(); 109 // sources, so if their configuration hasn't changed, they should return the
110 110 // same results when they fetch the next time. In particular, calling this
111 // Only for debugging use through the internals page. 111 // method will not mark any suggestions as dismissed.
112 // Removes all suggestions of the given |category| from all caches or internal 112 void ClearCachedSuggestionsForDebugging();
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);
126 113
127 // Only for debugging use through the internals page. Some providers 114 // Only for debugging use through the internals page. Some providers
128 // internally store a list of dismissed suggestions to prevent them from 115 // internally store a list of dismissed suggestions to prevent them from
129 // reappearing. This function clears all suggestions of the given |category| 116 // reappearing. This function clears all such lists in all providers, making
130 // from such lists, making dismissed suggestions reappear (if the provider 117 // dismissed suggestions reappear (only for certain providers).
131 // supports it). 118 void ClearDismissedSuggestionsForDebugging();
132 void ClearDismissedSuggestionsForDebugging(Category category);
133 119
134 CategoryFactory* category_factory() { return &category_factory_; } 120 CategoryFactory* category_factory() { return &category_factory_; }
135 121
136 // The reference to the NTPSnippetsService provider should only be set by the 122 // The reference to the NTPSnippetsService provider should only be set by the
137 // factory and only be used for scheduling, periodic fetching and debugging. 123 // factory and only be used for scheduling, periodic fetching and debugging.
138 NTPSnippetsService* ntp_snippets_service() { return ntp_snippets_service_; } 124 NTPSnippetsService* ntp_snippets_service() { return ntp_snippets_service_; }
139 void set_ntp_snippets_service(NTPSnippetsService* ntp_snippets_service) { 125 void set_ntp_snippets_service(NTPSnippetsService* ntp_snippets_service) {
140 ntp_snippets_service_ = ntp_snippets_service; 126 ntp_snippets_service_ = ntp_snippets_service;
141 } 127 }
142 128
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // background fetching and debugging calls to it. If the NTPSnippetsService is 193 // background fetching and debugging calls to it. If the NTPSnippetsService is
208 // loaded, it is also present in |providers_|, otherwise this is a nullptr. 194 // loaded, it is also present in |providers_|, otherwise this is a nullptr.
209 NTPSnippetsService* ntp_snippets_service_; 195 NTPSnippetsService* ntp_snippets_service_;
210 196
211 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); 197 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService);
212 }; 198 };
213 199
214 } // namespace ntp_snippets 200 } // namespace ntp_snippets
215 201
216 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ 202 #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