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