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_PROVIDER_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ |
6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 // Fetches more suggestions for the given category. The new suggestions | 98 // Fetches more suggestions for the given category. The new suggestions |
99 // will not include any suggestion of the |known_suggestion_ids| sets. | 99 // will not include any suggestion of the |known_suggestion_ids| sets. |
100 // The given |callback| is called with these suggestions, along with all | 100 // The given |callback| is called with these suggestions, along with all |
101 // existing suggestions. It has to be invoked exactly once as the front-end | 101 // existing suggestions. It has to be invoked exactly once as the front-end |
102 // might wait for its completion. | 102 // might wait for its completion. |
103 virtual void Fetch(const Category& category, | 103 virtual void Fetch(const Category& category, |
104 const std::set<std::string>& known_suggestion_ids, | 104 const std::set<std::string>& known_suggestion_ids, |
105 const FetchDoneCallback& callback) = 0; | 105 const FetchDoneCallback& callback) = 0; |
106 | 106 |
| 107 // Reloads suggestions from all categories. If the suggestions change, the |
| 108 // observer must be notified via OnNewSuggestions(); |
| 109 // TODO(jkcal): make pure virtual (involves touching all providers) or remove |
| 110 // by resolving the pull/push dichotomy. |
| 111 virtual void ReloadSuggestions() {} |
| 112 |
107 // Removes history from the specified time range where the URL matches the | 113 // Removes history from the specified time range where the URL matches the |
108 // |filter|. The data removed depends on the provider. Note that the | 114 // |filter|. The data removed depends on the provider. Note that the |
109 // data outside the time range may be deleted, for example suggestions, which | 115 // data outside the time range may be deleted, for example suggestions, which |
110 // are based on history from that time range. Providers should immediately | 116 // are based on history from that time range. Providers should immediately |
111 // clear any data related to history from the specified time range where the | 117 // clear any data related to history from the specified time range where the |
112 // URL matches the |filter|. | 118 // URL matches the |filter|. |
113 virtual void ClearHistory( | 119 virtual void ClearHistory( |
114 base::Time begin, | 120 base::Time begin, |
115 base::Time end, | 121 base::Time end, |
116 const base::Callback<bool(const GURL& url)>& filter) = 0; | 122 const base::Callback<bool(const GURL& url)>& filter) = 0; |
(...skipping 28 matching lines...) Expand all Loading... |
145 ContentSuggestionsProvider(Observer* observer); | 151 ContentSuggestionsProvider(Observer* observer); |
146 | 152 |
147 Observer* observer() const { return observer_; } | 153 Observer* observer() const { return observer_; } |
148 private: | 154 private: |
149 Observer* observer_; | 155 Observer* observer_; |
150 }; | 156 }; |
151 | 157 |
152 } // namespace ntp_snippets | 158 } // namespace ntp_snippets |
153 | 159 |
154 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ | 160 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ |
OLD | NEW |