OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 IOS_CHROME_BROWSER_UI_NTP_NOTIFICATION_PROMO_WHATS_NEW_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_NTP_NOTIFICATION_PROMO_WHATS_NEW_H_ |
6 #define IOS_CHROME_BROWSER_UI_NTP_NOTIFICATION_PROMO_WHATS_NEW_H_ | 6 #define IOS_CHROME_BROWSER_UI_NTP_NOTIFICATION_PROMO_WHATS_NEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 // Mark the promo as closed when the user dismisses it. | 36 // Mark the promo as closed when the user dismisses it. |
37 void HandleClosed(); | 37 void HandleClosed(); |
38 | 38 |
39 // Mark the promo as having been viewed. | 39 // Mark the promo as having been viewed. |
40 void HandleViewed(); | 40 void HandleViewed(); |
41 | 41 |
42 bool valid() const { return valid_; } | 42 bool valid() const { return valid_; } |
43 const std::string& promo_type() { return promo_type_; } | 43 const std::string& promo_type() { return promo_type_; } |
44 const std::string& promo_text() { return promo_text_; } | 44 const std::string& promo_text() { return promo_text_; } |
45 const std::string& promo_name() { return promo_name_; } | |
46 WhatsNewIcon icon() { return icon_; } | 45 WhatsNewIcon icon() { return icon_; } |
47 bool IsURLPromo() const; | 46 bool IsURLPromo() const; |
48 const GURL& url() { return url_; } | 47 const GURL& url() { return url_; } |
49 bool IsChromeCommand() const; | 48 bool IsChromeCommand() const; |
50 int command_id() { return command_id_; } | 49 int command_id() { return command_id_; } |
51 | 50 |
52 private: | 51 private: |
53 // Initialize the state and validity from the low-level notification_promo_. | 52 // Initialize the state and validity from the low-level notification_promo_. |
54 bool InitFromNotificationPromo(); | 53 bool InitFromNotificationPromo(); |
55 | 54 |
(...skipping 15 matching lines...) Expand all Loading... |
71 | 70 |
72 // True if InitFromPrefs/JSON was called and all mandatory fields were found. | 71 // True if InitFromPrefs/JSON was called and all mandatory fields were found. |
73 bool valid_; | 72 bool valid_; |
74 | 73 |
75 // Text of promo. | 74 // Text of promo. |
76 std::string promo_text_; | 75 std::string promo_text_; |
77 | 76 |
78 // Type of whats new promo. | 77 // Type of whats new promo. |
79 std::string promo_type_; | 78 std::string promo_type_; |
80 | 79 |
81 // Name of promo. | |
82 std::string promo_name_; | |
83 | |
84 // Icon of promo. | 80 // Icon of promo. |
85 WhatsNewIcon icon_; | 81 WhatsNewIcon icon_; |
86 | 82 |
87 // The minimum number of seconds from installation before promo can be valid. | 83 // The minimum number of seconds from installation before promo can be valid. |
88 // E.g. Don't show the promo if installation was within N days. | 84 // E.g. Don't show the promo if installation was within N days. |
89 int seconds_since_install_; | 85 int seconds_since_install_; |
90 | 86 |
91 // The duration after installation that the promo can be valid. | 87 // The duration after installation that the promo can be valid. |
92 // E.g. Don't show the promo if installation was more than N days ago. | 88 // E.g. Don't show the promo if installation was more than N days ago. |
93 int max_seconds_since_install_; | 89 int max_seconds_since_install_; |
(...skipping 10 matching lines...) Expand all Loading... |
104 // The lower-level notification promo. | 100 // The lower-level notification promo. |
105 ios::NotificationPromo notification_promo_; | 101 ios::NotificationPromo notification_promo_; |
106 | 102 |
107 // Convert an icon name string to WhatsNewIcon. | 103 // Convert an icon name string to WhatsNewIcon. |
108 WhatsNewIcon ParseIconName(const std::string& icon_name); | 104 WhatsNewIcon ParseIconName(const std::string& icon_name); |
109 | 105 |
110 DISALLOW_COPY_AND_ASSIGN(NotificationPromoWhatsNew); | 106 DISALLOW_COPY_AND_ASSIGN(NotificationPromoWhatsNew); |
111 }; | 107 }; |
112 | 108 |
113 #endif // IOS_CHROME_BROWSER_UI_NTP_NOTIFICATION_PROMO_WHATS_NEW_H_ | 109 #endif // IOS_CHROME_BROWSER_UI_NTP_NOTIFICATION_PROMO_WHATS_NEW_H_ |
OLD | NEW |