| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 base::RefCountedThreadSafe<NotificationPromo> { | 27 : public base::RefCountedThreadSafe<NotificationPromo> { |
| 28 public: | 28 public: |
| 29 class Delegate { | 29 class Delegate { |
| 30 public: | 30 public: |
| 31 virtual ~Delegate() {} | 31 virtual void OnNotificationParsed(double start, double end, |
| 32 virtual void OnNotificationParsed(double start, double end, | 32 bool new_notification) = 0; |
| 33 bool new_notification) = 0; | 33 // For testing. |
| 34 // For testing. | 34 virtual bool IsBuildAllowed(int builds_targeted) const { return false; } |
| 35 virtual bool IsBuildAllowed(int builds_targeted) const { return false; } | 35 virtual int CurrentPlatform() const { return PLATFORM_NONE; } |
| 36 virtual int CurrentPlatform() const { return PLATFORM_NONE; } | 36 |
| 37 protected: |
| 38 virtual ~Delegate() {} |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 // Static factory for creating new notification promos. | 41 // Static factory for creating new notification promos. |
| 40 static NotificationPromo* Create(Profile* profile, Delegate* delegate); | 42 static NotificationPromo* Create(Profile* profile, Delegate* delegate); |
| 41 | 43 |
| 42 static GURL PromoServerURL(); | 44 static GURL PromoServerURL(); |
| 43 | 45 |
| 44 // Initialize from json/prefs. | 46 // Initialize from json/prefs. |
| 45 void InitFromJson(const base::DictionaryValue& json); | 47 void InitFromJson(const base::DictionaryValue& json); |
| 46 void InitFromPrefs(); | 48 void InitFromPrefs(); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 bool closed_; | 143 bool closed_; |
| 142 | 144 |
| 143 int build_; | 145 int build_; |
| 144 int platform_; | 146 int platform_; |
| 145 | 147 |
| 146 DISALLOW_COPY_AND_ASSIGN(NotificationPromo); | 148 DISALLOW_COPY_AND_ASSIGN(NotificationPromo); |
| 147 }; | 149 }; |
| 148 | 150 |
| 149 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ | 151 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ |
| 150 | 152 |
| OLD | NEW |