| 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_INFO_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_CATEGORY_INFO_H_ |
| 6 #define COMPONENTS_NTP_SNIPPETS_CATEGORY_INFO_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_CATEGORY_INFO_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 | 10 |
| 11 namespace ntp_snippets { | 11 namespace ntp_snippets { |
| 12 | 12 |
| 13 // On Android builds, a Java counterpart will be generated for this enum. | 13 // On Android builds, a Java counterpart will be generated for this enum. |
| 14 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.ntp.snippets | 14 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.ntp.snippets |
| 15 enum class ContentSuggestionsCardLayout { | 15 enum class ContentSuggestionsCardLayout { |
| 16 // Uses all fields. | 16 // Uses all fields. |
| 17 FULL_CARD, | 17 FULL_CARD, |
| 18 | 18 |
| 19 // No snippet_text and no thumbnail image. | 19 // No snippet_text and no thumbnail image. |
| 20 MINIMAL_CARD | 20 MINIMAL_CARD |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 // Contains static meta information about a Category. | 23 // Contains static meta information about a Category. |
| 24 class CategoryInfo { | 24 class CategoryInfo { |
| 25 public: | 25 public: |
| 26 CategoryInfo(const base::string16& title, | 26 CategoryInfo(const base::string16& title, |
| 27 ContentSuggestionsCardLayout card_layout); | 27 ContentSuggestionsCardLayout card_layout, |
| 28 bool has_more_button); |
| 28 CategoryInfo(CategoryInfo&&) = default; | 29 CategoryInfo(CategoryInfo&&) = default; |
| 29 CategoryInfo& operator=(CategoryInfo&&) = default; | 30 CategoryInfo& operator=(CategoryInfo&&) = default; |
| 30 | 31 |
| 31 ~CategoryInfo(); | 32 ~CategoryInfo(); |
| 32 | 33 |
| 33 // Localized title of the category. | 34 // Localized title of the category. |
| 34 const base::string16& title() const { return title_; } | 35 const base::string16& title() const { return title_; } |
| 35 | 36 |
| 36 // Layout of the cards to be used to display suggestions in this category. | 37 // Layout of the cards to be used to display suggestions in this category. |
| 37 ContentSuggestionsCardLayout card_layout() const { return card_layout_; } | 38 ContentSuggestionsCardLayout card_layout() const { return card_layout_; } |
| 38 | 39 |
| 40 // Whether the category supports a "More" button. The button either triggers |
| 41 // a fixed action (like opening a native page) or, if there is no such fixed |
| 42 // action, it queries the provider for more suggestions. |
| 43 bool has_more_button() const { return has_more_button_; } |
| 44 |
| 39 private: | 45 private: |
| 40 base::string16 title_; | 46 base::string16 title_; |
| 41 ContentSuggestionsCardLayout card_layout_; | 47 ContentSuggestionsCardLayout card_layout_; |
| 48 bool has_more_button_; |
| 42 | 49 |
| 43 DISALLOW_COPY_AND_ASSIGN(CategoryInfo); | 50 DISALLOW_COPY_AND_ASSIGN(CategoryInfo); |
| 44 }; | 51 }; |
| 45 | 52 |
| 46 } // namespace ntp_snippets | 53 } // namespace ntp_snippets |
| 47 | 54 |
| 48 #endif // COMPONENTS_NTP_SNIPPETS_CATEGORY_INFO_H_ | 55 #endif // COMPONENTS_NTP_SNIPPETS_CATEGORY_INFO_H_ |
| OLD | NEW |