Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / profiles / gaia_info_update_service_factory.cc
blobce7dc12f8e5bea21b60c7a946c7f4dc3ec3b34f8
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/common/pref_names.h"
10 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
11 #include "components/user_prefs/pref_registry_syncable.h"
13 GAIAInfoUpdateServiceFactory::GAIAInfoUpdateServiceFactory()
14 : BrowserContextKeyedServiceFactory(
15 "GAIAInfoUpdateService",
16 BrowserContextDependencyManager::GetInstance()) {
19 GAIAInfoUpdateServiceFactory::~GAIAInfoUpdateServiceFactory() {}
21 // static
22 GAIAInfoUpdateService* GAIAInfoUpdateServiceFactory::GetForProfile(
23 Profile* profile) {
24 return static_cast<GAIAInfoUpdateService*>(
25 GetInstance()->GetServiceForBrowserContext(profile, true));
28 // static
29 GAIAInfoUpdateServiceFactory* GAIAInfoUpdateServiceFactory::GetInstance() {
30 return Singleton<GAIAInfoUpdateServiceFactory>::get();
33 BrowserContextKeyedService*
34 GAIAInfoUpdateServiceFactory::BuildServiceInstanceFor(
35 content::BrowserContext* context) const {
36 Profile* profile = static_cast<Profile*>(context);
37 if (!GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(profile))
38 return NULL;
39 return new GAIAInfoUpdateService(profile);
42 void GAIAInfoUpdateServiceFactory::RegisterProfilePrefs(
43 user_prefs::PrefRegistrySyncable* prefs) {
44 prefs->RegisterInt64Pref(prefs::kProfileGAIAInfoUpdateTime,
46 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
47 prefs->RegisterStringPref(prefs::kProfileGAIAInfoPictureURL,
48 std::string(),
49 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
52 bool GAIAInfoUpdateServiceFactory::ServiceIsNULLWhileTesting() const {
53 return true;