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