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

Unified Diff: chrome/browser/sync/profile_sync_service.cc

Issue 183013007: [GCM] Stop/restart GCM when the state is forced off/on (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch to land Created 6 years, 10 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
« no previous file with comments | « chrome/browser/services/gcm/gcm_profile_service_unittest.cc ('k') | google_apis/gcm/engine/gcm_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service.cc
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index 82435b86a9b9fcd5e3d1ceba3f370cc9e9a98c9b..1c65779a6437ded90b478ca9daf4f4d1d33a0d2e 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -29,6 +29,7 @@
#include "chrome/browser/net/chrome_cookie_notification_details.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/services/gcm/gcm_profile_service.h"
#include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
#include "chrome/browser/signin/about_signin_internals.h"
#include "chrome/browser/signin/about_signin_internals_factory.h"
@@ -995,7 +996,14 @@ void ProfileSyncService::OnExperimentsChanged(
profile()->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled,
experiments.gcm_channel_state ==
syncer::Experiments::ENABLED);
- gcm::GCMProfileServiceFactory::GetForProfile(profile());
+ gcm::GCMProfileService* gcm_profile_service =
+ gcm::GCMProfileServiceFactory::GetForProfile(profile());
+ if (gcm_profile_service) {
+ if (experiments.gcm_channel_state == syncer::Experiments::SUPPRESSED)
+ gcm_profile_service->Stop();
+ else
+ gcm_profile_service->Start();
+ }
} else {
profile()->GetPrefs()->ClearPref(prefs::kGCMChannelEnabled);
}
« no previous file with comments | « chrome/browser/services/gcm/gcm_profile_service_unittest.cc ('k') | google_apis/gcm/engine/gcm_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698