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 CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ |
6 #define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ | 6 #define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 void SubscribeEndWithError( | 136 void SubscribeEndWithError( |
137 const content::PushMessagingService::RegisterCallback& callback, | 137 const content::PushMessagingService::RegisterCallback& callback, |
138 content::PushRegistrationStatus status); | 138 content::PushRegistrationStatus status); |
139 | 139 |
140 void DidSubscribe( | 140 void DidSubscribe( |
141 const PushMessagingAppIdentifier& app_identifier, | 141 const PushMessagingAppIdentifier& app_identifier, |
142 const content::PushMessagingService::RegisterCallback& callback, | 142 const content::PushMessagingService::RegisterCallback& callback, |
143 const std::string& subscription_id, | 143 const std::string& subscription_id, |
144 gcm::GCMClient::Result result); | 144 gcm::GCMClient::Result result); |
145 | 145 |
146 void DidSubscribeWithPublicEncryptionKey( | |
147 const PushMessagingAppIdentifier& app_identifier, | |
148 const content::PushMessagingService::RegisterCallback& callback, | |
149 const std::string& subscription_id, | |
150 const std::vector<uint8_t>& public_key); | |
151 | |
146 void DidRequestPermission( | 152 void DidRequestPermission( |
147 const PushMessagingAppIdentifier& app_identifier, | 153 const PushMessagingAppIdentifier& app_identifier, |
148 const std::string& sender_id, | 154 const std::string& sender_id, |
149 const content::PushMessagingService::RegisterCallback& callback, | 155 const content::PushMessagingService::RegisterCallback& callback, |
150 content::PermissionStatus permission_status); | 156 content::PermissionStatus permission_status); |
151 | 157 |
152 // Unsubscribe methods ------------------------------------------------------- | 158 // Unsubscribe methods ------------------------------------------------------- |
153 | 159 |
154 void Unsubscribe(const std::string& app_id, | 160 void Unsubscribe(const std::string& app_id, |
155 const std::string& sender_id, | 161 const std::string& sender_id, |
156 const content::PushMessagingService::UnregisterCallback&); | 162 const content::PushMessagingService::UnregisterCallback&); |
157 | 163 |
158 void DidUnsubscribe(bool was_subscribed, | 164 void DidUnsubscribe(bool was_subscribed, |
159 const content::PushMessagingService::UnregisterCallback&, | 165 const content::PushMessagingService::UnregisterCallback&, |
160 gcm::GCMClient::Result result); | 166 gcm::GCMClient::Result result); |
161 | 167 |
168 // GetPublicEncryptionKey method --------------------------------------------- | |
169 | |
170 void DidGetPublicEncryptionKey( | |
171 const PushMessagingService::PublicKeyCallback& callback, | |
172 const std::vector<uint8_t>& public_key) const; | |
173 | |
162 // OnContentSettingChanged methods ------------------------------------------- | 174 // OnContentSettingChanged methods ------------------------------------------- |
163 | 175 |
164 void UnsubscribeBecausePermissionRevoked( | 176 void UnsubscribeBecausePermissionRevoked( |
165 const PushMessagingAppIdentifier& app_identifier, | 177 const PushMessagingAppIdentifier& app_identifier, |
166 const base::Closure& closure, | 178 const base::Closure& closure, |
167 const std::string& sender_id, | 179 const std::string& sender_id, |
168 bool success, | 180 bool success, |
169 bool not_found); | 181 bool not_found); |
170 | 182 |
171 // Helper methods ------------------------------------------------------------ | 183 // Helper methods ------------------------------------------------------------ |
172 | 184 |
173 // Checks if a given origin is allowed to use Push. | 185 // Checks if a given origin is allowed to use Push. |
174 bool IsPermissionSet(const GURL& origin); | 186 bool IsPermissionSet(const GURL& origin); |
175 | 187 |
188 // Returns whether incoming messages should support payloads. | |
189 bool EnableMessagePayloads() const; | |
jianli
2015/07/17 20:55:21
EnableMessagePayloads sounds more like an action.
Peter Beverloo
2015/07/20 17:55:53
Done.
| |
190 | |
176 gcm::GCMDriver* GetGCMDriver() const; | 191 gcm::GCMDriver* GetGCMDriver() const; |
177 | 192 |
178 Profile* profile_; | 193 Profile* profile_; |
179 | 194 |
180 int push_subscription_count_; | 195 int push_subscription_count_; |
181 int pending_push_subscription_count_; | 196 int pending_push_subscription_count_; |
182 | 197 |
183 base::Closure message_callback_for_testing_; | 198 base::Closure message_callback_for_testing_; |
184 base::Closure content_setting_changed_callback_for_testing_; | 199 base::Closure content_setting_changed_callback_for_testing_; |
185 | 200 |
186 #if defined(ENABLE_NOTIFICATIONS) | 201 #if defined(ENABLE_NOTIFICATIONS) |
187 PushMessagingNotificationManager notification_manager_; | 202 PushMessagingNotificationManager notification_manager_; |
188 #endif | 203 #endif |
189 | 204 |
190 // A multiset containing one entry for each in-flight push message delivery, | 205 // A multiset containing one entry for each in-flight push message delivery, |
191 // keyed by the receiver's app id. | 206 // keyed by the receiver's app id. |
192 std::multiset<std::string> in_flight_message_deliveries_; | 207 std::multiset<std::string> in_flight_message_deliveries_; |
193 | 208 |
194 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; | 209 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; |
195 | 210 |
196 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); | 211 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); |
197 }; | 212 }; |
198 | 213 |
199 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ | 214 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ |
OLD | NEW |