Cleanup: new common GetProfileSwitcherTextForItem for use on both Win and Mac
[chromium-blink-merge.git] / chrome / browser / profiles / gaia_info_update_service_factory.cc
bloba173d68c0018600cf7ee903e0ec23a0f85e7100d
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
3 // found in the LICENSE file.
5 #include "chrome/browser/profiles/gaia_info_update_service_factory.h"
7 #include "chrome/browser/profiles/gaia_info_update_service.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/signin/signin_manager_factory.h"
10 #include "chrome/common/pref_names.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12 #include "components/pref_registry/pref_registry_syncable.h"
14 GAIAInfoUpdateServiceFactory::GAIAInfoUpdateServiceFactory()
15 : BrowserContextKeyedServiceFactory(
16 "GAIAInfoUpdateService",
17 BrowserContextDependencyManager::GetInstance()) {
18 DependsOn(SigninManagerFactory::GetInstance());
21 GAIAInfoUpdateServiceFactory::~GAIAInfoUpdateServiceFactory() {}
23 // static
24 GAIAInfoUpdateService* GAIAInfoUpdateServiceFactory::GetForProfile(
25 Profile* profile) {
26 return static_cast<GAIAInfoUpdateService*>(
27 GetInstance()->GetServiceForBrowserContext(profile, true));
30 // static
31 GAIAInfoUpdateServiceFactory* GAIAInfoUpdateServiceFactory::GetInstance() {
32 return Singleton<GAIAInfoUpdateServiceFactory>::get();
35 KeyedService* GAIAInfoUpdateServiceFactory::BuildServiceInstanceFor(
36 content::BrowserContext* context) const {
37 Profile* profile = static_cast<Profile*>(context);
38 if (!GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(profile))
39 return NULL;
40 return new GAIAInfoUpdateService(profile);
43 void GAIAInfoUpdateServiceFactory::RegisterProfilePrefs(
44 user_prefs::PrefRegistrySyncable* prefs) {
45 prefs->RegisterInt64Pref(prefs::kProfileGAIAInfoUpdateTime,
47 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
48 prefs->RegisterStringPref(prefs::kProfileGAIAInfoPictureURL,
49 std::string(),
50 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
53 bool GAIAInfoUpdateServiceFactory::ServiceIsNULLWhileTesting() const {
54 return true;