| 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_CATEGORY_RANKERS_CATEGORY_RANKER_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_CATEGORY_RANKERS_CATEGORY_RANKER_H_ |
| 6 #define COMPONENTS_NTP_SNIPPETS_CATEGORY_RANKERS_CATEGORY_RANKER_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_CATEGORY_RANKERS_CATEGORY_RANKER_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 8 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 9 #include "components/ntp_snippets/category.h" | 12 #include "components/ntp_snippets/category.h" |
| 10 | 13 |
| 11 namespace ntp_snippets { | 14 namespace ntp_snippets { |
| 12 | 15 |
| 13 // Orders categories. | 16 // Orders categories. |
| 14 // The order may be dynamic and change at any time. | 17 // The order may be dynamic and change at any time. |
| 15 class CategoryRanker { | 18 class CategoryRanker { |
| 16 public: | 19 public: |
| 17 virtual ~CategoryRanker() = default; | 20 virtual ~CategoryRanker() = default; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 32 // If |category_to_insert| has not been added previously, it is added before | 35 // If |category_to_insert| has not been added previously, it is added before |
| 33 // |anchor|, otherwise nothing is changed. | 36 // |anchor|, otherwise nothing is changed. |
| 34 virtual void InsertCategoryBeforeIfNecessary(Category category_to_insert, | 37 virtual void InsertCategoryBeforeIfNecessary(Category category_to_insert, |
| 35 Category anchor) = 0; | 38 Category anchor) = 0; |
| 36 | 39 |
| 37 // If |category_to_insert| has not been added previously, it is added after | 40 // If |category_to_insert| has not been added previously, it is added after |
| 38 // |anchor|, otherwise nothing is changed. | 41 // |anchor|, otherwise nothing is changed. |
| 39 virtual void InsertCategoryAfterIfNecessary(Category category_to_insert, | 42 virtual void InsertCategoryAfterIfNecessary(Category category_to_insert, |
| 40 Category anchor) = 0; | 43 Category anchor) = 0; |
| 41 | 44 |
| 45 struct DebugDataItem { |
| 46 std::string label; |
| 47 std::string content; |
| 48 DebugDataItem(const std::string& label, const std::string& content) |
| 49 : label(label), content(content) {} |
| 50 }; |
| 51 |
| 52 // Returns DebugData in form of pairs of strings (label; content), |
| 53 // e.g. describing internal state or parameter values. |
| 54 virtual std::vector<DebugDataItem> GetDebugData() = 0; |
| 55 |
| 42 // Feedback data from the user to update the ranking. | 56 // Feedback data from the user to update the ranking. |
| 43 | 57 |
| 44 // Called whenever a suggestion is opened by the user. | 58 // Called whenever a suggestion is opened by the user. |
| 45 virtual void OnSuggestionOpened(Category category) = 0; | 59 virtual void OnSuggestionOpened(Category category) = 0; |
| 46 | 60 |
| 47 // Called whenever a category is dismissed by the user. | 61 // Called whenever a category is dismissed by the user. |
| 48 virtual void OnCategoryDismissed(Category category) = 0; | 62 virtual void OnCategoryDismissed(Category category) = 0; |
| 49 }; | 63 }; |
| 50 | 64 |
| 51 } // namespace ntp_snippets | 65 } // namespace ntp_snippets |
| 52 | 66 |
| 53 #endif // COMPONENTS_NTP_SNIPPETS_CATEGORY_RANKERS_CATEGORY_RANKER_H_ | 67 #endif // COMPONENTS_NTP_SNIPPETS_CATEGORY_RANKERS_CATEGORY_RANKER_H_ |
| OLD | NEW |