OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ | 5 #ifndef CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ |
6 #define CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ | 6 #define CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 void WritePrefs(); | 89 void WritePrefs(); |
90 | 90 |
91 // Tests group_ against max_group_. | 91 // Tests group_ against max_group_. |
92 // When max_group_ is 0, all groups pass. | 92 // When max_group_ is 0, all groups pass. |
93 bool ExceedsMaxGroup() const; | 93 bool ExceedsMaxGroup() const; |
94 | 94 |
95 // Tests views_ against max_views_. | 95 // Tests views_ against max_views_. |
96 // When max_views_ is 0, we don't cap the number of views. | 96 // When max_views_ is 0, we don't cap the number of views. |
97 bool ExceedsMaxViews() const; | 97 bool ExceedsMaxViews() const; |
98 | 98 |
| 99 // Tests |first_view_time_| + |max_seconds_| and -now(). |
| 100 // When either is 0, we don't cap the number of seconds. |
| 101 bool ExceedsMaxSeconds() const; |
| 102 |
99 // Returns false if this promo should not be displayed because it is a promo | 103 // Returns false if this promo should not be displayed because it is a promo |
100 // for the app launcher, and the user has already enabled the app launcher. | 104 // for the app launcher, and the user has already enabled the app launcher. |
101 bool CheckAppLauncher() const; | 105 bool CheckAppLauncher() const; |
102 | 106 |
103 PrefService* prefs_; | 107 PrefService* prefs_; |
104 | 108 |
105 PromoType promo_type_; | 109 PromoType promo_type_; |
106 std::string promo_text_; | 110 std::string promo_text_; |
107 | 111 |
108 scoped_ptr<const base::DictionaryValue> promo_payload_; | 112 scoped_ptr<const base::DictionaryValue> promo_payload_; |
109 | 113 |
110 double start_; | 114 double start_; |
111 double end_; | 115 double end_; |
112 | 116 |
113 int num_groups_; | 117 int num_groups_; |
114 int initial_segment_; | 118 int initial_segment_; |
115 int increment_; | 119 int increment_; |
116 int time_slice_; | 120 int time_slice_; |
117 int max_group_; | 121 int max_group_; |
118 | 122 |
119 // When max_views_ is 0, we don't cap the number of views. | 123 // When max_views_ is 0, we don't cap the number of views. |
120 int max_views_; | 124 int max_views_; |
121 | 125 |
| 126 // When max_seconds_ is 0 or not set, we don't cap the number of seconds a |
| 127 // promo can be visible. |
| 128 int max_seconds_; |
| 129 |
| 130 // Set when the promo is viewed for the first time. |
| 131 double first_view_time_; |
| 132 |
122 int group_; | 133 int group_; |
123 int views_; | 134 int views_; |
124 bool closed_; | 135 bool closed_; |
125 | 136 |
126 bool new_notification_; | 137 bool new_notification_; |
127 | 138 |
128 DISALLOW_COPY_AND_ASSIGN(NotificationPromo); | 139 DISALLOW_COPY_AND_ASSIGN(NotificationPromo); |
129 }; | 140 }; |
130 | 141 |
131 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ | 142 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ |
OLD | NEW |