fake_category_ranker.cc 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #include "components/ntp_snippets/category_rankers/fake_category_ranker.h"
  5. #include <algorithm>
  6. #include "base/containers/contains.h"
  7. namespace ntp_snippets {
  8. FakeCategoryRanker::FakeCategoryRanker() = default;
  9. FakeCategoryRanker::~FakeCategoryRanker() = default;
  10. bool FakeCategoryRanker::Compare(Category left, Category right) const {
  11. DCHECK(base::Contains(categories_, left));
  12. DCHECK(base::Contains(categories_, right));
  13. return std::find(categories_.begin(), categories_.end(), left) <
  14. std::find(categories_.begin(), categories_.end(), right);
  15. }
  16. void FakeCategoryRanker::ClearHistory(base::Time begin, base::Time end) {
  17. // Ignored.
  18. }
  19. void FakeCategoryRanker::AppendCategoryIfNecessary(Category category) {
  20. // Ignored.
  21. }
  22. void FakeCategoryRanker::InsertCategoryBeforeIfNecessary(
  23. Category category_to_insert,
  24. Category anchor) {
  25. // Ignored.
  26. }
  27. void FakeCategoryRanker::InsertCategoryAfterIfNecessary(
  28. Category category_to_insert,
  29. Category anchor) {
  30. // Ignored.
  31. }
  32. std::vector<CategoryRanker::DebugDataItem> FakeCategoryRanker::GetDebugData() {
  33. // Ignored.
  34. return std::vector<CategoryRanker::DebugDataItem>();
  35. }
  36. void FakeCategoryRanker::OnSuggestionOpened(Category category) {
  37. // Ignored.
  38. }
  39. void FakeCategoryRanker::OnCategoryDismissed(Category category) {
  40. // Ignored.
  41. }
  42. } // namespace ntp_snippets