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 | |
138 ContentSuggestionsProvider(Observer* observer, | 136 ContentSuggestionsProvider(Observer* observer, |
139 CategoryFactory* category_factory); | 137 CategoryFactory* category_factory); |
140 | 138 |
141 // Creates a unique ID. The given |within_category_id| must be unique among | 139 // Creates a unique ID. The given |within_category_id| must be unique among |
142 // all suggestion IDs from this provider for the given |category|. This method | 140 // all suggestion IDs from this provider for the given |category|. This method |
143 // combines it with the |category| to form an ID that is unique | 141 // combines it with the |category| to form an ID that is unique |
144 // application-wide, because this provider is the only one that provides | 142 // application-wide, because this provider is the only one that provides |
145 // suggestions for that category. | 143 // suggestions for that category. |
146 std::string MakeUniqueID(Category category, | 144 std::string MakeUniqueID(Category category, |
147 const std::string& within_category_id) const; | 145 const std::string& within_category_id) const; |
148 | 146 |
149 // Reverse functions for MakeUniqueID() | 147 // Reverse functions for MakeUniqueID() |
150 Category GetCategoryFromUniqueID(const std::string& unique_id) const; | 148 Category GetCategoryFromUniqueID(const std::string& unique_id) const; |
151 std::string GetWithinCategoryIDFromUniqueID( | 149 std::string GetWithinCategoryIDFromUniqueID( |
152 const std::string& unique_id) const; | 150 const std::string& unique_id) const; |
153 | 151 |
154 Observer* observer() const { return observer_; } | 152 Observer* observer() const { return observer_; } |
155 CategoryFactory* category_factory() const { return category_factory_; } | 153 CategoryFactory* category_factory() const { return category_factory_; } |
156 | 154 |
157 private: | 155 private: |
158 Observer* observer_; | 156 Observer* observer_; |
159 CategoryFactory* category_factory_; | 157 CategoryFactory* category_factory_; |
160 }; | 158 }; |
161 | 159 |
162 } // namespace ntp_snippets | 160 } // namespace ntp_snippets |
163 | 161 |
164 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ | 162 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ |
OLD | NEW |