| OLD | NEW |
| 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 <set> | 10 #include <set> |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // reappearing. This function clears all suggestions of the given |category| | 188 // reappearing. This function clears all suggestions of the given |category| |
| 189 // from such lists, making dismissed suggestions reappear (if the provider | 189 // from such lists, making dismissed suggestions reappear (if the provider |
| 190 // supports it). | 190 // supports it). |
| 191 void ClearDismissedSuggestionsForDebugging(Category category); | 191 void ClearDismissedSuggestionsForDebugging(Category category); |
| 192 | 192 |
| 193 CategoryFactory* category_factory() { return &category_factory_; } | 193 CategoryFactory* category_factory() { return &category_factory_; } |
| 194 | 194 |
| 195 // The reference to the RemoteSuggestionsProvider provider should only be set | 195 // The reference to the RemoteSuggestionsProvider provider should only be set |
| 196 // by the factory and only be used for scheduling, periodic fetching and | 196 // by the factory and only be used for scheduling, periodic fetching and |
| 197 // debugging. | 197 // debugging. |
| 198 RemoteSuggestionsProvider* ntp_snippets_service() { | 198 RemoteSuggestionsProvider* remote_suggestions_provider() { |
| 199 return ntp_snippets_service_; | 199 return remote_suggestions_provider_; |
| 200 } | 200 } |
| 201 void set_ntp_snippets_service( | 201 void set_remote_suggestions_provider( |
| 202 RemoteSuggestionsProvider* ntp_snippets_service) { | 202 RemoteSuggestionsProvider* remote_suggestions_provider) { |
| 203 ntp_snippets_service_ = ntp_snippets_service; | 203 remote_suggestions_provider_ = remote_suggestions_provider; |
| 204 } | 204 } |
| 205 | 205 |
| 206 UserClassifier* user_classifier() { return &user_classifier_; } | 206 UserClassifier* user_classifier() { return &user_classifier_; } |
| 207 | 207 |
| 208 private: | 208 private: |
| 209 friend class ContentSuggestionsServiceTest; | 209 friend class ContentSuggestionsServiceTest; |
| 210 | 210 |
| 211 // Implementation of ContentSuggestionsProvider::Observer. | 211 // Implementation of ContentSuggestionsProvider::Observer. |
| 212 void OnNewSuggestions(ContentSuggestionsProvider* provider, | 212 void OnNewSuggestions(ContentSuggestionsProvider* provider, |
| 213 Category category, | 213 Category category, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 history_service_observer_; | 308 history_service_observer_; |
| 309 | 309 |
| 310 base::ObserverList<Observer> observers_; | 310 base::ObserverList<Observer> observers_; |
| 311 | 311 |
| 312 const std::vector<ContentSuggestion> no_suggestions_; | 312 const std::vector<ContentSuggestion> no_suggestions_; |
| 313 | 313 |
| 314 // Keep a direct reference to this special provider to redirect scheduling, | 314 // Keep a direct reference to this special provider to redirect scheduling, |
| 315 // background fetching and debugging calls to it. If the | 315 // background fetching and debugging calls to it. If the |
| 316 // RemoteSuggestionsProvider is loaded, it is also present in |providers_|, | 316 // RemoteSuggestionsProvider is loaded, it is also present in |providers_|, |
| 317 // otherwise this is a nullptr. | 317 // otherwise this is a nullptr. |
| 318 RemoteSuggestionsProvider* ntp_snippets_service_; | 318 RemoteSuggestionsProvider* remote_suggestions_provider_; |
| 319 | 319 |
| 320 PrefService* pref_service_; | 320 PrefService* pref_service_; |
| 321 | 321 |
| 322 UserClassifier user_classifier_; | 322 UserClassifier user_classifier_; |
| 323 | 323 |
| 324 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); | 324 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); |
| 325 }; | 325 }; |
| 326 | 326 |
| 327 } // namespace ntp_snippets | 327 } // namespace ntp_snippets |
| 328 | 328 |
| 329 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ | 329 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ |
| OLD | NEW |