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 #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 { |
11 | 11 |
12 class CategoryFactory; | 12 class CategoryFactory; |
13 | 13 |
14 // These are the categories that the client knows about. | 14 // These are the categories that the client knows about. |
15 // The values before LOCAL_CATEGORIES_COUNT are the categories that are provided | 15 // The values before LOCAL_CATEGORIES_COUNT are the categories that are provided |
16 // locally on the device. Categories provided by the server (IDs strictly larger | 16 // locally on the device. Categories provided by the server (IDs strictly larger |
17 // than REMOTE_CATEGORIES_OFFSET) only need to be hard-coded here if they need | 17 // than REMOTE_CATEGORIES_OFFSET) only need to be hard-coded here if they need |
18 // to be recognized by the client implementation. | 18 // to be recognized by the client implementation. |
| 19 // On Android builds, a Java counterpart will be generated for this enum. |
| 20 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.ntp.snippets |
19 enum class KnownCategories { | 21 enum class KnownCategories { |
| 22 // Pages downloaded for offline consumption. |
20 OFFLINE_PAGES, | 23 OFFLINE_PAGES, |
| 24 |
| 25 // Recently used bookmarks. |
21 BOOKMARKS, | 26 BOOKMARKS, |
| 27 |
| 28 // Follows the last local category. |
22 LOCAL_CATEGORIES_COUNT, | 29 LOCAL_CATEGORIES_COUNT, |
23 | 30 |
24 REMOTE_CATEGORIES_OFFSET = 10000, | 31 REMOTE_CATEGORIES_OFFSET = 10000, |
25 ARTICLES = REMOTE_CATEGORIES_OFFSET + 1, | 32 |
| 33 // Articles for you. |
| 34 ARTICLES, |
26 }; | 35 }; |
27 | 36 |
28 // A category groups ContentSuggestions which belong together. Use the | 37 // A category groups ContentSuggestions which belong together. Use the |
29 // CategoryFactory to obtain instances. | 38 // CategoryFactory to obtain instances. |
30 class Category { | 39 class Category { |
31 public: | 40 public: |
32 // Returns a non-negative identifier that is unique for the category and can | 41 // Returns a non-negative identifier that is unique for the category and can |
33 // be converted back to a Category instance using | 42 // be converted back to a Category instance using |
34 // |CategoryFactory::FromIDValue(id)|. | 43 // |CategoryFactory::FromIDValue(id)|. |
35 // Note that these IDs are not necessarily stable across multiple runs of | 44 // Note that these IDs are not necessarily stable across multiple runs of |
(...skipping 14 matching lines...) Expand all Loading... |
50 | 59 |
51 bool operator==(const Category& left, const Category& right); | 60 bool operator==(const Category& left, const Category& right); |
52 | 61 |
53 bool operator!=(const Category& left, const Category& right); | 62 bool operator!=(const Category& left, const Category& right); |
54 | 63 |
55 std::ostream& operator<<(std::ostream& os, const Category& obj); | 64 std::ostream& operator<<(std::ostream& os, const Category& obj); |
56 | 65 |
57 } // namespace ntp_snippets | 66 } // namespace ntp_snippets |
58 | 67 |
59 #endif // COMPONENTS_NTP_SNIPPETS_CATEGORY_H_ | 68 #endif // COMPONENTS_NTP_SNIPPETS_CATEGORY_H_ |
OLD | NEW |