Index: components/gcm_driver/gcm_driver_desktop.cc |
diff --git a/components/gcm_driver/gcm_driver_desktop.cc b/components/gcm_driver/gcm_driver_desktop.cc |
index 672296656784a79d914aaf97f3f695f6e3d9070f..8d35c2c03acf9c2ed8b0fd8cfd00cb4ea2dd5656 100644 |
--- a/components/gcm_driver/gcm_driver_desktop.cc |
+++ b/components/gcm_driver/gcm_driver_desktop.cc |
@@ -369,13 +369,18 @@ void GCMDriverDesktop::OnSignedIn() { |
EnsureStarted(); |
} |
+void GCMDriverDesktop::OnSignedOut() { |
+ signed_in_ = false; |
+ |
+ // When sign-in enforcement is dropped, we will no longer wipe out the GCM |
+ // data when the user signs out. |
+ if (!GCMDriver::IsAllowedForAllUsers()) |
+ Purge(); |
+} |
+ |
void GCMDriverDesktop::Purge() { |
DCHECK(ui_thread_->RunsTasksOnCurrentThread()); |
- // We still proceed with the check-out logic even if the check-in is not |
- // initiated in the current session. This will make sure that all the |
- // persisted data written previously will get purged. |
- signed_in_ = false; |
RemoveCachedData(); |
io_thread_->PostTask(FROM_HERE, |
@@ -616,7 +621,6 @@ GCMClient::Result GCMDriverDesktop::EnsureStarted() { |
if (app_handlers().empty()) |
return GCMClient::UNKNOWN_ERROR; |
- // TODO(jianli): To be removed when sign-in enforcement is dropped. |
if (!signed_in_ && !GCMDriver::IsAllowedForAllUsers()) |
return GCMClient::NOT_SIGNED_IN; |