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

Unified Diff: components/ntp_snippets/category_rankers/fake_category_ranker.cc

Issue 2581163004: [NTP::SectionOrder] Propagate new order through ContentSuggestionsService. (Closed)
Patch Set: treib@ nits. 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 side-by-side diff with in-line comments
Download patch
Index: components/ntp_snippets/category_rankers/fake_category_ranker.cc
diff --git a/components/ntp_snippets/category_rankers/fake_category_ranker.cc b/components/ntp_snippets/category_rankers/fake_category_ranker.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c43610935a79b3b626cd9ebfcaee31f1327b1a66
--- /dev/null
+++ b/components/ntp_snippets/category_rankers/fake_category_ranker.cc
@@ -0,0 +1,37 @@
+// 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.
+
+#include "components/ntp_snippets/category_rankers/fake_category_ranker.h"
+
+#include <algorithm>
+
+#include "base/stl_util.h"
+
+namespace ntp_snippets {
+
+FakeCategoryRanker::FakeCategoryRanker() = default;
+
+FakeCategoryRanker::~FakeCategoryRanker() = default;
+
+bool FakeCategoryRanker::Compare(Category left, Category right) const {
+ DCHECK(base::ContainsValue(categories_, left));
+ DCHECK(base::ContainsValue(categories_, right));
+
+ return std::find(categories_.begin(), categories_.end(), left) <
+ std::find(categories_.begin(), categories_.end(), right);
+}
+
+void FakeCategoryRanker::ClearHistory(base::Time begin, base::Time end) {
+ // Ignored.
+}
+
+void FakeCategoryRanker::AppendCategoryIfNecessary(Category category) {
+ // Ignored.
+}
+
+void FakeCategoryRanker::OnSuggestionOpened(Category category) {
+ // Ignored.
+}
+
+} // namespace ntp_snippets
« no previous file with comments | « components/ntp_snippets/category_rankers/fake_category_ranker.h ('k') | components/ntp_snippets/content_suggestions_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698