Hook up PushSubscriptionOptions on the Chromium side.
[chromium-blink-merge.git] / content / renderer / push_messaging / push_messaging_dispatcher.h
blobda548db853cef1282aca86672a509a3f0292e947
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_
8 #include <stdint.h>
9 #include <string>
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"
17 class GURL;
19 namespace blink {
20 struct WebPushSubscriptionOptions;
23 namespace IPC {
24 class Message;
25 } // namespace IPC
27 namespace content {
29 struct Manifest;
31 class PushMessagingDispatcher : public RenderFrameObserver,
32 public blink::WebPushClient {
33 public:
34 explicit PushMessagingDispatcher(RenderFrame* render_frame);
35 virtual ~PushMessagingDispatcher();
37 private:
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);
46 // TODO(peter): Remove this method when Blink switched over to the above.
47 virtual void registerPushMessaging(
48 blink::WebServiceWorkerRegistration* service_worker_registration,
49 blink::WebPushSubscriptionCallbacks* callbacks); // override
51 void DoRegister(
52 blink::WebServiceWorkerRegistration* service_worker_registration,
53 const blink::WebPushSubscriptionOptions& options,
54 blink::WebPushSubscriptionCallbacks* callbacks,
55 const Manifest& manifest);
57 void OnRegisterFromDocumentSuccess(int32_t request_id,
58 const GURL& endpoint,
59 const std::string& registration_id);
61 void OnRegisterFromDocumentError(int32_t request_id,
62 PushRegistrationStatus status);
64 IDMap<blink::WebPushSubscriptionCallbacks, IDMapOwnPointer>
65 subscription_callbacks_;
67 DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher);
70 } // namespace content
72 #endif // CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_DISPATCHER_H_