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_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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "chrome/browser/web_resource/web_resource_service.h" | 11 #include "chrome/browser/web_resource/web_resource_service.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class DictionaryValue; | 14 class DictionaryValue; |
15 } | 15 } |
16 | 16 |
17 class NotificationPromo; | 17 class NotificationPromo; |
18 class PrefRegistrySimple; | 18 class PrefRegistrySimple; |
19 class PrefServiceSyncable; | 19 class PrefRegistrySyncable; |
| 20 class PrefService; |
20 | 21 |
21 // A PromoResourceService fetches data from a web resource server to be used to | 22 // A PromoResourceService fetches data from a web resource server to be used to |
22 // dynamically change the appearance of the New Tab Page. For example, it has | 23 // dynamically change the appearance of the New Tab Page. For example, it has |
23 // been used to fetch "tips" to be displayed on the NTP, or to display | 24 // been used to fetch "tips" to be displayed on the NTP, or to display |
24 // promotional messages to certain groups of Chrome users. | 25 // promotional messages to certain groups of Chrome users. |
25 class PromoResourceService : public WebResourceService { | 26 class PromoResourceService : public WebResourceService { |
26 public: | 27 public: |
27 static void RegisterPrefs(PrefRegistrySimple* registry); | 28 static void RegisterPrefs(PrefRegistrySimple* registry); |
28 static void RegisterUserPrefs(PrefServiceSyncable* prefs); | 29 static void RegisterUserPrefs(PrefService* prefs, |
| 30 PrefRegistrySyncable* registry); |
29 | 31 |
30 PromoResourceService(); | 32 PromoResourceService(); |
31 | 33 |
32 private: | 34 private: |
33 virtual ~PromoResourceService(); | 35 virtual ~PromoResourceService(); |
34 | 36 |
35 // Schedule a notification that a web resource is either going to become | 37 // Schedule a notification that a web resource is either going to become |
36 // available or be no longer valid. | 38 // available or be no longer valid. |
37 void ScheduleNotification(const NotificationPromo& notification_promo); | 39 void ScheduleNotification(const NotificationPromo& notification_promo); |
38 | 40 |
(...skipping 16 matching lines...) Expand all Loading... |
55 | 57 |
56 // Allows the creation of tasks to send a notification. | 58 // Allows the creation of tasks to send a notification. |
57 // This allows the PromoResourceService to notify the New Tab Page immediately | 59 // This allows the PromoResourceService to notify the New Tab Page immediately |
58 // when a new web resource should be shown or removed. | 60 // when a new web resource should be shown or removed. |
59 base::WeakPtrFactory<PromoResourceService> weak_ptr_factory_; | 61 base::WeakPtrFactory<PromoResourceService> weak_ptr_factory_; |
60 | 62 |
61 DISALLOW_COPY_AND_ASSIGN(PromoResourceService); | 63 DISALLOW_COPY_AND_ASSIGN(PromoResourceService); |
62 }; | 64 }; |
63 | 65 |
64 #endif // CHROME_BROWSER_WEB_RESOURCE_PROMO_RESOURCE_SERVICE_H_ | 66 #endif // CHROME_BROWSER_WEB_RESOURCE_PROMO_RESOURCE_SERVICE_H_ |
OLD | NEW |