| 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..02c55dffd7d6c0ff98435ab400dd240160efdfd0 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_delegate.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 PushMessagingInvalidationHandlerDelegate,
|
| + 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);
|
|
|
| - // InvalidationHandlerObserver implementation.
|
| + private:
|
| + // InvalidationHandlerDelegate implementation.
|
| virtual void OnMessage(const std::string& extension_id,
|
| int subchannel,
|
| const std::string& payload) OVERRIDE;
|
|
|
| - Profile* profile_;
|
| + // content::NotificationDelegate implementation.
|
| + virtual void Observe(int type,
|
| + const content::NotificationSource& source,
|
| + const content::NotificationDetails& details) OVERRIDE;
|
| +
|
| + content::NotificationRegistrar registrar_;
|
| + Profile* const profile_;
|
| + scoped_ptr<PushMessagingInvalidationMapper> handler_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(PushMessagingEventRouter);
|
| };
|
|
|