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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 const DismissedSuggestionsCallback& callback) = 0; | 126 const DismissedSuggestionsCallback& callback) = 0; |
127 | 127 |
128 // Used only for debugging purposes. Clears the cache of dismissed | 128 // Used only for debugging purposes. Clears the cache of dismissed |
129 // suggestions for the given |category|, if present, so that no suggestions | 129 // suggestions for the given |category|, if present, so that no suggestions |
130 // are suppressed. This does not necessarily make previously dismissed | 130 // are suppressed. This does not necessarily make previously dismissed |
131 // suggestions reappear, as they may have been permanently deleted, depending | 131 // suggestions reappear, as they may have been permanently deleted, depending |
132 // on the provider implementation. | 132 // on the provider implementation. |
133 virtual void ClearDismissedSuggestionsForDebugging(Category category) = 0; | 133 virtual void ClearDismissedSuggestionsForDebugging(Category category) = 0; |
134 | 134 |
135 protected: | 135 protected: |
| 136 friend class ContentSuggestionsProviderTest; |
| 137 |
136 ContentSuggestionsProvider(Observer* observer, | 138 ContentSuggestionsProvider(Observer* observer, |
137 CategoryFactory* category_factory); | 139 CategoryFactory* category_factory); |
138 | 140 |
139 // Creates a unique ID. The given |within_category_id| must be unique among | 141 // Creates a unique ID. The given |within_category_id| must be unique among |
140 // all suggestion IDs from this provider for the given |category|. This method | 142 // all suggestion IDs from this provider for the given |category|. This method |
141 // combines it with the |category| to form an ID that is unique | 143 // combines it with the |category| to form an ID that is unique |
142 // application-wide, because this provider is the only one that provides | 144 // application-wide, because this provider is the only one that provides |
143 // suggestions for that category. | 145 // suggestions for that category. |
144 std::string MakeUniqueID(Category category, | 146 std::string MakeUniqueID(Category category, |
145 const std::string& within_category_id) const; | 147 const std::string& within_category_id) const; |
146 | 148 |
147 // Reverse functions for MakeUniqueID() | 149 // Reverse functions for MakeUniqueID() |
148 Category GetCategoryFromUniqueID(const std::string& unique_id) const; | 150 Category GetCategoryFromUniqueID(const std::string& unique_id) const; |
149 std::string GetWithinCategoryIDFromUniqueID( | 151 std::string GetWithinCategoryIDFromUniqueID( |
150 const std::string& unique_id) const; | 152 const std::string& unique_id) const; |
151 | 153 |
152 Observer* observer() const { return observer_; } | 154 Observer* observer() const { return observer_; } |
153 CategoryFactory* category_factory() const { return category_factory_; } | 155 CategoryFactory* category_factory() const { return category_factory_; } |
154 | 156 |
155 private: | 157 private: |
156 Observer* observer_; | 158 Observer* observer_; |
157 CategoryFactory* category_factory_; | 159 CategoryFactory* category_factory_; |
158 }; | 160 }; |
159 | 161 |
160 } // namespace ntp_snippets | 162 } // namespace ntp_snippets |
161 | 163 |
162 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ | 164 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ |
OLD | NEW |