| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/profiles/gaia_info_update_service_factory.h" | 5 #include "chrome/browser/profiles/gaia_info_update_service_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/gaia_info_update_service.h" | 7 #include "chrome/browser/profiles/gaia_info_update_service.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
| 10 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 10 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 11 #include "components/user_prefs/pref_registry_syncable.h" | 11 #include "components/user_prefs/pref_registry_syncable.h" |
| 12 | 12 |
| 13 GAIAInfoUpdateServiceFactory::GAIAInfoUpdateServiceFactory() | 13 GAIAInfoUpdateServiceFactory::GAIAInfoUpdateServiceFactory() |
| 14 : ProfileKeyedServiceFactory("GAIAInfoUpdateService", | 14 : BrowserContextKeyedServiceFactory("GAIAInfoUpdateService", |
| 15 ProfileDependencyManager::GetInstance()) { | 15 BrowserContextDependencyManager::GetInstance())
{ |
| 16 } | 16 } |
| 17 | 17 |
| 18 GAIAInfoUpdateServiceFactory::~GAIAInfoUpdateServiceFactory() {} | 18 GAIAInfoUpdateServiceFactory::~GAIAInfoUpdateServiceFactory() {} |
| 19 | 19 |
| 20 // static | 20 // static |
| 21 GAIAInfoUpdateService* GAIAInfoUpdateServiceFactory::GetForProfile( | 21 GAIAInfoUpdateService* GAIAInfoUpdateServiceFactory::GetForProfile( |
| 22 Profile* profile) { | 22 Profile* profile) { |
| 23 return static_cast<GAIAInfoUpdateService*>( | 23 return static_cast<GAIAInfoUpdateService*>( |
| 24 GetInstance()->GetServiceForProfile(profile, true)); | 24 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 // static | 27 // static |
| 28 GAIAInfoUpdateServiceFactory* GAIAInfoUpdateServiceFactory::GetInstance() { | 28 GAIAInfoUpdateServiceFactory* GAIAInfoUpdateServiceFactory::GetInstance() { |
| 29 return Singleton<GAIAInfoUpdateServiceFactory>::get(); | 29 return Singleton<GAIAInfoUpdateServiceFactory>::get(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 ProfileKeyedService* GAIAInfoUpdateServiceFactory::BuildServiceInstanceFor( | 32 BrowserContextKeyedService* GAIAInfoUpdateServiceFactory::BuildServiceInstanceFo
r( |
| 33 content::BrowserContext* context) const { | 33 content::BrowserContext* context) const { |
| 34 Profile* profile = static_cast<Profile*>(context); | 34 Profile* profile = static_cast<Profile*>(context); |
| 35 if (!GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(profile)) | 35 if (!GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(profile)) |
| 36 return NULL; | 36 return NULL; |
| 37 return new GAIAInfoUpdateService(profile); | 37 return new GAIAInfoUpdateService(profile); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void GAIAInfoUpdateServiceFactory::RegisterUserPrefs( | 40 void GAIAInfoUpdateServiceFactory::RegisterUserPrefs( |
| 41 user_prefs::PrefRegistrySyncable* prefs) { | 41 user_prefs::PrefRegistrySyncable* prefs) { |
| 42 prefs->RegisterInt64Pref(prefs::kProfileGAIAInfoUpdateTime, | 42 prefs->RegisterInt64Pref(prefs::kProfileGAIAInfoUpdateTime, |
| 43 0, | 43 0, |
| 44 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 44 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 45 prefs->RegisterStringPref(prefs::kProfileGAIAInfoPictureURL, | 45 prefs->RegisterStringPref(prefs::kProfileGAIAInfoPictureURL, |
| 46 std::string(), | 46 std::string(), |
| 47 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 47 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool GAIAInfoUpdateServiceFactory::ServiceIsNULLWhileTesting() const { | 50 bool GAIAInfoUpdateServiceFactory::ServiceIsNULLWhileTesting() const { |
| 51 return true; | 51 return true; |
| 52 } | 52 } |
| OLD | NEW |