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 // Follows the last local category. |
21 LOCAL_CATEGORIES_COUNT, | 26 LOCAL_CATEGORIES_COUNT, |
22 | 27 |
23 REMOTE_CATEGORIES_OFFSET = 10000, | 28 REMOTE_CATEGORIES_OFFSET = 10000, |
24 ARTICLES = REMOTE_CATEGORIES_OFFSET + 1, | 29 |
| 30 // Articles for you. |
| 31 ARTICLES, |
25 }; | 32 }; |
26 | 33 |
27 // A category groups ContentSuggestions which belong together. Use the | 34 // A category groups ContentSuggestions which belong together. Use the |
28 // CategoryFactory to obtain instances. | 35 // CategoryFactory to obtain instances. |
29 class Category { | 36 class Category { |
30 public: | 37 public: |
31 // Returns a non-negative identifier that is unique for the category and can | 38 // Returns a non-negative identifier that is unique for the category and can |
32 // be converted back to a Category instance using | 39 // be converted back to a Category instance using |
33 // |CategoryFactory::FromIDValue(id)|. | 40 // |CategoryFactory::FromIDValue(id)|. |
34 // Note that these IDs are not necessarily stable across multiple runs of | 41 // Note that these IDs are not necessarily stable across multiple runs of |
(...skipping 14 matching lines...) Loading... |
49 | 56 |
50 bool operator==(const Category& left, const Category& right); | 57 bool operator==(const Category& left, const Category& right); |
51 | 58 |
52 bool operator!=(const Category& left, const Category& right); | 59 bool operator!=(const Category& left, const Category& right); |
53 | 60 |
54 std::ostream& operator<<(std::ostream& os, const Category& obj); | 61 std::ostream& operator<<(std::ostream& os, const Category& obj); |
55 | 62 |
56 } // namespace ntp_snippets | 63 } // namespace ntp_snippets |
57 | 64 |
58 #endif // COMPONENTS_NTP_SNIPPETS_CATEGORY_H_ | 65 #endif // COMPONENTS_NTP_SNIPPETS_CATEGORY_H_ |
OLD | NEW |