Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: components/ntp_snippets/section_rankers/default_constant_section_ranker.h

Issue 2568033005: [NTP::SectionOrder] Replace CategoryFactory with a category ranker. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_DEFAULT_CONSTANT_SECTION_RANKER_ H_
6 #define COMPONENTS_NTP_SNIPPETS_SECTION_RANKERS_DEFAULT_CONSTANT_SECTION_RANKER_ H_
7
8 #include <vector>
9
10 #include "base/time/time.h"
11 #include "components/ntp_snippets/category.h"
12 #include "components/ntp_snippets/section_rankers/section_ranker.h"
13
14 namespace ntp_snippets {
15
16 // TODO(vitaliii): Add unit tests.
Marc Treib 2016/12/13 12:22:42 Yes please. At the very least, port the CategoryFa
vitaliii 2016/12/14 08:59:38 But not in this CL.
Marc Treib 2016/12/14 10:24:31 No need to write additional tests in this CL, but
vitaliii 2016/12/15 15:30:12 Done.
17 class DefaultConstantSectionRanker : public SectionRanker {
Marc Treib 2016/12/13 12:22:42 Remove the "Default" - that's not part of the clas
vitaliii 2016/12/14 08:59:38 Done.
18 public:
19 DefaultConstantSectionRanker();
20 virtual ~DefaultConstantSectionRanker();
21
22 bool Compare(Category left, Category right) const override;
Marc Treib 2016/12/13 12:22:42 nitty nit: Add a "CategoryRanker implementation."
vitaliii 2016/12/14 08:59:38 Done.
23
24 void ClearHistory(base::Time begin, base::Time end) override;
25
26 void AppendCategoryIfNecessary(Category category) override;
27
28 void OnSuggestionOpened(Category category) override;
29
30 private:
31 void AppendKnownCategory(KnownCategories known_category);
32
33 std::vector<Category> ordered_categories_;
34
35 DISALLOW_COPY_AND_ASSIGN(DefaultConstantSectionRanker);
36 };
37
38 } // namespace ntp_snippets
39
40 #endif // COMPONENTS_NTP_SNIPPETS_SECTION_RANKERS_DEFAULT_CONSTANT_SECTION_RANK ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698