| 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 #include "chrome/browser/push_messaging/push_messaging_service_impl.h" | 5 #include "chrome/browser/push_messaging/push_messaging_service_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/barrier_closure.h" | 9 #include "base/barrier_closure.h" |
| 10 #include "base/base64url.h" | 10 #include "base/base64url.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 248 |
| 249 void PushMessagingServiceImpl::ShutdownHandler() { | 249 void PushMessagingServiceImpl::ShutdownHandler() { |
| 250 // Shutdown() should come before and it removes us from the list of app | 250 // Shutdown() should come before and it removes us from the list of app |
| 251 // handlers of gcm::GCMDriver so this shouldn't ever been called. | 251 // handlers of gcm::GCMDriver so this shouldn't ever been called. |
| 252 NOTREACHED(); | 252 NOTREACHED(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 void PushMessagingServiceImpl::OnStoreReset() { | 255 void PushMessagingServiceImpl::OnStoreReset() { |
| 256 // Delete all cached subscriptions, since they are now invalid. | 256 // Delete all cached subscriptions, since they are now invalid. |
| 257 for (const auto& identifier : PushMessagingAppIdentifier::GetAll(profile_)) { | 257 for (const auto& identifier : PushMessagingAppIdentifier::GetAll(profile_)) { |
| 258 RecordUnsubscribeReason( |
| 259 content::PUSH_UNREGISTRATION_REASON_GCM_STORE_RESET); |
| 258 // Clear all the subscriptions in parallel, to reduce risk that shutdown | 260 // Clear all the subscriptions in parallel, to reduce risk that shutdown |
| 259 // occurs before we finish clearing them. | 261 // occurs before we finish clearing them. |
| 260 ClearPushSubscriptionId(profile_, identifier.origin(), | 262 ClearPushSubscriptionId(profile_, identifier.origin(), |
| 261 identifier.service_worker_registration_id(), | 263 identifier.service_worker_registration_id(), |
| 262 base::Bind(&base::DoNothing)); | 264 base::Bind(&base::DoNothing)); |
| 263 // TODO(johnme): Fire pushsubscriptionchange/pushsubscriptionlost SW event. | 265 // TODO(johnme): Fire pushsubscriptionchange/pushsubscriptionlost SW event. |
| 264 } | 266 } |
| 265 PushMessagingAppIdentifier::DeleteAllFromPrefs(profile_); | 267 PushMessagingAppIdentifier::DeleteAllFromPrefs(profile_); |
| 266 } | 268 } |
| 267 | 269 |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 } | 974 } |
| 973 | 975 |
| 974 instance_id::InstanceIDDriver* PushMessagingServiceImpl::GetInstanceIDDriver() | 976 instance_id::InstanceIDDriver* PushMessagingServiceImpl::GetInstanceIDDriver() |
| 975 const { | 977 const { |
| 976 instance_id::InstanceIDProfileService* instance_id_profile_service = | 978 instance_id::InstanceIDProfileService* instance_id_profile_service = |
| 977 instance_id::InstanceIDProfileServiceFactory::GetForProfile(profile_); | 979 instance_id::InstanceIDProfileServiceFactory::GetForProfile(profile_); |
| 978 CHECK(instance_id_profile_service); | 980 CHECK(instance_id_profile_service); |
| 979 CHECK(instance_id_profile_service->driver()); | 981 CHECK(instance_id_profile_service->driver()); |
| 980 return instance_id_profile_service->driver(); | 982 return instance_id_profile_service->driver(); |
| 981 } | 983 } |
| OLD | NEW |