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 namespace base { | 16 namespace base { |
17 class DictionaryValue; | 17 class DictionaryValue; |
18 class ListValue; | 18 class ListValue; |
19 } | 19 } |
20 | 20 |
| 21 class PrefRegistrySimple; |
21 class PrefService; | 22 class PrefService; |
22 class PrefServiceSimple; | |
23 class PrefServiceSyncable; | 23 class PrefServiceSyncable; |
24 | 24 |
25 // Helper class for PromoResourceService that parses promo notification info | 25 // Helper class for PromoResourceService that parses promo notification info |
26 // from json or prefs. | 26 // from json or prefs. |
27 class NotificationPromo { | 27 class NotificationPromo { |
28 public: | 28 public: |
29 static GURL PromoServerURL(); | 29 static GURL PromoServerURL(); |
30 | 30 |
31 enum PromoType { | 31 enum PromoType { |
32 NO_PROMO, | 32 NO_PROMO, |
(...skipping 26 matching lines...) Expand all Loading... |
59 | 59 |
60 bool new_notification() const { return new_notification_; } | 60 bool new_notification() const { return new_notification_; } |
61 | 61 |
62 const std::string& promo_text() const { return promo_text_; } | 62 const std::string& promo_text() const { return promo_text_; } |
63 PromoType promo_type() const { return promo_type_; } | 63 PromoType promo_type() const { return promo_type_; } |
64 const base::DictionaryValue* promo_payload() const { | 64 const base::DictionaryValue* promo_payload() const { |
65 return promo_payload_.get(); | 65 return promo_payload_.get(); |
66 } | 66 } |
67 | 67 |
68 // Register preferences. | 68 // Register preferences. |
69 static void RegisterPrefs(PrefServiceSimple* local_state); | 69 static void RegisterPrefs(PrefRegistrySimple* registry); |
70 static void RegisterUserPrefs(PrefServiceSyncable* prefs); | 70 static void RegisterUserPrefs(PrefServiceSyncable* prefs); |
71 | 71 |
72 private: | 72 private: |
73 // For testing. | 73 // For testing. |
74 friend class NotificationPromoTest; | 74 friend class NotificationPromoTest; |
75 | 75 |
76 // Check if this promo notification is new based on start/end times, | 76 // Check if this promo notification is new based on start/end times, |
77 // and trigger events accordingly. | 77 // and trigger events accordingly. |
78 void CheckForNewNotification(); | 78 void CheckForNewNotification(); |
79 | 79 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 int group_; | 114 int group_; |
115 int views_; | 115 int views_; |
116 bool closed_; | 116 bool closed_; |
117 | 117 |
118 bool new_notification_; | 118 bool new_notification_; |
119 | 119 |
120 DISALLOW_COPY_AND_ASSIGN(NotificationPromo); | 120 DISALLOW_COPY_AND_ASSIGN(NotificationPromo); |
121 }; | 121 }; |
122 | 122 |
123 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ | 123 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ |
OLD | NEW |