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_
12 #include "base/id_map.h"
13 #include "content/public/common/push_messaging_status.h"
14 #include "content/public/renderer/render_frame_observer.h"
15 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushClient.h"
16 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushPermissionStatus.h"
21 struct WebPushSubscriptionOptions
;
32 class PushMessagingDispatcher
: public RenderFrameObserver
,
33 public blink::WebPushClient
{
35 explicit PushMessagingDispatcher(RenderFrame
* render_frame
);
36 virtual ~PushMessagingDispatcher();
39 // RenderFrame::Observer implementation.
40 bool OnMessageReceived(const IPC::Message
& message
) override
;
42 // WebPushClient implementation.
43 virtual void subscribe(
44 blink::WebServiceWorkerRegistration
* service_worker_registration
,
45 const blink::WebPushSubscriptionOptions
& options
,
46 blink::WebPushSubscriptionCallbacks
* callbacks
);
49 blink::WebServiceWorkerRegistration
* service_worker_registration
,
50 const blink::WebPushSubscriptionOptions
& options
,
51 blink::WebPushSubscriptionCallbacks
* callbacks
,
52 const Manifest
& manifest
);
54 void OnSubscribeFromDocumentSuccess(int32_t request_id
,
56 const std::vector
<uint8_t>& curve25519dh
);
58 void OnSubscribeFromDocumentError(int32_t request_id
,
59 PushRegistrationStatus status
);
61 IDMap
<blink::WebPushSubscriptionCallbacks
, IDMapOwnPointer
>
62 subscription_callbacks_
;
64 DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher
);
67 } // namespace content
69 #endif // CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_DISPATCHER_H_