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

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

Issue 6313009: Add possibility to divide chrome users into groups of equal size, and change ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_WEB_RESOURCE_SERVICE_H_ 5 #ifndef CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_
6 #define CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ 6 #define CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/utility_process_host.h" 13 #include "chrome/browser/utility_process_host.h"
14 #include "chrome/common/web_resource/web_resource_unpacker.h" 14 #include "chrome/common/web_resource/web_resource_unpacker.h"
15 15
16 class Profile; 16 class Profile;
17 17
18 namespace WebResourceServiceUtil { 18 namespace WebResourceServiceUtil {
19 19
20 // Certain promotions should only be shown to certain classes of users. This 20 // Certain promotions should only be shown to certain classes of users. This
21 // function will change to reflect each kind of promotion. 21 // function will change to reflect each kind of promotion.
22 bool CanShowPromo(Profile* profile); 22 bool CanShowPromo(Profile* profile);
23 23
24 } // namespace WebResourceService 24 } // namespace WebResourceService
25 25
26 // A WebResourceService fetches data from a web resource server to be used to
27 // dynamically change the appearance of the New Tab Page. For example, it has
28 // been used to fetch "tips" to be displayed on the NTP, or to display
29 // promotional messages to certain groups of Chrome users.
30 //
31 // TODO(mirandac): Arrange for a server to be set up specifically for promo
32 // messages, which have until now been piggybacked onto the old tips server
33 // structure. (see http://crbug.com/70634 for details.)
26 class WebResourceService 34 class WebResourceService
27 : public UtilityProcessHost::Client { 35 : public UtilityProcessHost::Client {
28 public: 36 public:
29 explicit WebResourceService(Profile* profile); 37 explicit WebResourceService(Profile* profile);
30 38
31 // Sleep until cache needs to be updated, but always for at least 5 seconds 39 // Sleep until cache needs to be updated, but always for at least 5 seconds
32 // so we don't interfere with startup. Then begin updating resources. 40 // so we don't interfere with startup. Then begin updating resources.
33 void StartAfterDelay(); 41 void StartAfterDelay();
34 42
35 // We have successfully pulled data from a resource server; now launch 43 // We have successfully pulled data from a resource server; now launch
(...skipping 22 matching lines...) Expand all
58 66
59 // Unpack the web resource as a custom promo signal. Expects a start and end 67 // Unpack the web resource as a custom promo signal. Expects a start and end
60 // signal, with the promo to be shown in the tooltip of the start signal 68 // signal, with the promo to be shown in the tooltip of the start signal
61 // field. Delivery will be in json in the form of: 69 // field. Delivery will be in json in the form of:
62 // { 70 // {
63 // "topic": { 71 // "topic": {
64 // "answers": [ 72 // "answers": [
65 // { 73 // {
66 // "answer_id": "1067976", 74 // "answer_id": "1067976",
67 // "name": "promo_start", 75 // "name": "promo_start",
68 // "question": "", 76 // "question": "1:24",
69 // "tooltip": 77 // "tooltip":
70 // "Click \u003ca href=http://www.google.com\u003ehere\u003c/a\u003e!", 78 // "Click \u003ca href=http://www.google.com\u003ehere\u003c/a\u003e!",
71 // "inproduct": "10/8/09 12:00", 79 // "inproduct": "10/8/09 12:00",
72 // "inproduct_target": null 80 // "inproduct_target": null
73 // }, 81 // },
74 // { 82 // {
75 // "answer_id": "1067976", 83 // "answer_id": "1067976",
76 // "name": "promo_end", 84 // "name": "promo_end",
77 // "question": "", 85 // "question": "",
78 // "tooltip": "", 86 // "tooltip": "",
79 // "inproduct": "10/8/11 12:00", 87 // "inproduct": "10/8/11 12:00",
80 // "inproduct_target": null 88 // "inproduct_target": null
81 // }, 89 // },
82 // ... 90 // ...
83 // ] 91 // ]
84 // } 92 // }
85 // } 93 // }
86 // 94 //
95 // Because the promo signal data is piggybacked onto the tip server, the
96 // values don't exactly correspond with the field names:
97 //
98 // For "promo_start" or "promo_end", the date to start or stop showing the
99 // promotional line is given by the "inproduct" line.
100 // For "promo_start", the promotional line itself is given in the "tooltip"
101 // field. The "question" field gives the type of builds that should be shown
102 // this promo (see the BuildType enum in web_resource_service.cc) and the
103 // number of hours that each promo group should see it, separated by ":".
104 // For example, "7:24" would indicate that all builds should see the promo,
105 // and each group should see it for 24 hours.
106 //
87 // Public for unit testing. 107 // Public for unit testing.
88 void UnpackPromoSignal(const DictionaryValue& parsed_json); 108 void UnpackPromoSignal(const DictionaryValue& parsed_json);
89 109
90 // Unpack the web resource as a custom logo signal. Expects a start and end 110 // Unpack the web resource as a custom logo signal. Expects a start and end
91 // signal. Delivery will be in json in the form of: 111 // signal. Delivery will be in json in the form of:
92 // { 112 // {
93 // "topic": { 113 // "topic": {
94 // "answers": [ 114 // "answers": [
95 // { 115 // {
96 // "answer_id": "107366", 116 // "answer_id": "107366",
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 int cache_update_delay_; 198 int cache_update_delay_;
179 199
180 // True if a task has been set to update the cache when a new web resource 200 // True if a task has been set to update the cache when a new web resource
181 // becomes available. 201 // becomes available.
182 bool web_resource_update_scheduled_; 202 bool web_resource_update_scheduled_;
183 203
184 DISALLOW_COPY_AND_ASSIGN(WebResourceService); 204 DISALLOW_COPY_AND_ASSIGN(WebResourceService);
185 }; 205 };
186 206
187 #endif // CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ 207 #endif // CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_service.h ('k') | chrome/browser/web_resource/web_resource_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698