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_
11 #include "base/id_map.h"
12 #include "content/public/common/push_messaging_status.h"
13 #include "content/public/renderer/render_frame_observer.h"
14 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushClient.h"
15 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushPermissionStatus.h"
20 struct WebPushSubscriptionOptions
;
31 class PushMessagingDispatcher
: public RenderFrameObserver
,
32 public blink::WebPushClient
{
34 explicit PushMessagingDispatcher(RenderFrame
* render_frame
);
35 virtual ~PushMessagingDispatcher();
38 // RenderFrame::Observer implementation.
39 bool OnMessageReceived(const IPC::Message
& message
) override
;
41 // WebPushClient implementation.
42 virtual void subscribe(
43 blink::WebServiceWorkerRegistration
* service_worker_registration
,
44 const blink::WebPushSubscriptionOptions
& options
,
45 blink::WebPushSubscriptionCallbacks
* callbacks
);
48 blink::WebServiceWorkerRegistration
* service_worker_registration
,
49 const blink::WebPushSubscriptionOptions
& options
,
50 blink::WebPushSubscriptionCallbacks
* callbacks
,
51 const Manifest
& manifest
);
53 void OnSubscribeFromDocumentSuccess(int32_t request_id
,
54 const GURL
& endpoint
);
56 void OnSubscribeFromDocumentError(int32_t request_id
,
57 PushRegistrationStatus status
);
59 IDMap
<blink::WebPushSubscriptionCallbacks
, IDMapOwnPointer
>
60 subscription_callbacks_
;
62 DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher
);
65 } // namespace content
67 #endif // CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_DISPATCHER_H_