| 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 Profile; | 22 class Profile; |
| 23 | 23 |
| 24 // Helper class for PromoResourceService that parses promo notification info | 24 // Helper class for PromoResourceService that parses promo notification info |
| 25 // from json or prefs. | 25 // from json or prefs. |
| 26 class NotificationPromo { | 26 class NotificationPromo { |
| 27 public: | 27 public: |
| 28 static GURL PromoServerURL(); | 28 static GURL PromoServerURL(); |
| 29 | 29 |
| 30 static const char kNtpNotificationPromoType[]; |
| 31 static const char kBubblePromoType[]; |
| 32 |
| 30 explicit NotificationPromo(Profile* profile); | 33 explicit NotificationPromo(Profile* profile); |
| 31 ~NotificationPromo(); | 34 ~NotificationPromo(); |
| 32 | 35 |
| 33 // Initialize from json/prefs. | 36 // Initialize from json/prefs. |
| 34 void InitFromJson(const base::DictionaryValue& json); | 37 void InitFromJson(const base::DictionaryValue& json); |
| 35 void InitFromPrefs(); | 38 void InitFromPrefs(); |
| 36 | 39 |
| 37 // Can this promo be shown? | 40 // Can this promo be shown? |
| 38 bool CanShow() const; | 41 bool CanShow() const; |
| 39 | 42 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // Tests views_ against max_views_. | 75 // Tests views_ against max_views_. |
| 73 // When max_views_ is 0, we don't cap the number of views. | 76 // When max_views_ is 0, we don't cap the number of views. |
| 74 bool ExceedsMaxViews() const; | 77 bool ExceedsMaxViews() const; |
| 75 | 78 |
| 76 // True if this promo is not targeted to G+ users, or if this is a G+ user. | 79 // True if this promo is not targeted to G+ users, or if this is a G+ user. |
| 77 bool IsGPlusRequired() const; | 80 bool IsGPlusRequired() const; |
| 78 | 81 |
| 79 Profile* profile_; | 82 Profile* profile_; |
| 80 PrefService* prefs_; | 83 PrefService* prefs_; |
| 81 | 84 |
| 85 std::string promo_type_; |
| 82 std::string promo_text_; | 86 std::string promo_text_; |
| 83 #if defined(OS_ANDROID) | 87 #if defined(OS_ANDROID) |
| 84 std::string promo_text_long_; | 88 std::string promo_text_long_; |
| 85 std::string promo_action_type_; | 89 std::string promo_action_type_; |
| 86 scoped_ptr<base::ListValue> promo_action_args_; | 90 scoped_ptr<base::ListValue> promo_action_args_; |
| 87 #endif | 91 #endif |
| 88 | 92 |
| 89 double start_; | 93 double start_; |
| 90 double end_; | 94 double end_; |
| 91 | 95 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 103 bool closed_; | 107 bool closed_; |
| 104 | 108 |
| 105 bool gplus_required_; | 109 bool gplus_required_; |
| 106 | 110 |
| 107 bool new_notification_; | 111 bool new_notification_; |
| 108 | 112 |
| 109 DISALLOW_COPY_AND_ASSIGN(NotificationPromo); | 113 DISALLOW_COPY_AND_ASSIGN(NotificationPromo); |
| 110 }; | 114 }; |
| 111 | 115 |
| 112 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ | 116 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ |
| OLD | NEW |