| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // runs the |callback|. If that suggestion doesn't exist or the fetch fails, | 114 // runs the |callback|. If that suggestion doesn't exist or the fetch fails, |
| 115 // the callback gets an empty image. The callback will not be called | 115 // the callback gets an empty image. The callback will not be called |
| 116 // synchronously. | 116 // synchronously. |
| 117 void FetchSuggestionImage(const std::string& suggestion_id, | 117 void FetchSuggestionImage(const std::string& suggestion_id, |
| 118 const ImageFetchedCallback& callback); | 118 const ImageFetchedCallback& callback); |
| 119 | 119 |
| 120 // Dismisses the suggestion with the given |suggestion_id|, if it exists. | 120 // Dismisses the suggestion with the given |suggestion_id|, if it exists. |
| 121 // This will not trigger an update through the observers. | 121 // This will not trigger an update through the observers. |
| 122 void DismissSuggestion(const std::string& suggestion_id); | 122 void DismissSuggestion(const std::string& suggestion_id); |
| 123 | 123 |
| 124 // Dismisses the given |category|, if it exists. |
| 125 // This will not trigger an update through the observers. |
| 126 void DismissCategory(Category category); |
| 127 |
| 124 // Observer accessors. | 128 // Observer accessors. |
| 125 void AddObserver(Observer* observer); | 129 void AddObserver(Observer* observer); |
| 126 void RemoveObserver(Observer* observer); | 130 void RemoveObserver(Observer* observer); |
| 127 | 131 |
| 128 // Registers a new ContentSuggestionsProvider. It must be ensured that at most | 132 // Registers a new ContentSuggestionsProvider. It must be ensured that at most |
| 129 // one provider is registered for every category and that this method is | 133 // one provider is registered for every category and that this method is |
| 130 // called only once per provider. | 134 // called only once per provider. |
| 131 void RegisterProvider(std::unique_ptr<ContentSuggestionsProvider> provider); | 135 void RegisterProvider(std::unique_ptr<ContentSuggestionsProvider> provider); |
| 132 | 136 |
| 133 // Removes history from the specified time range where the URL matches the | 137 // Removes history from the specified time range where the URL matches the |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 NTPSnippetsService* ntp_snippets_service_; | 271 NTPSnippetsService* ntp_snippets_service_; |
| 268 | 272 |
| 269 UserClassifier user_classifier_; | 273 UserClassifier user_classifier_; |
| 270 | 274 |
| 271 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); | 275 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); |
| 272 }; | 276 }; |
| 273 | 277 |
| 274 } // namespace ntp_snippets | 278 } // namespace ntp_snippets |
| 275 | 279 |
| 276 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ | 280 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ |
| OLD | NEW |