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

Side by Side Diff: components/ntp_snippets/content_suggestions_category.cc

Issue 2187233002: Add ContentSuggestionsCategoryFactory; Store categories as ints (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 months 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 #include "components/ntp_snippets/content_suggestions_category.h"
6
7 #include "base/logging.h"
8
9 namespace ntp_snippets {
10
11 ContentSuggestionsCategory::ContentSuggestionsCategory(int id) : id_(id) {}
12
13 bool ContentSuggestionsCategory::IsKnownCategory(
14 KnownSuggestionsCategories known_category) const {
15 return id_ == static_cast<int>(known_category);
16 }
17
18 bool operator==(const ContentSuggestionsCategory& left,
19 const ContentSuggestionsCategory& right) {
20 return left.id() == right.id();
21 }
22
23 bool operator!=(const ContentSuggestionsCategory& left,
24 const ContentSuggestionsCategory& right) {
25 return !(left == right);
26 }
27
28 std::ostream& operator<<(std::ostream& os,
29 const ContentSuggestionsCategory& obj) {
30 os << obj.id();
31 return os;
32 }
33
34 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/content_suggestions_category.h ('k') | components/ntp_snippets/content_suggestions_category_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698