| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/profile_invalidation_provider_factory.h" | 5 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/prefs/pref_registry.h" | 8 #include "base/prefs/pref_registry.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/invalidation/ticl_profile_settings_provider.h" | 10 #include "chrome/browser/invalidation/ticl_profile_settings_provider.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 namespace invalidation { | 46 namespace invalidation { |
| 47 | 47 |
| 48 // static | 48 // static |
| 49 ProfileInvalidationProvider* ProfileInvalidationProviderFactory::GetForProfile( | 49 ProfileInvalidationProvider* ProfileInvalidationProviderFactory::GetForProfile( |
| 50 Profile* profile) { | 50 Profile* profile) { |
| 51 #if defined(OS_CHROMEOS) | 51 #if defined(OS_CHROMEOS) |
| 52 // Using ProfileHelper::GetSigninProfile() here would lead to an infinite loop | 52 // Using ProfileHelper::GetSigninProfile() here would lead to an infinite loop |
| 53 // when this method is called during the creation of the sign-in profile | 53 // when this method is called during the creation of the sign-in profile |
| 54 // itself. Using ProfileHelper::GetSigninProfileDir() is safe because it does | 54 // itself. Using ProfileHelper::GetSigninProfileDir() is safe because it does |
| 55 // not try to access the sign-in profile. | 55 // not try to access the sign-in profile. |
| 56 if (profile->GetPath() == chromeos::ProfileHelper::GetSigninProfileDir()|| | 56 if (profile->GetPath() == chromeos::ProfileHelper::GetSigninProfileDir() || |
| 57 (chromeos::UserManager::IsInitialized() && | 57 (chromeos::UserManager::IsInitialized() && |
| 58 chromeos::UserManager::Get()->IsLoggedInAsGuest())) { | 58 chromeos::GetUserManager()->IsLoggedInAsGuest())) { |
| 59 // The Chrome OS login and Chrome OS guest profiles do not have GAIA | 59 // The Chrome OS login and Chrome OS guest profiles do not have GAIA |
| 60 // credentials and do not support invalidation. | 60 // credentials and do not support invalidation. |
| 61 return NULL; | 61 return NULL; |
| 62 } | 62 } |
| 63 #endif | 63 #endif |
| 64 return static_cast<ProfileInvalidationProvider*>( | 64 return static_cast<ProfileInvalidationProvider*>( |
| 65 GetInstance()->GetServiceForBrowserContext(profile, true)); | 65 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // static | 68 // static |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 new InvalidationServiceAndroid(profile, | 104 new InvalidationServiceAndroid(profile, |
| 105 new InvalidationControllerAndroid()))); | 105 new InvalidationControllerAndroid()))); |
| 106 #else | 106 #else |
| 107 | 107 |
| 108 scoped_ptr<IdentityProvider> identity_provider; | 108 scoped_ptr<IdentityProvider> identity_provider; |
| 109 | 109 |
| 110 #if defined(OS_CHROMEOS) | 110 #if defined(OS_CHROMEOS) |
| 111 policy::BrowserPolicyConnectorChromeOS* connector = | 111 policy::BrowserPolicyConnectorChromeOS* connector = |
| 112 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 112 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 113 if (chromeos::UserManager::IsInitialized() && | 113 if (chromeos::UserManager::IsInitialized() && |
| 114 chromeos::UserManager::Get()->IsLoggedInAsKioskApp() && | 114 chromeos::GetUserManager()->IsLoggedInAsKioskApp() && |
| 115 connector->IsEnterpriseManaged()) { | 115 connector->IsEnterpriseManaged()) { |
| 116 identity_provider.reset(new chromeos::DeviceIdentityProvider( | 116 identity_provider.reset(new chromeos::DeviceIdentityProvider( |
| 117 chromeos::DeviceOAuth2TokenServiceFactory::Get())); | 117 chromeos::DeviceOAuth2TokenServiceFactory::Get())); |
| 118 } | 118 } |
| 119 #endif | 119 #endif |
| 120 | 120 |
| 121 if (!identity_provider) { | 121 if (!identity_provider) { |
| 122 identity_provider.reset(new ProfileIdentityProvider( | 122 identity_provider.reset(new ProfileIdentityProvider( |
| 123 SigninManagerFactory::GetForProfile(profile), | 123 SigninManagerFactory::GetForProfile(profile), |
| 124 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 124 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 142 void ProfileInvalidationProviderFactory::RegisterProfilePrefs( | 142 void ProfileInvalidationProviderFactory::RegisterProfilePrefs( |
| 143 user_prefs::PrefRegistrySyncable* registry) { | 143 user_prefs::PrefRegistrySyncable* registry) { |
| 144 registry->RegisterBooleanPref( | 144 registry->RegisterBooleanPref( |
| 145 prefs::kInvalidationServiceUseGCMChannel, | 145 prefs::kInvalidationServiceUseGCMChannel, |
| 146 false, | 146 false, |
| 147 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 147 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 148 InvalidatorStorage::RegisterProfilePrefs(registry); | 148 InvalidatorStorage::RegisterProfilePrefs(registry); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace invalidation | 151 } // namespace invalidation |
| OLD | NEW |