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

Unified Diff: chrome/browser/extensions/api/gcm/gcm_api.cc

Issue 165993005: [GCM] Make sure GCM checkout logic is invoked when the profile is signed out (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test 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
Index: chrome/browser/extensions/api/gcm/gcm_api.cc
diff --git a/chrome/browser/extensions/api/gcm/gcm_api.cc b/chrome/browser/extensions/api/gcm/gcm_api.cc
index a8a5be20d4d07d333fbb44ceb1b196262f64d172..ca57f8af9eff399d596e6390336646f32595c450 100644
--- a/chrome/browser/extensions/api/gcm/gcm_api.cc
+++ b/chrome/browser/extensions/api/gcm/gcm_api.cc
@@ -97,8 +97,14 @@ bool GcmApiFunction::RunImpl() {
}
bool GcmApiFunction::IsGcmApiEnabled() const {
- return gcm::GCMProfileService::IsGCMEnabled(
- Profile::FromBrowserContext(context()));
+ Profile* profile = Profile::FromBrowserContext(context());
+
+ // GCM is not supported in incognito mode.
+ if (profile->IsOffTheRecord())
+ return false;
+
+ return gcm::GCMProfileService::GetGCMEnabledState(profile) !=
+ gcm::GCMProfileService::ALWAYS_DISABLED;
}
gcm::GCMProfileService* GcmApiFunction::GCMProfileService() const {
« no previous file with comments | « no previous file | chrome/browser/extensions/api/gcm/gcm_apitest.cc » ('j') | chrome/browser/services/gcm/gcm_profile_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698