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" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 | 15 |
| 16 class PrefRegistrySimple; |
| 17 class PrefService; |
| 18 |
16 namespace base { | 19 namespace base { |
17 class DictionaryValue; | 20 class DictionaryValue; |
18 class ListValue; | 21 class ListValue; |
19 } | 22 } |
20 | 23 |
21 class PrefRegistrySimple; | 24 namespace user_prefs { |
22 class PrefService; | |
23 class PrefRegistrySyncable; | 25 class PrefRegistrySyncable; |
| 26 } |
24 | 27 |
25 // Helper class for PromoResourceService that parses promo notification info | 28 // Helper class for PromoResourceService that parses promo notification info |
26 // from json or prefs. | 29 // from json or prefs. |
27 class NotificationPromo { | 30 class NotificationPromo { |
28 public: | 31 public: |
29 static GURL PromoServerURL(); | 32 static GURL PromoServerURL(); |
30 | 33 |
31 enum PromoType { | 34 enum PromoType { |
32 NO_PROMO, | 35 NO_PROMO, |
33 NTP_NOTIFICATION_PROMO, | 36 NTP_NOTIFICATION_PROMO, |
(...skipping 26 matching lines...) Expand all Loading... |
60 bool new_notification() const { return new_notification_; } | 63 bool new_notification() const { return new_notification_; } |
61 | 64 |
62 const std::string& promo_text() const { return promo_text_; } | 65 const std::string& promo_text() const { return promo_text_; } |
63 PromoType promo_type() const { return promo_type_; } | 66 PromoType promo_type() const { return promo_type_; } |
64 const base::DictionaryValue* promo_payload() const { | 67 const base::DictionaryValue* promo_payload() const { |
65 return promo_payload_.get(); | 68 return promo_payload_.get(); |
66 } | 69 } |
67 | 70 |
68 // Register preferences. | 71 // Register preferences. |
69 static void RegisterPrefs(PrefRegistrySimple* registry); | 72 static void RegisterPrefs(PrefRegistrySimple* registry); |
70 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 73 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
71 static void MigrateUserPrefs(PrefService* user_prefs); | 74 static void MigrateUserPrefs(PrefService* user_prefs); |
72 | 75 |
73 private: | 76 private: |
74 // For testing. | 77 // For testing. |
75 friend class NotificationPromoTest; | 78 friend class NotificationPromoTest; |
76 | 79 |
77 // Check if this promo notification is new based on start/end times, | 80 // Check if this promo notification is new based on start/end times, |
78 // and trigger events accordingly. | 81 // and trigger events accordingly. |
79 void CheckForNewNotification(); | 82 void CheckForNewNotification(); |
80 | 83 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 int group_; | 121 int group_; |
119 int views_; | 122 int views_; |
120 bool closed_; | 123 bool closed_; |
121 | 124 |
122 bool new_notification_; | 125 bool new_notification_; |
123 | 126 |
124 DISALLOW_COPY_AND_ASSIGN(NotificationPromo); | 127 DISALLOW_COPY_AND_ASSIGN(NotificationPromo); |
125 }; | 128 }; |
126 | 129 |
127 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ | 130 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ |
OLD | NEW |