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

Side by Side Diff: components/ntp_snippets/category.h

Issue 2406573002: 📰 Persist category dismissals (Closed)
Patch Set: fix test Created 4 years, 2 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
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 #ifndef COMPONENTS_NTP_SNIPPETS_CATEGORY_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_CATEGORY_H_
6 #define COMPONENTS_NTP_SNIPPETS_CATEGORY_H_ 6 #define COMPONENTS_NTP_SNIPPETS_CATEGORY_H_
7 7
8 #include <ostream> 8 #include <ostream>
9 9
10 namespace ntp_snippets { 10 namespace ntp_snippets {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 struct CompareByID; 57 struct CompareByID;
58 58
59 // Returns a non-negative identifier that is unique for the category and can 59 // Returns a non-negative identifier that is unique for the category and can
60 // be converted back to a Category instance using 60 // be converted back to a Category instance using
61 // |CategoryFactory::FromIDValue(id)|. 61 // |CategoryFactory::FromIDValue(id)|.
62 int id() const { return id_; } 62 int id() const { return id_; }
63 63
64 // Returns whether this category matches the given |known_category|. 64 // Returns whether this category matches the given |known_category|.
65 bool IsKnownCategory(KnownCategories known_category) const; 65 bool IsKnownCategory(KnownCategories known_category) const;
66 66
67 // Returns whether this category is a remote category. Note: this looks at
68 // the |id_| to determine this and requires remote categories to respect the
69 // restriction on remote ids expressed in |KnownCategories|.
70 bool IsRemote() const;
71
67 private: 72 private:
68 friend class CategoryFactory; 73 friend class CategoryFactory;
69 74
70 explicit Category(int id); 75 explicit Category(int id);
71 76
72 int id_; 77 int id_;
73 78
74 // Allow copy and assignment. 79 // Allow copy and assignment.
75 }; 80 };
76 81
77 bool operator==(const Category& left, const Category& right); 82 bool operator==(const Category& left, const Category& right);
78 83
79 bool operator!=(const Category& left, const Category& right); 84 bool operator!=(const Category& left, const Category& right);
80 85
81 struct Category::CompareByID { 86 struct Category::CompareByID {
82 bool operator()(const Category& left, const Category& right) const; 87 bool operator()(const Category& left, const Category& right) const;
83 }; 88 };
84 89
85 std::ostream& operator<<(std::ostream& os, const Category& obj); 90 std::ostream& operator<<(std::ostream& os, const Category& obj);
86 91
87 } // namespace ntp_snippets 92 } // namespace ntp_snippets
88 93
89 #endif // COMPONENTS_NTP_SNIPPETS_CATEGORY_H_ 94 #endif // COMPONENTS_NTP_SNIPPETS_CATEGORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698