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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 // offset. | 44 // offset. |
45 double StartTimeForGroup() const; | 45 double StartTimeForGroup() const; |
46 double EndTime() const; | 46 double EndTime() const; |
47 | 47 |
48 // Helpers for NewTabPageHandler. | 48 // Helpers for NewTabPageHandler. |
49 void HandleClosed(); | 49 void HandleClosed(); |
50 bool HandleViewed(); // returns true if views exceeds maximum allowed. | 50 bool HandleViewed(); // returns true if views exceeds maximum allowed. |
51 | 51 |
52 bool new_notification() const { return new_notification_; } | 52 bool new_notification() const { return new_notification_; } |
53 | 53 |
54 std::string promo_text() const { return promo_text_; } | |
55 #if defined(OS_ANDROID) || defined(OS_IOS) | |
56 std::string promo_text_long() const { return promo_text_long_; } | |
57 std::string promo_action_type() const { return promo_action_type_; } | |
58 base::ListValue* promo_action_args() const { | |
aruslan
2012/07/27 18:18:15
could it be a const base::ListValue* (I guess cons
msarda
2012/07/30 08:41:51
Done (I think that the static_cast is not needed -
| |
59 return promo_action_args_.get(); | |
60 } | |
61 #endif // defined(OS_ANDROID) || defined(OS_IOS) | |
aruslan
2012/07/27 18:23:35
nit: extra space before defined(OS_IOS)
msarda
2012/07/30 08:41:51
Done.
| |
62 | |
54 // Register preferences. | 63 // Register preferences. |
55 static void RegisterUserPrefs(PrefService* prefs); | 64 static void RegisterUserPrefs(PrefService* prefs); |
56 | 65 |
57 private: | 66 private: |
58 // For testing. | 67 // For testing. |
59 friend class NotificationPromoTest; | 68 friend class NotificationPromoTest; |
60 | 69 |
61 // Check if this promo notification is new based on start/end times, | 70 // Check if this promo notification is new based on start/end times, |
62 // and trigger events accordingly. | 71 // and trigger events accordingly. |
63 void CheckForNewNotification(); | 72 void CheckForNewNotification(); |
(...skipping 13 matching lines...) Expand all Loading... | |
77 bool ExceedsMaxViews() const; | 86 bool ExceedsMaxViews() const; |
78 | 87 |
79 // True if this promo is not targeted to G+ users, or if this is a G+ user. | 88 // True if this promo is not targeted to G+ users, or if this is a G+ user. |
80 bool IsGPlusRequired() const; | 89 bool IsGPlusRequired() const; |
81 | 90 |
82 Profile* profile_; | 91 Profile* profile_; |
83 PrefService* prefs_; | 92 PrefService* prefs_; |
84 | 93 |
85 std::string promo_type_; | 94 std::string promo_type_; |
86 std::string promo_text_; | 95 std::string promo_text_; |
87 #if defined(OS_ANDROID) | 96 #if defined(OS_ANDROID) || defined(OS_IOS) |
88 std::string promo_text_long_; | 97 std::string promo_text_long_; |
89 std::string promo_action_type_; | 98 std::string promo_action_type_; |
90 scoped_ptr<base::ListValue> promo_action_args_; | 99 scoped_ptr<base::ListValue> promo_action_args_; |
91 #endif | 100 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
92 | 101 |
93 double start_; | 102 double start_; |
94 double end_; | 103 double end_; |
95 | 104 |
96 int num_groups_; | 105 int num_groups_; |
97 int initial_segment_; | 106 int initial_segment_; |
98 int increment_; | 107 int increment_; |
99 int time_slice_; | 108 int time_slice_; |
100 int max_group_; | 109 int max_group_; |
101 | 110 |
102 // When max_views_ is 0, we don't cap the number of views. | 111 // When max_views_ is 0, we don't cap the number of views. |
103 int max_views_; | 112 int max_views_; |
104 | 113 |
105 int group_; | 114 int group_; |
106 int views_; | 115 int views_; |
107 bool closed_; | 116 bool closed_; |
108 | 117 |
109 bool gplus_required_; | 118 bool gplus_required_; |
110 | 119 |
111 bool new_notification_; | 120 bool new_notification_; |
112 | 121 |
113 DISALLOW_COPY_AND_ASSIGN(NotificationPromo); | 122 DISALLOW_COPY_AND_ASSIGN(NotificationPromo); |
114 }; | 123 }; |
115 | 124 |
116 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ | 125 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ |
OLD | NEW |