Chromium Code Reviews| Index: components/ntp_snippets/category_rankers/constant_category_ranker.h |
| diff --git a/components/ntp_snippets/category_rankers/constant_category_ranker.h b/components/ntp_snippets/category_rankers/constant_category_ranker.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bf940e6fac8c68d979e6ff93d9ee006c68ef8e29 |
| --- /dev/null |
| +++ b/components/ntp_snippets/category_rankers/constant_category_ranker.h |
| @@ -0,0 +1,38 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_NTP_SNIPPETS_SECTION_RANKERS_CONSTANT_SECTION_RANKER_H_ |
| +#define COMPONENTS_NTP_SNIPPETS_SECTION_RANKERS_CONSTANT_SECTION_RANKER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/time/time.h" |
| +#include "components/ntp_snippets/category.h" |
| +#include "components/ntp_snippets/category_rankers/category_ranker.h" |
| + |
| +namespace ntp_snippets { |
| + |
| +// TODO(vitaliii): Add unit tests. |
|
tschumann
2016/12/15 11:50:26
i treat this as a DO_NOT_SUBMIT ;-) Not sure if th
vitaliii
2016/12/15 15:30:13
The idea was to submit this large CL and then imme
tschumann
2016/12/15 18:23:13
:-) I totally got that idea and disagreed ;-). If
vitaliii
2016/12/16 08:15:43
Ack.
Now I see, fair enough.
|
| +class ConstantCategoryRanker : public CategoryRanker { |
| + public: |
| + ConstantCategoryRanker(); |
| + virtual ~ConstantCategoryRanker(); |
| + |
| + // CategoryRanker implementation. |
| + bool Compare(Category left, Category right) const override; |
| + void ClearHistory(base::Time begin, base::Time end) override; |
| + void AppendCategoryIfNecessary(Category category) override; |
| + void OnSuggestionOpened(Category category) override; |
| + |
| + private: |
| + void AppendKnownCategory(KnownCategories known_category); |
| + |
| + std::vector<Category> ordered_categories_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ConstantCategoryRanker); |
| +}; |
| + |
| +} // namespace ntp_snippets |
| + |
| +#endif // COMPONENTS_NTP_SNIPPETS_SECTION_RANKERS_CONSTANT_SECTION_RANKER_H_ |