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

Side by Side Diff: chrome/browser/web_resource/notification_promo.h

Issue 10860025: Remove promotion-type-specific JSON handling from NotificationPromo (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase. Created 8 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 (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
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
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 // Note that |payload| isn't currently used for desktop promos.
achuithb 2012/08/22 19:49:20 promo_payload_. You should probably drop promo_. I
aruslan 2012/08/23 00:49:59 Done -- but I kept it promo_payload as it's one of
104 std::string promo_text_long_; 101 scoped_ptr<const base::DictionaryValue> promo_payload_;
105 std::string promo_action_type_;
106 scoped_ptr<base::ListValue> promo_action_args_;
107 #endif // defined(OS_ANDROID) || defined(OS_IOS)
108 102
109 double start_; 103 double start_;
110 double end_; 104 double end_;
111 105
112 int num_groups_; 106 int num_groups_;
113 int initial_segment_; 107 int initial_segment_;
114 int increment_; 108 int increment_;
115 int time_slice_; 109 int time_slice_;
116 int max_group_; 110 int max_group_;
117 111
118 // When max_views_ is 0, we don't cap the number of views. 112 // When max_views_ is 0, we don't cap the number of views.
119 int max_views_; 113 int max_views_;
120 114
121 int group_; 115 int group_;
122 int views_; 116 int views_;
123 bool closed_; 117 bool closed_;
124 118
125 bool gplus_required_; 119 bool gplus_required_;
126 120
127 bool new_notification_; 121 bool new_notification_;
128 122
129 DISALLOW_COPY_AND_ASSIGN(NotificationPromo); 123 DISALLOW_COPY_AND_ASSIGN(NotificationPromo);
130 }; 124 };
131 125
132 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ 126 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/web_resource/notification_promo.cc » ('j') | chrome/browser/web_resource/notification_promo.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698