Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Unified Diff: components/gcm_driver/gcm_driver_desktop.cc

Issue 653843003: [GCM] Start GCMChannelStatusSyncer when GCM is disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for GCM not reenabled after being disabled on the fly Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 ca1f45f8ffd3495d6cc1eb15002def2288901268..463c0620cc6f86d563cd974ccdd97f0eef77949a 100644
--- a/components/gcm_driver/gcm_driver_desktop.cc
+++ b/components/gcm_driver/gcm_driver_desktop.cc
@@ -427,8 +427,10 @@ void GCMDriverDesktop::RemoveAppHandler(const std::string& app_id) {
GCMDriver::RemoveAppHandler(app_id);
// Stops the GCM service when no app intends to consume it.
- if (app_handlers().empty())
+ if (app_handlers().empty()) {
Stop();
+ gcm_channel_status_syncer_->Stop();
+ }
}
void GCMDriverDesktop::AddConnectionObserver(GCMConnectionObserver* observer) {
@@ -467,8 +469,6 @@ void GCMDriverDesktop::Stop() {
if (!gcm_started_)
return;
- gcm_channel_status_syncer_->Stop();
-
RemoveCachedData();
io_thread_->PostTask(
@@ -641,8 +641,14 @@ GCMClient::Result GCMDriverDesktop::EnsureStarted() {
if (gcm_started_)
return GCMClient::SUCCESS;
- if (!gcm_enabled_)
+ if (!gcm_enabled_) {
+ // Poll for channel status in order to find out when it is re-enabled when
+ // GCM is currently disabled.
+ if (GCMDriver::IsAllowedForAllUsers())
+ gcm_channel_status_syncer_->EnsureStarted();
+
return GCMClient::GCM_DISABLED;
+ }
// Have any app requested the service?
if (app_handlers().empty())
« no previous file with comments | « components/gcm_driver/gcm_channel_status_syncer.cc ('k') | components/gcm_driver/gcm_driver_desktop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698