| 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 <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/optional.h" | 15 #include "base/optional.h" |
| 16 #include "base/time/time.h" |
| 16 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
| 17 #include "components/ntp_snippets/category_factory.h" | 18 #include "components/ntp_snippets/category_factory.h" |
| 18 #include "components/ntp_snippets/category_status.h" | 19 #include "components/ntp_snippets/category_status.h" |
| 19 #include "components/ntp_snippets/content_suggestions_provider.h" | 20 #include "components/ntp_snippets/content_suggestions_provider.h" |
| 20 | 21 |
| 21 namespace gfx { | 22 namespace gfx { |
| 22 class Image; | 23 class Image; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace ntp_snippets { | 26 namespace ntp_snippets { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 114 |
| 114 // Observer accessors. | 115 // Observer accessors. |
| 115 void AddObserver(Observer* observer); | 116 void AddObserver(Observer* observer); |
| 116 void RemoveObserver(Observer* observer); | 117 void RemoveObserver(Observer* observer); |
| 117 | 118 |
| 118 // Registers a new ContentSuggestionsProvider. It must be ensured that at most | 119 // Registers a new ContentSuggestionsProvider. It must be ensured that at most |
| 119 // one provider is registered for every category and that this method is | 120 // one provider is registered for every category and that this method is |
| 120 // called only once per provider. | 121 // called only once per provider. |
| 121 void RegisterProvider(std::unique_ptr<ContentSuggestionsProvider> provider); | 122 void RegisterProvider(std::unique_ptr<ContentSuggestionsProvider> provider); |
| 122 | 123 |
| 124 // Removes history from all providers from a given time range. The data |
| 125 // removed depends on a provider. Note that the data outside the time range |
| 126 // may be deleted, for example suggestions, which are based on the time range. |
| 127 // Providers should immediately clear any specified time range history-related |
| 128 // data, such as (possibly dismissed) suggestions for NTPSnippetsService or in |
| 129 // case of BookmarkSuggestionsProvider last visit dates. |
| 130 void ClearHistory(base::Time begin, base::Time end); |
| 131 |
| 123 // Removes all suggestions from all caches or internal stores in all | 132 // Removes all suggestions from all caches or internal stores in all |
| 124 // providers. See |ClearCachedSuggestions|. | 133 // providers. See |ClearCachedSuggestions|. |
| 125 void ClearAllCachedSuggestions(); | 134 void ClearAllCachedSuggestions(); |
| 126 | 135 |
| 127 // Removes all suggestions of the given |category| from all caches or internal | 136 // Removes all suggestions of the given |category| from all caches or internal |
| 128 // stores in the service and the corresponding provider. It does, however, not | 137 // stores in the service and the corresponding provider. It does, however, not |
| 129 // remove any suggestions from the provider's sources, so if its configuration | 138 // remove any suggestions from the provider's sources, so if its configuration |
| 130 // hasn't changed, it might return the same results when it fetches the next | 139 // hasn't changed, it might return the same results when it fetches the next |
| 131 // time. In particular, calling this method will not mark any suggestions as | 140 // time. In particular, calling this method will not mark any suggestions as |
| 132 // dismissed. | 141 // dismissed. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // background fetching and debugging calls to it. If the NTPSnippetsService is | 238 // background fetching and debugging calls to it. If the NTPSnippetsService is |
| 230 // loaded, it is also present in |providers_|, otherwise this is a nullptr. | 239 // loaded, it is also present in |providers_|, otherwise this is a nullptr. |
| 231 NTPSnippetsService* ntp_snippets_service_; | 240 NTPSnippetsService* ntp_snippets_service_; |
| 232 | 241 |
| 233 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); | 242 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); |
| 234 }; | 243 }; |
| 235 | 244 |
| 236 } // namespace ntp_snippets | 245 } // namespace ntp_snippets |
| 237 | 246 |
| 238 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ | 247 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ |
| OLD | NEW |