| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_ | |
| 6 #define CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 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/WebPushClient.h" | |
| 14 #include "third_party/WebKit/public/platform/WebPushPermissionStatus.h" | |
| 15 | |
| 16 class GURL; | |
| 17 | |
| 18 namespace IPC { | |
| 19 class Message; | |
| 20 } // namespace IPC | |
| 21 | |
| 22 namespace content { | |
| 23 | |
| 24 struct Manifest; | |
| 25 | |
| 26 class PushMessagingDispatcher : public RenderFrameObserver, | |
| 27 public blink::WebPushClient { | |
| 28 public: | |
| 29 explicit PushMessagingDispatcher(RenderFrame* render_frame); | |
| 30 virtual ~PushMessagingDispatcher(); | |
| 31 | |
| 32 private: | |
| 33 // RenderFrame::Observer implementation. | |
| 34 bool OnMessageReceived(const IPC::Message& message) override; | |
| 35 | |
| 36 // WebPushClient implementation. | |
| 37 virtual void registerPushMessaging( | |
| 38 blink::WebServiceWorkerRegistration* service_worker_registration, | |
| 39 blink::WebPushRegistrationCallbacks* callbacks); // override | |
| 40 | |
| 41 void DoRegister( | |
| 42 blink::WebServiceWorkerRegistration* service_worker_registration, | |
| 43 blink::WebPushRegistrationCallbacks* callbacks, | |
| 44 const Manifest& manifest); | |
| 45 | |
| 46 void OnRegisterFromDocumentSuccess(int32 request_id, | |
| 47 const GURL& endpoint, | |
| 48 const std::string& registration_id); | |
| 49 | |
| 50 void OnRegisterFromDocumentError(int32 request_id, | |
| 51 PushRegistrationStatus status); | |
| 52 | |
| 53 IDMap<blink::WebPushRegistrationCallbacks, IDMapOwnPointer> | |
| 54 registration_callbacks_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher); | |
| 57 }; | |
| 58 | |
| 59 } // namespace content | |
| 60 | |
| 61 #endif // CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_ | |
| OLD | NEW |