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

Side by Side Diff: chrome/browser/invalidation/invalidation_service_factory.cc

Issue 218903005: Make push messaging not create InvalidationService for login and guest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix telemetry unit tests. Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/invalidation/invalidation_service_factory.h" 5 #include "chrome/browser/invalidation/invalidation_service_factory.h"
6 6
7 #include "base/prefs/pref_registry.h" 7 #include "base/prefs/pref_registry.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/invalidation/fake_invalidation_service.h" 9 #include "chrome/browser/invalidation/fake_invalidation_service.h"
10 #include "chrome/browser/invalidation/invalidation_service.h" 10 #include "chrome/browser/invalidation/invalidation_service.h"
(...skipping 12 matching lines...) Expand all
23 #include "components/signin/core/browser/signin_manager.h" 23 #include "components/signin/core/browser/signin_manager.h"
24 #include "components/user_prefs/pref_registry_syncable.h" 24 #include "components/user_prefs/pref_registry_syncable.h"
25 25
26 #if defined(OS_ANDROID) 26 #if defined(OS_ANDROID)
27 #include "chrome/browser/invalidation/invalidation_controller_android.h" 27 #include "chrome/browser/invalidation/invalidation_controller_android.h"
28 #endif // defined(OS_ANDROID) 28 #endif // defined(OS_ANDROID)
29 29
30 #if defined(OS_CHROMEOS) 30 #if defined(OS_CHROMEOS)
31 #include "chrome/browser/chromeos/login/user_manager.h" 31 #include "chrome/browser/chromeos/login/user_manager.h"
32 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 32 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
33 #include "chrome/browser/chromeos/profiles/profile_helper.h"
33 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h " 34 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h "
34 #include "chrome/browser/invalidation/device_invalidation_auth_provider_chromeos .h" 35 #include "chrome/browser/invalidation/device_invalidation_auth_provider_chromeos .h"
35 #endif 36 #endif
36 37
37 namespace invalidation { 38 namespace invalidation {
38 39
39 // static 40 // static
40 InvalidationService* InvalidationServiceFactory::GetForProfile( 41 InvalidationService* InvalidationServiceFactory::GetForProfile(
41 Profile* profile) { 42 Profile* profile) {
43 #if defined(OS_CHROMEOS)
44 if (profile->IsSameProfile(chromeos::ProfileHelper::GetSigninProfile()) ||
45 (chromeos::UserManager::IsInitialized() &&
46 chromeos::UserManager::Get()->IsLoggedInAsGuest())) {
47 // The Chrome OS login and Chrome OS guest profiles do not have GAIA
48 // credentials and do not support invalidation.
49 return NULL;
50 }
51 #endif
42 return static_cast<InvalidationService*>( 52 return static_cast<InvalidationService*>(
43 GetInstance()->GetServiceForBrowserContext(profile, true)); 53 GetInstance()->GetServiceForBrowserContext(profile, true));
44 } 54 }
45 55
46 // static 56 // static
47 InvalidationServiceFactory* InvalidationServiceFactory::GetInstance() { 57 InvalidationServiceFactory* InvalidationServiceFactory::GetInstance() {
48 return Singleton<InvalidationServiceFactory>::get(); 58 return Singleton<InvalidationServiceFactory>::get();
49 } 59 }
50 60
51 InvalidationServiceFactory::InvalidationServiceFactory() 61 InvalidationServiceFactory::InvalidationServiceFactory()
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 void InvalidationServiceFactory::RegisterProfilePrefs( 120 void InvalidationServiceFactory::RegisterProfilePrefs(
111 user_prefs::PrefRegistrySyncable* registry) { 121 user_prefs::PrefRegistrySyncable* registry) {
112 registry->RegisterBooleanPref( 122 registry->RegisterBooleanPref(
113 prefs::kInvalidationServiceUseGCMChannel, 123 prefs::kInvalidationServiceUseGCMChannel,
114 false, 124 false,
115 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 125 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
116 InvalidatorStorage::RegisterProfilePrefs(registry); 126 InvalidatorStorage::RegisterProfilePrefs(registry);
117 } 127 }
118 128
119 } // namespace invalidation 129 } // namespace invalidation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698