OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/ntp_snippets/content_suggestion.h" | 5 #include "components/ntp_snippets/content_suggestion.h" |
6 | 6 |
7 namespace ntp_snippets { | 7 namespace ntp_snippets { |
8 | 8 |
9 bool ContentSuggestion::ID::operator==(const ID& rhs) const { | 9 bool ContentSuggestion::ID::operator==(const ID& rhs) const { |
10 return category_ == rhs.category_ && | 10 return category_ == rhs.category_ && |
11 id_within_category_ == rhs.id_within_category_; | 11 id_within_category_ == rhs.id_within_category_; |
12 } | 12 } |
13 | 13 |
14 bool ContentSuggestion::ID::operator!=(const ID& rhs) const { | 14 bool ContentSuggestion::ID::operator!=(const ID& rhs) const { |
15 return !(*this == rhs); | 15 return !(*this == rhs); |
16 } | 16 } |
17 | 17 |
18 ContentSuggestion::ContentSuggestion(ID id, const GURL& url) | 18 ContentSuggestion::ContentSuggestion(const ID& id, const GURL& url) |
19 : id_(id), url_(url), score_(0) {} | 19 : id_(id), url_(url), score_(0) {} |
20 | 20 |
21 ContentSuggestion::ContentSuggestion(Category category, | 21 ContentSuggestion::ContentSuggestion(Category category, |
22 const std::string& id_within_category, | 22 const std::string& id_within_category, |
23 const GURL& url) | 23 const GURL& url) |
24 : id_(category, id_within_category), url_(url), score_(0) {} | 24 : id_(category, id_within_category), url_(url), score_(0) {} |
25 | 25 |
26 ContentSuggestion::ContentSuggestion(ContentSuggestion&&) = default; | 26 ContentSuggestion::ContentSuggestion(ContentSuggestion&&) = default; |
27 | 27 |
28 ContentSuggestion& ContentSuggestion::operator=(ContentSuggestion&&) = default; | 28 ContentSuggestion& ContentSuggestion::operator=(ContentSuggestion&&) = default; |
29 | 29 |
30 ContentSuggestion::~ContentSuggestion() = default; | 30 ContentSuggestion::~ContentSuggestion() = default; |
31 | 31 |
32 std::ostream& operator<<(std::ostream& os, ContentSuggestion::ID id) { | 32 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id) { |
33 os << id.category() << "|" << id.id_within_category(); | 33 os << id.category() << "|" << id.id_within_category(); |
34 return os; | 34 return os; |
35 } | 35 } |
36 | 36 |
37 } // namespace ntp_snippets | 37 } // namespace ntp_snippets |
OLD | NEW |