| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // Helpers for NewTabPageHandler. | 52 // Helpers for NewTabPageHandler. |
| 53 // Mark the promo as closed when the user dismisses it. | 53 // Mark the promo as closed when the user dismisses it. |
| 54 static void HandleClosed(Profile* profile, PromoType promo_type); | 54 static void HandleClosed(Profile* profile, PromoType promo_type); |
| 55 // Mark the promo has having been viewed. This returns true if views | 55 // Mark the promo has having been viewed. This returns true if views |
| 56 // exceeds the maximum allowed. | 56 // exceeds the maximum allowed. |
| 57 static bool HandleViewed(Profile* profile, PromoType promo_type); | 57 static bool HandleViewed(Profile* profile, PromoType promo_type); |
| 58 | 58 |
| 59 bool new_notification() const { return new_notification_; } | 59 bool new_notification() const { return new_notification_; } |
| 60 | 60 |
| 61 const std::string& promo_text() const { return promo_text_; } | 61 const std::string& promo_text() const { return promo_text_; } |
| 62 #if defined(OS_ANDROID) || defined(OS_IOS) | 62 PromoType promo_type() const { return promo_type_; } |
| 63 const std::string& promo_text_long() const { return promo_text_long_; } | 63 const base::DictionaryValue* promo_payload() const { |
| 64 const std::string& promo_action_type() const { return promo_action_type_; } | 64 return promo_payload_.get(); |
| 65 const base::ListValue* promo_action_args() const { | |
| 66 return promo_action_args_.get(); | |
| 67 } | 65 } |
| 68 #endif // defined(OS_ANDROID) || defined(OS_IOS) | |
| 69 | 66 |
| 70 // Register preferences. | 67 // Register preferences. |
| 71 static void RegisterUserPrefs(PrefService* prefs); | 68 static void RegisterUserPrefs(PrefService* prefs); |
| 72 | 69 |
| 73 private: | 70 private: |
| 74 // For testing. | 71 // For testing. |
| 75 friend class NotificationPromoTest; | 72 friend class NotificationPromoTest; |
| 76 | 73 |
| 77 // Check if this promo notification is new based on start/end times, | 74 // Check if this promo notification is new based on start/end times, |
| 78 // and trigger events accordingly. | 75 // and trigger events accordingly. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 93 bool ExceedsMaxViews() const; | 90 bool ExceedsMaxViews() const; |
| 94 | 91 |
| 95 // True if this promo is not targeted to G+ users, or if this is a G+ user. | 92 // True if this promo is not targeted to G+ users, or if this is a G+ user. |
| 96 bool IsGPlusRequired() const; | 93 bool IsGPlusRequired() const; |
| 97 | 94 |
| 98 Profile* profile_; | 95 Profile* profile_; |
| 99 PrefService* prefs_; | 96 PrefService* prefs_; |
| 100 | 97 |
| 101 PromoType promo_type_; | 98 PromoType promo_type_; |
| 102 std::string promo_text_; | 99 std::string promo_text_; |
| 103 #if defined(OS_ANDROID) || defined(OS_IOS) | 100 |
| 104 std::string promo_text_long_; | 101 // Note that promo_payload_ isn't currently used for desktop promos. |
| 105 std::string promo_action_type_; | 102 scoped_ptr<const base::DictionaryValue> promo_payload_; |
| 106 scoped_ptr<base::ListValue> promo_action_args_; | |
| 107 #endif // defined(OS_ANDROID) || defined(OS_IOS) | |
| 108 | 103 |
| 109 double start_; | 104 double start_; |
| 110 double end_; | 105 double end_; |
| 111 | 106 |
| 112 int num_groups_; | 107 int num_groups_; |
| 113 int initial_segment_; | 108 int initial_segment_; |
| 114 int increment_; | 109 int increment_; |
| 115 int time_slice_; | 110 int time_slice_; |
| 116 int max_group_; | 111 int max_group_; |
| 117 | 112 |
| 118 // When max_views_ is 0, we don't cap the number of views. | 113 // When max_views_ is 0, we don't cap the number of views. |
| 119 int max_views_; | 114 int max_views_; |
| 120 | 115 |
| 121 int group_; | 116 int group_; |
| 122 int views_; | 117 int views_; |
| 123 bool closed_; | 118 bool closed_; |
| 124 | 119 |
| 125 bool gplus_required_; | 120 bool gplus_required_; |
| 126 | 121 |
| 127 bool new_notification_; | 122 bool new_notification_; |
| 128 | 123 |
| 129 DISALLOW_COPY_AND_ASSIGN(NotificationPromo); | 124 DISALLOW_COPY_AND_ASSIGN(NotificationPromo); |
| 130 }; | 125 }; |
| 131 | 126 |
| 132 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ | 127 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ |
| OLD | NEW |