Revert r196089 "Add default values for Latin script font prefs."
[chromium-blink-merge.git] / chrome / browser / signin / about_signin_internals_factory.cc
blob98f012836af89d8d999c61d2e362b22acf20ce90
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/signin/about_signin_internals_factory.h"
7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/profiles/profile_dependency_manager.h"
9 #include "chrome/browser/signin/about_signin_internals.h"
10 #include "chrome/browser/signin/signin_internals_util.h"
11 #include "chrome/browser/signin/token_service_factory.h"
12 #include "chrome/common/pref_names.h"
13 #include "components/user_prefs/pref_registry_syncable.h"
14 #include "google_apis/gaia/gaia_constants.h"
16 using namespace signin_internals_util;
18 AboutSigninInternalsFactory::AboutSigninInternalsFactory()
19 : ProfileKeyedServiceFactory("AboutSigninInternals",
20 ProfileDependencyManager::GetInstance()) {
21 DependsOn(SigninManagerFactory::GetInstance());
22 DependsOn(TokenServiceFactory::GetInstance());
25 AboutSigninInternalsFactory::~AboutSigninInternalsFactory() {}
27 // static
28 AboutSigninInternals* AboutSigninInternalsFactory::GetForProfile(
29 Profile* profile) {
30 return static_cast<AboutSigninInternals*>(
31 GetInstance()->GetServiceForProfile(profile, true));
34 // static
35 AboutSigninInternalsFactory* AboutSigninInternalsFactory::GetInstance() {
36 return Singleton<AboutSigninInternalsFactory>::get();
39 void AboutSigninInternalsFactory::RegisterUserPrefs(
40 user_prefs::PrefRegistrySyncable* user_prefs) {
41 // SigninManager information for about:signin-internals.
42 for (int i = UNTIMED_FIELDS_BEGIN; i < UNTIMED_FIELDS_END; ++i) {
43 const std::string pref_path = SigninStatusFieldToString(
44 static_cast<UntimedSigninStatusField>(i));
45 user_prefs->RegisterStringPref(
46 pref_path.c_str(),
47 std::string(),
48 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
50 for (int i = TIMED_FIELDS_BEGIN; i < TIMED_FIELDS_END; ++i) {
51 const std::string value = SigninStatusFieldToString(
52 static_cast<TimedSigninStatusField>(i)) + ".value";
53 const std::string time = SigninStatusFieldToString(
54 static_cast<TimedSigninStatusField>(i)) + ".time";
55 user_prefs->RegisterStringPref(
56 value.c_str(),
57 std::string(),
58 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
59 user_prefs->RegisterStringPref(
60 time.c_str(),
61 std::string(),
62 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
64 // TokenService information for about:signin-internals.
65 for (size_t i = 0; i < kNumTokenPrefs; i++) {
66 const std::string pref = TokenPrefPath(kTokenPrefsArray[i]);
67 const std::string value = pref + ".value";
68 const std::string status = pref + ".status";
69 const std::string time = pref + ".time";
70 const std::string time_internal = pref + ".time_internal";
71 user_prefs->RegisterStringPref(
72 value.c_str(),
73 std::string(),
74 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
75 user_prefs->RegisterStringPref(
76 status.c_str(),
77 std::string(),
78 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
79 user_prefs->RegisterStringPref(
80 time.c_str(),
81 std::string(),
82 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
83 user_prefs->RegisterInt64Pref(
84 time_internal.c_str(),
86 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
90 ProfileKeyedService* AboutSigninInternalsFactory::BuildServiceInstanceFor(
91 content::BrowserContext* profile) const {
92 AboutSigninInternals* service = new AboutSigninInternals();
93 service->Initialize(static_cast<Profile*>(profile));
94 return service;