Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_NTP_SNIPPETS_SECTION_RANKERS_SECTION_RANKER_H_ | |
| 6 #define COMPONENTS_NTP_SNIPPETS_SECTION_RANKERS_SECTION_RANKER_H_ | |
| 7 | |
| 8 #include "base/time/time.h" | |
| 9 #include "components/ntp_snippets/category.h" | |
| 10 | |
| 11 namespace ntp_snippets { | |
| 12 | |
| 13 // TODO(vitaliii): Ensure that changes in the order are propagated to the UI. | |
|
Marc Treib
2016/12/13 12:22:42
This should have a bug assigned.
vitaliii
2016/12/14 08:59:38
Done.
| |
| 14 | |
| 15 // Orders sections (represented as categories). | |
| 16 // The order can be changed. | |
|
Marc Treib
2016/12/13 12:22:42
What does this mean?
vitaliii
2016/12/14 08:59:38
Done.
| |
| 17 class SectionRanker { | |
|
Marc Treib
2016/12/13 12:22:42
CategoryRanker.
"Section" is the UI term, which we
vitaliii
2016/12/14 08:59:38
Done.
| |
| 18 public: | |
| 19 // Compare two categories. True means that |left| precedes |right|, i.e. it | |
|
Marc Treib
2016/12/13 12:22:42
"Compares two categories", similar below. The styl
vitaliii
2016/12/14 08:59:38
Done.
| |
| 20 // must be located earlier (above) on the NTP. This method must satisfy | |
| 21 // "Compare" contract required by sort algorithms. | |
| 22 virtual bool Compare(Category left, Category right) const = 0; | |
| 23 | |
| 24 // Delete all history related data between |begin| and |end|. The order | |
| 25 // after this call should not reflect the history in any way. | |
|
Marc Treib
2016/12/13 12:22:42
After this call, the category order may not depend
vitaliii
2016/12/14 08:59:38
Done.
| |
| 26 virtual void ClearHistory(base::Time begin, base::Time end) = 0; | |
| 27 | |
| 28 // If there is no previous data for |category|, it is added to the end with | |
| 29 // the score 0, otherwise does nothing. Before the data for new categories | |
|
Marc Treib
2016/12/13 12:22:42
"score 0" is an implementation detail of some poss
vitaliii
2016/12/14 08:59:38
Done.
| |
| 30 // is obtained, the order of the categories must be the same as the order | |
| 31 // they have been added in. | |
| 32 virtual void AppendCategoryIfNecessary(Category category) = 0; | |
| 33 | |
| 34 // Feedback data from the user to update the ranking. | |
| 35 | |
| 36 // Suggestion click data. | |
|
Marc Treib
2016/12/13 12:22:42
This comment isn't useful.
"Called whenever a sugg
vitaliii
2016/12/14 08:59:38
Done.
| |
| 37 virtual void OnSuggestionOpened(Category category) = 0; | |
| 38 }; | |
| 39 | |
| 40 } // namespace ntp_snippets | |
| 41 | |
| 42 #endif // COMPONENTS_NTP_SNIPPETS_SECTION_RANKERS_SECTION_RANKER_H_ | |
| OLD | NEW |