OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PROMO_RESOURCE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_WEB_RESOURCE_PROMO_RESOURCE_SERVICE_H_ |
6 #define CHROME_BROWSER_WEB_RESOURCE_PROMO_RESOURCE_SERVICE_H_ | 6 #define CHROME_BROWSER_WEB_RESOURCE_PROMO_RESOURCE_SERVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 // Unpack the web resource as a custom notification signal. Expects a start | 107 // Unpack the web resource as a custom notification signal. Expects a start |
108 // and end signal, with the promo to be shown in the tooltip of the start | 108 // and end signal, with the promo to be shown in the tooltip of the start |
109 // signal field. Delivery will be in json in the form of: | 109 // signal field. Delivery will be in json in the form of: |
110 // { | 110 // { |
111 // "topic": { | 111 // "topic": { |
112 // "answers": [ | 112 // "answers": [ |
113 // { | 113 // { |
114 // "answer_id": "1067976", | 114 // "answer_id": "1067976", |
115 // "name": "promo_start", | 115 // "name": "promo_start", |
116 // "question": "1:24:10:20:7", | 116 // "question": "1:24:10:20:7:0", |
117 // "tooltip": | 117 // "tooltip": |
118 // "Click \u003ca href=http://www.google.com\u003ehere\u003c/a\u003e!", | 118 // "Click \u003ca href=http://www.google.com\u003ehere\u003c/a\u003e!", |
119 // "inproduct": "10/8/09 12:00", | 119 // "inproduct": "10/8/09 12:00", |
120 // "inproduct_target": null | 120 // "inproduct_target": null |
121 // }, | 121 // }, |
122 // { | 122 // { |
123 // "answer_id": "1067976", | 123 // "answer_id": "1067976", |
124 // "name": "promo_end", | 124 // "name": "promo_end", |
125 // "question": "", | 125 // "question": "", |
126 // "tooltip": "", | 126 // "tooltip": "", |
127 // "inproduct": "10/8/11 12:00", | 127 // "inproduct": "10/8/11 12:00", |
128 // "inproduct_target": null | 128 // "inproduct_target": null |
129 // }, | 129 // }, |
130 // ... | 130 // ... |
131 // ] | 131 // ] |
132 // } | 132 // } |
133 // } | 133 // } |
134 // | 134 // |
135 // Because the promo signal data is piggybacked onto the tip server, the | 135 // Because the promo signal data is piggybacked onto the tip server, the |
136 // values don't exactly correspond with the field names: | 136 // values don't exactly correspond with the field names: |
137 // | 137 // |
138 // For "promo_start" or "promo_end", the date to start or stop showing the | 138 // For "promo_start" or "promo_end", the date to start or stop showing the |
139 // promotional line is given by the "inproduct" line. | 139 // promotional line is given by the "inproduct" line. |
140 // For "promo_start", the promotional line itself is given in the "tooltip" | 140 // For "promo_start", the promotional line itself is given in the "tooltip" |
141 // field. The "question" field gives the type of builds that should be shown | 141 // field. The "question" field gives the type of builds that should be shown |
142 // this promo (see the BuildType enum in web_resource_service.cc), the | 142 // this promo (see the BuildType enum in web_resource_service.cc), the |
143 // number of hours that each promo group should see it, the maximum promo | 143 // number of hours that each promo group should see it, the maximum promo |
144 // group that should see it, the maximum number of views of the promo, and | 144 // group that should see it, the maximum number of views of the promo,the |
145 // the platforms that this promo is suitable for, separated by ":". | 145 // platforms that this promo is suitable for, and a mask of features which |
146 // For example, "7:24:5:10:7" would indicate that all groups with ids less | 146 // must be present in order for the promo to be shown (0 => no feaures needed |
| 147 // 1 => user must be logged in to gplus), separated by ":". |
| 148 // For example, "7:24:5:10:7:0" would indicate that all groups with ids less |
147 // than 5, and with dev, beta and stable builds on Windows, Mac and Linux, | 149 // than 5, and with dev, beta and stable builds on Windows, Mac and Linux, |
148 // should see the promo a maximum of 10 times. The groups ramp up so one | 150 // should see the promo a maximum of 10 times, the promo is suitable for Mac |
149 // additional group sees the promo every 24 hours. | 151 // Linux and Windows platforms, and no features are required to show it. The |
| 152 // groups ramp up so one additional group sees the promo every 24 hours. |
150 // | 153 // |
151 void UnpackNotificationSignal(const base::DictionaryValue& parsed_json); | 154 void UnpackNotificationSignal(const base::DictionaryValue& parsed_json); |
152 | 155 |
153 // Unpack the promo resource as a custom logo signal. Expects a start and end | 156 // Unpack the promo resource as a custom logo signal. Expects a start and end |
154 // signal. Delivery will be in json in the form of: | 157 // signal. Delivery will be in json in the form of: |
155 // { | 158 // { |
156 // "topic": { | 159 // "topic": { |
157 // "answers": [ | 160 // "answers": [ |
158 // { | 161 // { |
159 // "answer_id": "107366", | 162 // "answer_id": "107366", |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // "name": "sign_in_promo", | 223 // "name": "sign_in_promo", |
221 // "question": "1:5" | 224 // "question": "1:5" |
222 // } | 225 // } |
223 // ] | 226 // ] |
224 // } | 227 // } |
225 // } | 228 // } |
226 // The question is in the form of "<build>:<group_max>". | 229 // The question is in the form of "<build>:<group_max>". |
227 void UnpackNTPSignInPromoSignal(const base::DictionaryValue& parsed_json); | 230 void UnpackNTPSignInPromoSignal(const base::DictionaryValue& parsed_json); |
228 | 231 |
229 // NotificationPromo::Delegate override. | 232 // NotificationPromo::Delegate override. |
230 virtual void OnNewNotification(double start, double end) OVERRIDE; | 233 virtual void OnNotificationParsed(double start, double end, |
| 234 bool new_notification) OVERRIDE; |
231 | 235 |
232 // The profile this service belongs to. | 236 // The profile this service belongs to. |
233 Profile* profile_; | 237 Profile* profile_; |
234 | 238 |
235 // Overrides the current Chrome release channel for testing purposes. | 239 // Overrides the current Chrome release channel for testing purposes. |
236 chrome::VersionInfo::Channel channel_; | 240 chrome::VersionInfo::Channel channel_; |
237 | 241 |
238 // A helper that downloads the promo logo. | 242 // A helper that downloads the promo logo. |
239 scoped_ptr<AppsPromoLogoFetcher> apps_promo_logo_fetcher_; | 243 scoped_ptr<AppsPromoLogoFetcher> apps_promo_logo_fetcher_; |
240 | 244 |
241 DISALLOW_COPY_AND_ASSIGN(PromoResourceService); | 245 DISALLOW_COPY_AND_ASSIGN(PromoResourceService); |
242 }; | 246 }; |
243 | 247 |
244 #endif // CHROME_BROWSER_WEB_RESOURCE_PROMO_RESOURCE_SERVICE_H_ | 248 #endif // CHROME_BROWSER_WEB_RESOURCE_PROMO_RESOURCE_SERVICE_H_ |
OLD | NEW |