| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 protected: | 116 protected: |
| 117 ContentSuggestionsProvider(Observer* observer, | 117 ContentSuggestionsProvider(Observer* observer, |
| 118 CategoryFactory* category_factory); | 118 CategoryFactory* category_factory); |
| 119 | 119 |
| 120 // Creates a unique ID. The given |within_category_id| must be unique among | 120 // Creates a unique ID. The given |within_category_id| must be unique among |
| 121 // all suggestion IDs from this provider for the given |category|. This method | 121 // all suggestion IDs from this provider for the given |category|. This method |
| 122 // combines it with the |category| to form an ID that is unique | 122 // combines it with the |category| to form an ID that is unique |
| 123 // application-wide, because this provider is the only one that provides | 123 // application-wide, because this provider is the only one that provides |
| 124 // suggestions for that category. | 124 // suggestions for that category. |
| 125 std::string MakeUniqueID(Category category, | 125 std::string MakeUniqueID(Category category, |
| 126 const std::string& within_category_id); | 126 const std::string& within_category_id) const; |
| 127 | 127 |
| 128 // Reverse functions for MakeUniqueID() | 128 // Reverse functions for MakeUniqueID() |
| 129 Category GetCategoryFromUniqueID(const std::string& unique_id); | 129 Category GetCategoryFromUniqueID(const std::string& unique_id) const; |
| 130 std::string GetWithinCategoryIDFromUniqueID(const std::string& unique_id); | 130 std::string GetWithinCategoryIDFromUniqueID( |
| 131 const std::string& unique_id) const; |
| 131 | 132 |
| 132 Observer* observer() const { return observer_; } | 133 Observer* observer() const { return observer_; } |
| 133 CategoryFactory* category_factory() const { return category_factory_; } | 134 CategoryFactory* category_factory() const { return category_factory_; } |
| 134 | 135 |
| 135 private: | 136 private: |
| 136 Observer* observer_; | 137 Observer* observer_; |
| 137 CategoryFactory* category_factory_; | 138 CategoryFactory* category_factory_; |
| 138 }; | 139 }; |
| 139 | 140 |
| 140 } // namespace ntp_snippets | 141 } // namespace ntp_snippets |
| 141 | 142 |
| 142 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ | 143 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ |
| OLD | NEW |