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_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_ | 5 #ifndef CONTENT_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_ |
6 #define CONTENT_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_ | 6 #define CONTENT_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 blink::WebPushPermissionStatusCallbacks* callbacks); | 56 blink::WebPushPermissionStatusCallbacks* callbacks); |
57 | 57 |
58 // Called by the PushDispatcher. | 58 // Called by the PushDispatcher. |
59 bool OnMessageReceived(const IPC::Message& message); | 59 bool OnMessageReceived(const IPC::Message& message); |
60 | 60 |
61 private: | 61 private: |
62 PushProvider(ThreadSafeSender* thread_safe_sender, | 62 PushProvider(ThreadSafeSender* thread_safe_sender, |
63 PushDispatcher* push_dispatcher); | 63 PushDispatcher* push_dispatcher); |
64 | 64 |
65 // IPC message handlers. | 65 // IPC message handlers. |
66 void OnRegisterFromWorkerSuccess(int request_id, | 66 void OnSubscribeFromWorkerSuccess(int request_id, |
67 const GURL& endpoint, | 67 const GURL& endpoint, |
68 const std::string& registration_id); | 68 const std::string& subscription_id); |
69 void OnRegisterFromWorkerError(int request_id, PushRegistrationStatus status); | 69 void OnSubscribeFromWorkerError(int request_id, |
70 void OnUnregisterSuccess(int request_id, bool did_unregister); | 70 PushSubscriptionStatus status); |
71 void OnUnregisterError(int request_id, | 71 void OnUnsubscribeSuccess(int request_id, bool did_unsubscribe); |
72 blink::WebPushError::ErrorType error_type, | 72 void OnUnsubscribeError(int request_id, |
73 const std::string& error_message); | 73 blink::WebPushError::ErrorType error_type, |
74 void OnGetRegistrationSuccess(int request_id, | 74 const std::string& error_message); |
| 75 void OnGetSubscriptionSuccess(int request_id, |
75 const GURL& endpoint, | 76 const GURL& endpoint, |
76 const std::string& registration_id); | 77 const std::string& subscription_id); |
77 void OnGetRegistrationError(int request_id, PushGetRegistrationStatus status); | 78 void OnGetSubscriptionError(int request_id, PushGetSubscriptionStatus status); |
78 void OnGetPermissionStatusSuccess(int request_id, | 79 void OnGetPermissionStatusSuccess(int request_id, |
79 blink::WebPushPermissionStatus status); | 80 blink::WebPushPermissionStatus status); |
80 void OnGetPermissionStatusError(int request_id); | 81 void OnGetPermissionStatusError(int request_id); |
81 | 82 |
82 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 83 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
83 scoped_refptr<PushDispatcher> push_dispatcher_; | 84 scoped_refptr<PushDispatcher> push_dispatcher_; |
84 | 85 |
85 // Stores the subscription callbacks with their request ids. This class owns | 86 // Stores the subscription callbacks with their request ids. This class owns |
86 // the callbacks. | 87 // the callbacks. |
87 IDMap<blink::WebPushSubscriptionCallbacks, IDMapOwnPointer> | 88 IDMap<blink::WebPushSubscriptionCallbacks, IDMapOwnPointer> |
88 subscription_callbacks_; | 89 subscription_callbacks_; |
89 | 90 |
90 // Stores the permission status callbacks with their request ids. This class | 91 // Stores the permission status callbacks with their request ids. This class |
91 // owns the callbacks. | 92 // owns the callbacks. |
92 IDMap<blink::WebPushPermissionStatusCallbacks, IDMapOwnPointer> | 93 IDMap<blink::WebPushPermissionStatusCallbacks, IDMapOwnPointer> |
93 permission_status_callbacks_; | 94 permission_status_callbacks_; |
94 | 95 |
95 // Stores the unsubscription callbacks with their request ids. This class owns | 96 // Stores the unsubscription callbacks with their request ids. This class owns |
96 // the callbacks. | 97 // the callbacks. |
97 IDMap<blink::WebPushUnsubscribeCallbacks, IDMapOwnPointer> | 98 IDMap<blink::WebPushUnsubscribeCallbacks, IDMapOwnPointer> |
98 unsubscribe_callbacks_; | 99 unsubscribe_callbacks_; |
99 | 100 |
100 DISALLOW_COPY_AND_ASSIGN(PushProvider); | 101 DISALLOW_COPY_AND_ASSIGN(PushProvider); |
101 }; | 102 }; |
102 | 103 |
103 } // namespace content | 104 } // namespace content |
104 | 105 |
105 #endif // CONTENT_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_ | 106 #endif // CONTENT_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_ |
OLD | NEW |