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 #include "third_party/WebKit/public/platform/WebPushPermissionCallback.h" | |
14 | 15 |
15 class GURL; | 16 class GURL; |
16 | 17 |
17 namespace IPC { | 18 namespace IPC { |
18 class Message; | 19 class Message; |
19 } // namespace IPC | 20 } // namespace IPC |
20 | 21 |
21 namespace blink { | 22 namespace blink { |
23 class WebPushPermissionCallback; | |
22 class WebServiceWorkerProvider; | 24 class WebServiceWorkerProvider; |
23 class WebString; | 25 class WebString; |
24 } // namespace blink | 26 } // namespace blink |
25 | 27 |
26 namespace content { | 28 namespace content { |
27 | 29 |
28 struct Manifest; | 30 struct Manifest; |
29 | 31 |
30 class PushMessagingDispatcher : public RenderFrameObserver, | 32 class PushMessagingDispatcher : public RenderFrameObserver, |
31 public blink::WebPushClient { | 33 public blink::WebPushClient { |
32 public: | 34 public: |
33 explicit PushMessagingDispatcher(RenderFrame* render_frame); | 35 explicit PushMessagingDispatcher(RenderFrame* render_frame); |
34 virtual ~PushMessagingDispatcher(); | 36 virtual ~PushMessagingDispatcher(); |
35 | 37 |
36 private: | 38 private: |
37 // RenderFrame::Observer implementation. | 39 // RenderFrame::Observer implementation. |
38 virtual bool OnMessageReceived(const IPC::Message& message) override; | 40 virtual bool OnMessageReceived(const IPC::Message& message) override; |
39 | 41 |
40 // WebPushClient implementation. | 42 // WebPushClient implementation. |
41 virtual void registerPushMessaging( | 43 virtual void registerPushMessaging( |
42 const blink::WebString& sender_id, | 44 const blink::WebString& sender_id, |
43 blink::WebPushRegistrationCallbacks* callbacks, | 45 blink::WebPushRegistrationCallbacks* callbacks, |
44 blink::WebServiceWorkerProvider* service_worker_provider); | 46 blink::WebServiceWorkerProvider* service_worker_provider); |
45 | 47 |
48 | |
mlamouri (slow - plz ping)
2014/10/16 09:04:57
nit: no need for that new line.
Miguel Garcia
2014/10/16 13:50:26
Done.
| |
46 void DoRegister(const std::string& sender_id, | 49 void DoRegister(const std::string& sender_id, |
47 blink::WebPushRegistrationCallbacks* callbacks, | 50 blink::WebPushRegistrationCallbacks* callbacks, |
48 blink::WebServiceWorkerProvider* service_worker_provider, | 51 blink::WebServiceWorkerProvider* service_worker_provider, |
49 const Manifest& manifest); | 52 const Manifest& manifest); |
50 | 53 |
54 virtual void permissionStatus( | |
mlamouri (slow - plz ping)
2014/10/16 09:04:57
nit: uppercase 'P' for PermissionStatus().
Miguel Garcia
2014/10/16 13:50:26
It seems we are using lower case for the virtual m
mlamouri (slow - plz ping)
2014/10/17 09:30:56
registerPushMessaging() is an override from WebPus
| |
55 blink::WebPushPermissionCallback* callback, | |
56 blink::WebServiceWorkerProvider* service_worker_provider); | |
57 | |
51 void OnRegisterSuccess(int32 callbacks_id, | 58 void OnRegisterSuccess(int32 callbacks_id, |
52 const GURL& endpoint, | 59 const GURL& endpoint, |
53 const std::string& registration_id); | 60 const std::string& registration_id); |
54 | 61 |
55 void OnRegisterError(int32 callbacks_id, PushMessagingStatus status); | 62 void OnRegisterError(int32 callbacks_id, PushMessagingStatus status); |
56 | 63 |
64 void OnPermissionStatus(int32 callback_id, | |
65 blink::WebPushPermissionCallback::PushPermissionStatus); | |
mlamouri (slow - plz ping)
2014/10/16 09:04:57
nit: indent
Miguel Garcia
2014/10/16 13:50:26
Done.
| |
66 | |
67 | |
57 IDMap<blink::WebPushRegistrationCallbacks, IDMapOwnPointer> | 68 IDMap<blink::WebPushRegistrationCallbacks, IDMapOwnPointer> |
58 registration_callbacks_; | 69 registration_callbacks_; |
70 IDMap<blink::WebPushPermissionCallback, IDMapOwnPointer> | |
71 permission_check_callbacks_; | |
72 | |
59 | 73 |
60 DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher); | 74 DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher); |
61 }; | 75 }; |
62 | 76 |
63 } // namespace content | 77 } // namespace content |
64 | 78 |
65 #endif // CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_ | 79 #endif // CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_ |
OLD | NEW |