Chromium Code Reviews| 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 <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 | 180 |
| 181 // GetEncryptionInfo method -------------------------------------------------- | 181 // GetEncryptionInfo method -------------------------------------------------- |
| 182 | 182 |
| 183 void DidGetEncryptionInfo( | 183 void DidGetEncryptionInfo( |
| 184 const PushMessagingService::EncryptionInfoCallback& callback, | 184 const PushMessagingService::EncryptionInfoCallback& callback, |
| 185 const std::string& p256dh, | 185 const std::string& p256dh, |
| 186 const std::string& auth_secret) const; | 186 const std::string& auth_secret) const; |
| 187 | 187 |
| 188 // Unsubscribe methods ------------------------------------------------------- | 188 // Unsubscribe methods ------------------------------------------------------- |
| 189 | 189 |
| 190 void Unsubscribe(const std::string& app_id, | 190 // |origin|, |service_worker_registration_id| and |app_id| should be provided |
| 191 const std::string& sender_id, | 191 // whenever they can be obtained. It's valid for |origin| to be empty and |
| 192 const content::PushMessagingService::UnregisterCallback&); | 192 // |service_worker_registration_id| to be kInvalidServiceWorkerRegistrationId, |
| 193 // or for app_id to be empty, but not both at once. | |
| 194 void UnsubscribeInternal( | |
| 195 content::PushUnregistrationReason reason, | |
| 196 const GURL& origin, | |
| 197 int64_t service_worker_registration_id, | |
| 198 const std::string& app_id, | |
| 199 const std::string& sender_id, | |
| 200 const content::PushMessagingService::UnregisterCallback& callback); | |
|
Peter Beverloo
2016/09/30 14:26:07
q: could we use std::move() for the callback as op
johnme
2016/09/30 17:02:10
Maybe. But I think I'd rather be consistent with t
| |
| 201 | |
| 202 void DidClearPushSubscriptionId( | |
| 203 content::PushUnregistrationReason reason, | |
| 204 const std::string& app_id, | |
| 205 const std::string& sender_id, | |
| 206 const content::PushMessagingService::UnregisterCallback& callback); | |
| 193 | 207 |
| 194 void DidDeleteID(const std::string& app_id, | 208 void DidDeleteID(const std::string& app_id, |
| 195 bool was_subscribed, | 209 bool was_subscribed, |
| 196 const content::PushMessagingService::UnregisterCallback&, | 210 const content::PushMessagingService::UnregisterCallback&, |
| 197 instance_id::InstanceID::Result result); | 211 instance_id::InstanceID::Result result); |
| 198 | 212 |
| 199 void DidUnsubscribeInstanceID( | 213 void DidUnsubscribe( |
| 200 const std::string& app_id, | 214 const std::string& app_id_if_was_instance_id, |
|
Peter Beverloo
2016/09/30 14:26:07
nit: if_was -> when?
johnme
2016/09/30 17:02:10
Done.
| |
| 201 bool was_subscribed, | 215 bool was_subscribed, |
| 202 const content::PushMessagingService::UnregisterCallback&, | 216 const content::PushMessagingService::UnregisterCallback& callback, |
| 203 instance_id::InstanceID::Result result); | 217 content::PushUnregistrationStatus status); |
| 204 | |
| 205 void DidUnsubscribe(bool was_subscribed, | |
| 206 const content::PushMessagingService::UnregisterCallback&, | |
| 207 gcm::GCMClient::Result result); | |
| 208 | 218 |
| 209 // OnContentSettingChanged methods ------------------------------------------- | 219 // OnContentSettingChanged methods ------------------------------------------- |
| 210 | 220 |
| 211 void UnsubscribeBecausePermissionRevoked( | 221 void UnsubscribeBecausePermissionRevoked( |
| 212 const PushMessagingAppIdentifier& app_identifier, | 222 const PushMessagingAppIdentifier& app_identifier, |
| 213 const base::Closure& closure, | 223 const content::PushMessagingService::UnregisterCallback& callback, |
| 214 const std::string& sender_id, | 224 const std::string& sender_id, |
| 215 bool success, | 225 bool success, |
| 216 bool not_found); | 226 bool not_found); |
| 217 | 227 |
| 218 // Helper methods ------------------------------------------------------------ | 228 // Helper methods ------------------------------------------------------------ |
| 219 | 229 |
| 220 // Normalizes the |sender_info|. In most cases the |sender_info| will be | 230 // Normalizes the |sender_info|. In most cases the |sender_info| will be |
| 221 // passed through to the GCM Driver as-is, but NIST P-256 application server | 231 // passed through to the GCM Driver as-is, but NIST P-256 application server |
| 222 // keys have to be encoded using the URL-safe variant of the base64 encoding. | 232 // keys have to be encoded using the URL-safe variant of the base64 encoding. |
| 223 std::string NormalizeSenderInfo(const std::string& sender_info) const; | 233 std::string NormalizeSenderInfo(const std::string& sender_info) const; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 // we can finish processing them without being interrupted. | 286 // we can finish processing them without being interrupted. |
| 277 std::unique_ptr<ScopedKeepAlive> in_flight_keep_alive_; | 287 std::unique_ptr<ScopedKeepAlive> in_flight_keep_alive_; |
| 278 #endif | 288 #endif |
| 279 | 289 |
| 280 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; | 290 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; |
| 281 | 291 |
| 282 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); | 292 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); |
| 283 }; | 293 }; |
| 284 | 294 |
| 285 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ | 295 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ |
| OLD | NEW |