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_PUSH_MESSAGING_DISPATCHER_H_
6 #define CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_DISPATCHER_H_
10 #include "base/id_map.h"
11 #include "content/public/common/push_messaging_status.h"
12 #include "content/public/renderer/render_frame_observer.h"
13 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushClient.h"
14 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushPermissionStatus.h"
26 class PushMessagingDispatcher
: public RenderFrameObserver
,
27 public blink::WebPushClient
{
29 explicit PushMessagingDispatcher(RenderFrame
* render_frame
);
30 virtual ~PushMessagingDispatcher();
33 // RenderFrame::Observer implementation.
34 bool OnMessageReceived(const IPC::Message
& message
) override
;
36 // WebPushClient implementation.
37 virtual void registerPushMessaging(
38 blink::WebServiceWorkerRegistration
* service_worker_registration
,
39 blink::WebPushRegistrationCallbacks
* callbacks
); // override
42 blink::WebServiceWorkerRegistration
* service_worker_registration
,
43 blink::WebPushRegistrationCallbacks
* callbacks
,
44 const Manifest
& manifest
);
46 void OnRegisterFromDocumentSuccess(int32 request_id
,
48 const std::string
& registration_id
);
50 void OnRegisterFromDocumentError(int32 request_id
,
51 PushRegistrationStatus status
);
53 IDMap
<blink::WebPushRegistrationCallbacks
, IDMapOwnPointer
>
54 registration_callbacks_
;
56 DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher
);
59 } // namespace content
61 #endif // CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_DISPATCHER_H_