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_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MANAGER_H_ |
6 #define CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MANAGER_H_ | 6 #define CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 friend class base::DeleteHelper<PushMessagingManager>; | 59 friend class base::DeleteHelper<PushMessagingManager>; |
60 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; | 60 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
61 | 61 |
62 ~PushMessagingManager() override; | 62 ~PushMessagingManager() override; |
63 | 63 |
64 void DidCheckForExistingRegistration( | 64 void DidCheckForExistingRegistration( |
65 const RegisterData& data, | 65 const RegisterData& data, |
66 const std::vector<std::string>& push_registration_id, | 66 const std::vector<std::string>& push_registration_id, |
67 ServiceWorkerStatusCode service_worker_status); | 67 ServiceWorkerStatusCode service_worker_status); |
68 | 68 |
69 void DidGetEncryptionKeys(const RegisterData& data, | |
70 const std::string& push_registration_id, | |
71 bool success, | |
72 const std::vector<uint8_t>& p256dh, | |
73 const std::vector<uint8_t>& auth); | |
74 | |
75 void DidGetSenderIdFromStorage(const RegisterData& data, | 69 void DidGetSenderIdFromStorage(const RegisterData& data, |
76 const std::vector<std::string>& sender_id, | 70 const std::vector<std::string>& sender_id, |
77 ServiceWorkerStatusCode service_worker_status); | 71 ServiceWorkerStatusCode service_worker_status); |
78 | 72 |
79 // Called via PostTask from UI thread. | 73 // Called via PostTask from UI thread. |
80 void PersistRegistrationOnIO(const RegisterData& data, | 74 void PersistRegistrationOnIO(const RegisterData& data, |
81 const std::string& push_registration_id, | 75 const std::string& push_registration_id, |
82 const std::vector<uint8_t>& p256dh, | 76 const std::vector<uint8_t>& p256dh, |
83 const std::vector<uint8_t>& auth); | 77 const std::vector<uint8_t>& auth); |
84 | 78 |
(...skipping 24 matching lines...) Expand all Loading... | |
109 // Called both from IO thread, and via PostTask from UI thread. | 103 // Called both from IO thread, and via PostTask from UI thread. |
110 void DidUnregister(const UnsubscribeCallback& callback, | 104 void DidUnregister(const UnsubscribeCallback& callback, |
111 PushUnregistrationStatus unregistration_status); | 105 PushUnregistrationStatus unregistration_status); |
112 | 106 |
113 void DidGetSubscription( | 107 void DidGetSubscription( |
114 const GetSubscriptionCallback& callback, | 108 const GetSubscriptionCallback& callback, |
115 int64_t service_worker_registration_id, | 109 int64_t service_worker_registration_id, |
116 const std::vector<std::string>& push_subscription_id_and_sender_info, | 110 const std::vector<std::string>& push_subscription_id_and_sender_info, |
117 ServiceWorkerStatusCode service_worker_status); | 111 ServiceWorkerStatusCode service_worker_status); |
118 | 112 |
119 void DidGetSubscriptionKeys(const GetSubscriptionCallback& callback, | |
120 const GURL& endpoint, | |
121 const std::string& sender_info, | |
122 bool success, | |
123 const std::vector<uint8_t>& p256dh, | |
124 const std::vector<uint8_t>& auth); | |
125 | |
126 // Helper methods on either thread ------------------------------------------- | 113 // Helper methods on either thread ------------------------------------------- |
127 | 114 |
128 // Creates an endpoint for |subscription_id| with either the default protocol, | 115 // Creates an endpoint for |subscription_id| with either the default protocol, |
129 // or the standardized Web Push Protocol, depending on |standard_protocol|. | 116 // or the standardized Web Push Protocol, depending on |standard_protocol|. |
130 GURL CreateEndpoint(bool standard_protocol, | 117 GURL CreateEndpoint(bool standard_protocol, |
131 const std::string& subscription_id) const; | 118 const std::string& subscription_id) const; |
132 | 119 |
133 // Inner core of this message filter which lives on the UI thread. | 120 // Inner core of this message filter which lives on the UI thread. |
134 std::unique_ptr<Core, BrowserThread::DeleteOnUIThread> ui_core_; | 121 std::unique_ptr<Core, BrowserThread::DeleteOnUIThread> ui_core_; |
122 // Can be used on the IO thread as the |this| parameter when binding a | |
nasko
2017/03/31 21:48:43
nit: Empty line above the comment.
johnme
2017/04/03 13:54:27
Done.
| |
123 // callback that will be called on the UI thread (an IO -> UI -> UI chain). | |
124 base::WeakPtr<Core> ui_core_weak_ptr_; | |
135 | 125 |
136 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | 126 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
137 | 127 |
138 // Whether the PushMessagingService was available when constructed. | 128 // Whether the PushMessagingService was available when constructed. |
139 bool service_available_; | 129 bool service_available_; |
140 | 130 |
141 GURL default_endpoint_; | 131 GURL default_endpoint_; |
142 GURL web_push_protocol_endpoint_; | 132 GURL web_push_protocol_endpoint_; |
143 | 133 |
144 mojo::BindingSet<mojom::PushMessaging> bindings_; | 134 mojo::BindingSet<mojom::PushMessaging> bindings_; |
145 | 135 |
146 base::WeakPtrFactory<PushMessagingManager> weak_factory_io_to_io_; | 136 base::WeakPtrFactory<PushMessagingManager> weak_factory_io_to_io_; |
147 | 137 |
148 DISALLOW_COPY_AND_ASSIGN(PushMessagingManager); | 138 DISALLOW_COPY_AND_ASSIGN(PushMessagingManager); |
149 }; | 139 }; |
150 | 140 |
151 } // namespace content | 141 } // namespace content |
152 | 142 |
153 #endif // CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MANAGER_H_ | 143 #endif // CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MANAGER_H_ |
OLD | NEW |