Chromium Code Reviews| Index: chrome/browser/web_resource/notification_promo.h |
| =================================================================== |
| --- chrome/browser/web_resource/notification_promo.h (revision 108876) |
| +++ chrome/browser/web_resource/notification_promo.h (working copy) |
| @@ -10,16 +10,22 @@ |
| #include "base/basictypes.h" |
| #include "base/gtest_prod_util.h" |
| +#include "net/url_request/url_request_context.h" |
| namespace base { |
| class DictionaryValue; |
| } |
| +namespace net { |
| + class URLRequestContextGetter; |
| +} |
| + |
| class PrefService; |
| - |
| +class Profile; |
| // Helper class for PromoResourceService that parses promo notification info |
| // from json or prefs. |
| -class NotificationPromo { |
| +class NotificationPromo |
| + : public base::RefCountedThreadSafe<NotificationPromo> { |
| public: |
| class Delegate { |
| public: |
| @@ -29,8 +35,10 @@ |
| virtual bool IsBuildAllowed(int builds_targeted) const { return false; } |
| }; |
| - explicit NotificationPromo(PrefService* prefs, Delegate* delegate); |
| + // Static factory for creating new promo objects. |
| + static NotificationPromo* Factory(Profile* profile, Delegate* delegate); |
| + |
| // Initialize from json/prefs. |
| void InitFromJson(const base::DictionaryValue& json); |
| void InitFromPrefs(); |
| @@ -49,6 +57,12 @@ |
| // Register preferences. |
| static void RegisterUserPrefs(PrefService* prefs); |
| + protected: |
| + NotificationPromo(Profile* profile, Delegate* delegate); |
|
achuithb
2011/11/16 20:33:11
please make these private (the ctor, friend decl a
Cait (Slow)
2011/11/16 23:05:24
Done.
|
| + |
| + friend class base::RefCountedThreadSafe<NotificationPromo>; |
| + virtual ~NotificationPromo(); |
| + |
| private: |
| // For testing. |
| friend class NotificationPromoTestDelegate; |
| @@ -70,11 +84,15 @@ |
| // Check if this promo notification is new based on start/end times, |
| // and trigger events accordingly. |
| - void CheckForNewNotification(); |
| + void CheckForNewNotification(bool found_cookie); |
| // Actions on receiving a new promo notification. |
| void OnNewNotification(); |
| + void GetCookiesCallback(const std::string& cookies); |
| + |
| + void GetCookies(net::URLRequestContextGetter* getter); |
| + |
| // Create a new promo notification group. |
| static int NewGroup(); |
| @@ -95,6 +113,7 @@ |
| bool operator==(const NotificationPromo& other) const; |
| PrefService* prefs_; |
| + Profile* profile_; |
|
achuithb
2011/11/16 20:33:11
I think profile_ should be the first data member
Cait (Slow)
2011/11/16 23:05:24
Done.
|
| Delegate* delegate_; |
| double start_; |
| @@ -104,11 +123,13 @@ |
| int time_slice_; |
| int max_group_; |
| int max_views_; |
| + int feature_mask_; |
| int group_; |
| int views_; |
| std::string text_; |
| bool closed_; |
| + bool gplus_; |
| DISALLOW_COPY_AND_ASSIGN(NotificationPromo); |
| }; |