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 5d8e95cc92354a4aad3fbf48def392ed1988d9ac..16cc560b42cdc6144a66df6d6d82dbf5530ef987 100644 |
| --- a/chrome/browser/extensions/api/push_messaging/push_messaging_api.h |
| +++ b/chrome/browser/extensions/api/push_messaging/push_messaging_api.h |
| @@ -6,32 +6,54 @@ |
| #define CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_API_H__ |
| #include <string> |
| + |
| #include "base/basictypes.h" |
| #include "base/compiler_specific.h" |
| #include "base/gtest_prod_util.h" |
| -#include "chrome/browser/extensions/api/push_messaging/invalidation_handler_observer.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler_observer.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| class Profile; |
| namespace extensions { |
| +class PushMessagingInvalidationMapper; |
| + |
| // Observes a single InvalidationHandler and generates onMessage events. |
| -class PushMessagingEventRouter : public InvalidationHandlerObserver { |
| +class PushMessagingEventRouter |
| + : public PushMessagingInvalidationHandlerObserver, |
| + public content::NotificationObserver { |
| public: |
| explicit PushMessagingEventRouter(Profile* profile); |
| virtual ~PushMessagingEventRouter(); |
| void Init(); |
| + void Shutdown(); |
| - private: |
| - FRIEND_TEST_ALL_PREFIXES(PushMessagingApiTest, EventDispatch); |
| + PushMessagingInvalidationMapper* GetMapperForTest() const { |
| + return handler_.get(); |
| + } |
| + void SetMapperForTest(scoped_ptr<PushMessagingInvalidationMapper> mapper); |
| + void TriggerMessageForTest(const std::string& extension_id, |
| + int subchannel, |
| + const std::string& payload); |
| + private: |
| // InvalidationHandlerObserver implementation. |
| virtual void OnMessage(const std::string& extension_id, |
| int subchannel, |
| const std::string& payload) OVERRIDE; |
| + // content::NotificationObserver implementation. |
| + virtual void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| + |
| + content::NotificationRegistrar registrar_; |
| Profile* profile_; |
|
akalin
2012/08/20 20:35:01
const pointer?
dcheng
2012/08/20 20:58:21
Done.
|
| + scoped_ptr<PushMessagingInvalidationMapper> handler_; |
| DISALLOW_COPY_AND_ASSIGN(PushMessagingEventRouter); |
| }; |