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