Chromium Code Reviews| Index: chrome/browser/extensions/api/push_messaging/push_messaging_api.h |
| diff --git a/chrome/browser/extensions/api/push_messaging/push_messaging_api.h b/chrome/browser/extensions/api/push_messaging/push_messaging_api.h |
| index dc9c7cb9426d879da4154e82b9f099dcbdead4e4..f5730fd15ae1c4cf3331425734918da472a42ee9 100644 |
| --- a/chrome/browser/extensions/api/push_messaging/push_messaging_api.h |
| +++ b/chrome/browser/extensions/api/push_messaging/push_messaging_api.h |
| @@ -13,7 +13,9 @@ |
| #include "base/memory/scoped_ptr.h" |
| #include "chrome/browser/extensions/api/push_messaging/obfuscated_gaia_id_fetcher.h" |
| #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler_delegate.h" |
| +#include "chrome/browser/extensions/event_router.h" |
| #include "chrome/browser/extensions/extension_function.h" |
| +#include "chrome/browser/profiles/profile_keyed_service.h" |
| #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| #include "content/public/browser/notification_observer.h" |
| #include "content/public/browser/notification_registrar.h" |
| @@ -34,8 +36,6 @@ class PushMessagingEventRouter |
| explicit PushMessagingEventRouter(Profile* profile); |
| virtual ~PushMessagingEventRouter(); |
| - void Shutdown(); |
| - |
| PushMessagingInvalidationMapper* GetMapperForTest() const { |
| return handler_.get(); |
| } |
| @@ -104,6 +104,33 @@ class PushMessagingGetChannelIdFunction |
| DISALLOW_COPY_AND_ASSIGN(PushMessagingGetChannelIdFunction); |
| }; |
| +class PushMessagingAPI : public ProfileKeyedService, |
| + public extensions::EventRouter::Observer { |
| + public: |
| + explicit PushMessagingAPI(Profile* profile); |
| + virtual ~PushMessagingAPI(); |
| + |
| + // Convenience method to get the PushMessagingAPI for a profile. |
| + static PushMessagingAPI* Get(Profile* profile); |
| + |
| + // ProfileKeyedService implementation. |
| + virtual void Shutdown() OVERRIDE; |
| + |
| + // EventRouter::Observer implementation. |
| + virtual void OnListenerAdded(const extensions::EventListenerInfo& details) |
| + OVERRIDE; |
| + |
| + // For testing purposes. |
| + void InitializeEventRouterForTest(); |
| + PushMessagingEventRouter* GetEventRouterForTest(); |
| + private: |
|
akalin
2012/12/12 21:39:15
newline before private:
Joe Thomas
2012/12/13 08:34:43
Done.
|
| + void InitializeEventRouter(); |
| + |
| + Profile* profile_; |
|
akalin
2012/12/12 21:39:15
do:
Profile* const profile_;
Joe Thomas
2012/12/13 08:34:43
Done.
|
| + // Created lazily upon OnListenerAdded. |
|
akalin
2012/12/12 21:39:15
I think you can just say 'Created in OnListenerAdd
Joe Thomas
2012/12/13 08:34:43
Done.
|
| + scoped_ptr<PushMessagingEventRouter> push_messaging_event_router_; |
|
akalin
2012/12/12 21:39:15
Add:
DISALLOW_COPY_AND_ASSIGN(PushMessagingAPI);
Joe Thomas
2012/12/13 08:34:43
Done.
|
| +}; |
| + |
| } // namespace extension |
| #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_API_H__ |