1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_
6 #define CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_
10 #include "base/id_map.h"
11 #include "content/public/renderer/render_view_observer.h"
12 #include "third_party/WebKit/public/platform/WebPushClient.h"
27 class PushMessagingDispatcher
: public RenderViewObserver
,
28 public blink::WebPushClient
{
30 explicit PushMessagingDispatcher(RenderViewImpl
* render_view
);
31 virtual ~PushMessagingDispatcher();
34 // RenderView::Observer implementation.
35 virtual bool OnMessageReceived(const IPC::Message
& message
) OVERRIDE
;
37 // WebPushClient implementation.
38 virtual void registerPushMessaging(
39 const blink::WebString
& sender_id
,
40 blink::WebPushRegistrationCallbacks
* callbacks
) OVERRIDE
;
42 void OnRegisterSuccess(int32 callbacks_id
,
44 const std::string
& registration_id
);
46 void OnRegisterError(int32 callbacks_id
);
48 IDMap
<blink::WebPushRegistrationCallbacks
, IDMapOwnPointer
>
49 registration_callbacks_
;
51 DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher
);
54 } // namespace content
56 #endif // CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_