| 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_PUSH_MESSAGING_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_DISPATCHER_H_ | 
| 6 #define CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_DISPATCHER_H_ | 
| 7 | 7 | 
| 8 #include <stdint.h> | 8 #include <stdint.h> | 
| 9 #include <string> | 9 #include <string> | 
| 10 #include <vector> | 10 #include <vector> | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 22 struct WebPushSubscriptionOptions; | 22 struct WebPushSubscriptionOptions; | 
| 23 } | 23 } | 
| 24 | 24 | 
| 25 namespace IPC { | 25 namespace IPC { | 
| 26 class Message; | 26 class Message; | 
| 27 }  // namespace IPC | 27 }  // namespace IPC | 
| 28 | 28 | 
| 29 namespace content { | 29 namespace content { | 
| 30 | 30 | 
| 31 struct Manifest; | 31 struct Manifest; | 
| 32 struct PushSubscriptionOptions; |  | 
| 33 | 32 | 
| 34 class PushMessagingDispatcher : public RenderFrameObserver, | 33 class PushMessagingDispatcher : public RenderFrameObserver, | 
| 35                                 public blink::WebPushClient { | 34                                 public blink::WebPushClient { | 
| 36  public: | 35  public: | 
| 37   explicit PushMessagingDispatcher(RenderFrame* render_frame); | 36   explicit PushMessagingDispatcher(RenderFrame* render_frame); | 
| 38   ~PushMessagingDispatcher() override; | 37   ~PushMessagingDispatcher() override; | 
| 39 | 38 | 
| 40  private: | 39  private: | 
| 41   // RenderFrame::Observer implementation. | 40   // RenderFrame::Observer implementation. | 
| 42   bool OnMessageReceived(const IPC::Message& message) override; | 41   bool OnMessageReceived(const IPC::Message& message) override; | 
| 43 | 42 | 
| 44   // WebPushClient implementation. | 43   // WebPushClient implementation. | 
| 45   void subscribe( | 44   void subscribe( | 
| 46       blink::WebServiceWorkerRegistration* service_worker_registration, | 45       blink::WebServiceWorkerRegistration* service_worker_registration, | 
| 47       const blink::WebPushSubscriptionOptions& options, | 46       const blink::WebPushSubscriptionOptions& options, | 
| 48       blink::WebPushSubscriptionCallbacks* callbacks) override; | 47       blink::WebPushSubscriptionCallbacks* callbacks) override; | 
| 49 | 48 | 
| 50   void DidGetManifest( | 49   void DoSubscribe( | 
| 51       blink::WebServiceWorkerRegistration* service_worker_registration, | 50       blink::WebServiceWorkerRegistration* service_worker_registration, | 
| 52       const blink::WebPushSubscriptionOptions& options, | 51       const blink::WebPushSubscriptionOptions& options, | 
| 53       blink::WebPushSubscriptionCallbacks* callbacks, | 52       blink::WebPushSubscriptionCallbacks* callbacks, | 
| 54       const Manifest& manifest); | 53       const Manifest& manifest); | 
| 55 | 54 | 
| 56   void DoSubscribe( |  | 
| 57       blink::WebServiceWorkerRegistration* service_worker_registration, |  | 
| 58       const PushSubscriptionOptions& options, |  | 
| 59       blink::WebPushSubscriptionCallbacks* callbacks); |  | 
| 60 |  | 
| 61   void OnSubscribeFromDocumentSuccess(int32_t request_id, | 55   void OnSubscribeFromDocumentSuccess(int32_t request_id, | 
| 62                                       const GURL& endpoint, | 56                                       const GURL& endpoint, | 
| 63                                       const std::vector<uint8_t>& p256dh, | 57                                       const std::vector<uint8_t>& p256dh, | 
| 64                                       const std::vector<uint8_t>& auth); | 58                                       const std::vector<uint8_t>& auth); | 
| 65 | 59 | 
| 66   void OnSubscribeFromDocumentError(int32_t request_id, | 60   void OnSubscribeFromDocumentError(int32_t request_id, | 
| 67                                     PushRegistrationStatus status); | 61                                     PushRegistrationStatus status); | 
| 68 | 62 | 
| 69   IDMap<blink::WebPushSubscriptionCallbacks, IDMapOwnPointer> | 63   IDMap<blink::WebPushSubscriptionCallbacks, IDMapOwnPointer> | 
| 70       subscription_callbacks_; | 64       subscription_callbacks_; | 
| 71 | 65 | 
| 72   DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher); | 66   DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher); | 
| 73 }; | 67 }; | 
| 74 | 68 | 
| 75 }  // namespace content | 69 }  // namespace content | 
| 76 | 70 | 
| 77 #endif  // CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_DISPATCHER_H_ | 71 #endif  // CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_DISPATCHER_H_ | 
| OLD | NEW | 
|---|