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

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

Issue 2249903003: 📰 Empty state handling for the Bookmarks section (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 4 years, 4 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_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 bool has_more_button,
29 bool show_if_empty);
29 CategoryInfo(CategoryInfo&&) = default; 30 CategoryInfo(CategoryInfo&&) = default;
30 CategoryInfo& operator=(CategoryInfo&&) = default; 31 CategoryInfo& operator=(CategoryInfo&&) = default;
31 32
32 ~CategoryInfo(); 33 ~CategoryInfo();
33 34
34 // Localized title of the category. 35 // Localized title of the category.
35 const base::string16& title() const { return title_; } 36 const base::string16& title() const { return title_; }
36 37
37 // Layout of the cards to be used to display suggestions in this category. 38 // Layout of the cards to be used to display suggestions in this category.
38 ContentSuggestionsCardLayout card_layout() const { return card_layout_; } 39 ContentSuggestionsCardLayout card_layout() const { return card_layout_; }
39 40
40 // Whether the category supports a "More" button. The button either triggers 41 // 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 // 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 // action, it queries the provider for more suggestions.
43 bool has_more_button() const { return has_more_button_; } 44 bool has_more_button() const { return has_more_button_; }
44 45
46 // Whether this category should be shown if it offers no suggestions.
47 bool show_if_empty() const { return show_if_empty_; }
48
45 private: 49 private:
46 base::string16 title_; 50 base::string16 title_;
47 ContentSuggestionsCardLayout card_layout_; 51 ContentSuggestionsCardLayout card_layout_;
48 bool has_more_button_; 52 bool has_more_button_;
53 bool show_if_empty_;
49 54
50 DISALLOW_COPY_AND_ASSIGN(CategoryInfo); 55 DISALLOW_COPY_AND_ASSIGN(CategoryInfo);
51 }; 56 };
52 57
53 } // namespace ntp_snippets 58 } // namespace ntp_snippets
54 59
55 #endif // COMPONENTS_NTP_SNIPPETS_CATEGORY_INFO_H_ 60 #endif // COMPONENTS_NTP_SNIPPETS_CATEGORY_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698