| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_ |
| 6 #define CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
| 11 #include "content/public/common/push_messaging_status.h" | 11 #include "content/public/common/push_messaging_status.h" |
| 12 #include "content/public/renderer/render_frame_observer.h" | 12 #include "content/public/renderer/render_frame_observer.h" |
| 13 #include "third_party/WebKit/public/platform/WebPushClient.h" | 13 #include "third_party/WebKit/public/platform/WebPushClient.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 | 16 |
| 17 namespace IPC { | 17 namespace IPC { |
| 18 class Message; | 18 class Message; |
| 19 } // namespace IPC | 19 } // namespace IPC |
| 20 | 20 |
| 21 namespace blink { | 21 namespace blink { |
| 22 class WebServiceWorkerProvider; | 22 class WebServiceWorkerProvider; |
| 23 class WebString; | |
| 24 } // namespace blink | 23 } // namespace blink |
| 25 | 24 |
| 26 namespace content { | 25 namespace content { |
| 27 | 26 |
| 28 struct Manifest; | 27 struct Manifest; |
| 29 | 28 |
| 30 class PushMessagingDispatcher : public RenderFrameObserver, | 29 class PushMessagingDispatcher : public RenderFrameObserver, |
| 31 public blink::WebPushClient { | 30 public blink::WebPushClient { |
| 32 public: | 31 public: |
| 33 explicit PushMessagingDispatcher(RenderFrame* render_frame); | 32 explicit PushMessagingDispatcher(RenderFrame* render_frame); |
| 34 virtual ~PushMessagingDispatcher(); | 33 virtual ~PushMessagingDispatcher(); |
| 35 | 34 |
| 36 private: | 35 private: |
| 37 // RenderFrame::Observer implementation. | 36 // RenderFrame::Observer implementation. |
| 38 bool OnMessageReceived(const IPC::Message& message) override; | 37 bool OnMessageReceived(const IPC::Message& message) override; |
| 39 | 38 |
| 40 // WebPushClient implementation. | 39 // WebPushClient implementation. |
| 41 // TODO(peter): Remove this signature of registerPushMessaging. | |
| 42 virtual void registerPushMessaging( | |
| 43 const blink::WebString& sender_id, | |
| 44 blink::WebPushRegistrationCallbacks* callbacks, | |
| 45 blink::WebServiceWorkerProvider* service_worker_provider); | |
| 46 virtual void registerPushMessaging( | 40 virtual void registerPushMessaging( |
| 47 blink::WebPushRegistrationCallbacks* callbacks, | 41 blink::WebPushRegistrationCallbacks* callbacks, |
| 48 blink::WebServiceWorkerProvider* service_worker_provider); | 42 blink::WebServiceWorkerProvider* service_worker_provider); |
| 49 | 43 |
| 50 void DoRegister(blink::WebPushRegistrationCallbacks* callbacks, | 44 void DoRegister(blink::WebPushRegistrationCallbacks* callbacks, |
| 51 blink::WebServiceWorkerProvider* service_worker_provider, | 45 blink::WebServiceWorkerProvider* service_worker_provider, |
| 52 const Manifest& manifest); | 46 const Manifest& manifest); |
| 53 | 47 |
| 54 void OnRegisterSuccess(int32 callbacks_id, | 48 void OnRegisterSuccess(int32 callbacks_id, |
| 55 const GURL& endpoint, | 49 const GURL& endpoint, |
| 56 const std::string& registration_id); | 50 const std::string& registration_id); |
| 57 | 51 |
| 58 void OnRegisterError(int32 callbacks_id, PushRegistrationStatus status); | 52 void OnRegisterError(int32 callbacks_id, PushRegistrationStatus status); |
| 59 | 53 |
| 60 IDMap<blink::WebPushRegistrationCallbacks, IDMapOwnPointer> | 54 IDMap<blink::WebPushRegistrationCallbacks, IDMapOwnPointer> |
| 61 registration_callbacks_; | 55 registration_callbacks_; |
| 62 | 56 |
| 63 DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher); | 57 DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher); |
| 64 }; | 58 }; |
| 65 | 59 |
| 66 } // namespace content | 60 } // namespace content |
| 67 | 61 |
| 68 #endif // CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_ | 62 #endif // CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_ |
| OLD | NEW |