Refactor WebsiteSettings to operate on a SecurityInfo
[chromium-blink-merge.git] / content / renderer / push_messaging / push_messaging_dispatcher.h
blob8354c221969d46391a426285996f089cf489d838
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>
10 #include <vector>
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"
18 class GURL;
20 namespace blink {
21 struct WebPushSubscriptionOptions;
24 namespace IPC {
25 class Message;
26 } // namespace IPC
28 namespace content {
30 struct Manifest;
32 class PushMessagingDispatcher : public RenderFrameObserver,
33 public blink::WebPushClient {
34 public:
35 explicit PushMessagingDispatcher(RenderFrame* render_frame);
36 virtual ~PushMessagingDispatcher();
38 private:
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);
48 void DoSubscribe(
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,
55 const GURL& endpoint,
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_