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/signin/about_signin_internals_factory.h" | 5 #include "chrome/browser/signin/about_signin_internals_factory.h" |
6 | 6 |
7 #include "chrome/browser/prefs/pref_service.h" | 7 #include "chrome/browser/prefs/pref_service.h" |
8 #include "chrome/browser/profiles/profile_dependency_manager.h" | 8 #include "chrome/browser/profiles/profile_dependency_manager.h" |
9 #include "chrome/browser/signin/about_signin_internals.h" | 9 #include "chrome/browser/signin/about_signin_internals.h" |
10 #include "chrome/browser/signin/signin_internals_util.h" | 10 #include "chrome/browser/signin/signin_internals_util.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 Profile* profile) { | 28 Profile* profile) { |
29 return static_cast<AboutSigninInternals*>( | 29 return static_cast<AboutSigninInternals*>( |
30 GetInstance()->GetServiceForProfile(profile, true)); | 30 GetInstance()->GetServiceForProfile(profile, true)); |
31 } | 31 } |
32 | 32 |
33 // static | 33 // static |
34 AboutSigninInternalsFactory* AboutSigninInternalsFactory::GetInstance() { | 34 AboutSigninInternalsFactory* AboutSigninInternalsFactory::GetInstance() { |
35 return Singleton<AboutSigninInternalsFactory>::get(); | 35 return Singleton<AboutSigninInternalsFactory>::get(); |
36 } | 36 } |
37 | 37 |
38 void AboutSigninInternalsFactory::RegisterUserPrefs(PrefService* user_prefs) { | 38 void AboutSigninInternalsFactory::RegisterUserPrefs( |
| 39 PrefServiceSyncable* user_prefs) { |
39 // SigninManager information for about:signin-internals. | 40 // SigninManager information for about:signin-internals. |
40 for (int i = UNTIMED_FIELDS_BEGIN; i < UNTIMED_FIELDS_END; ++i) { | 41 for (int i = UNTIMED_FIELDS_BEGIN; i < UNTIMED_FIELDS_END; ++i) { |
41 const std::string pref_path = SigninStatusFieldToString( | 42 const std::string pref_path = SigninStatusFieldToString( |
42 static_cast<UntimedSigninStatusField>(i)); | 43 static_cast<UntimedSigninStatusField>(i)); |
43 user_prefs->RegisterStringPref(pref_path.c_str(), "", | 44 user_prefs->RegisterStringPref(pref_path.c_str(), "", |
44 PrefService::UNSYNCABLE_PREF); | 45 PrefServiceSyncable::UNSYNCABLE_PREF); |
45 } | 46 } |
46 for (int i = TIMED_FIELDS_BEGIN; i < TIMED_FIELDS_END; ++i) { | 47 for (int i = TIMED_FIELDS_BEGIN; i < TIMED_FIELDS_END; ++i) { |
47 const std::string value = SigninStatusFieldToString( | 48 const std::string value = SigninStatusFieldToString( |
48 static_cast<TimedSigninStatusField>(i)) + ".value"; | 49 static_cast<TimedSigninStatusField>(i)) + ".value"; |
49 const std::string time = SigninStatusFieldToString( | 50 const std::string time = SigninStatusFieldToString( |
50 static_cast<TimedSigninStatusField>(i)) + ".time"; | 51 static_cast<TimedSigninStatusField>(i)) + ".time"; |
51 user_prefs->RegisterStringPref(value.c_str(), "", | 52 user_prefs->RegisterStringPref(value.c_str(), "", |
52 PrefService::UNSYNCABLE_PREF); | 53 PrefServiceSyncable::UNSYNCABLE_PREF); |
53 user_prefs->RegisterStringPref(time.c_str(), "", | 54 user_prefs->RegisterStringPref(time.c_str(), "", |
54 PrefService::UNSYNCABLE_PREF); | 55 PrefServiceSyncable::UNSYNCABLE_PREF); |
55 } | 56 } |
56 // TokenService information for about:signin-internals. | 57 // TokenService information for about:signin-internals. |
57 for (size_t i = 0; i < kNumTokenPrefs; i++) { | 58 for (size_t i = 0; i < kNumTokenPrefs; i++) { |
58 const std::string pref = TokenPrefPath(kTokenPrefsArray[i]); | 59 const std::string pref = TokenPrefPath(kTokenPrefsArray[i]); |
59 const std::string value = pref + ".value"; | 60 const std::string value = pref + ".value"; |
60 const std::string status = pref + ".status"; | 61 const std::string status = pref + ".status"; |
61 const std::string time = pref + ".time"; | 62 const std::string time = pref + ".time"; |
62 user_prefs->RegisterStringPref(value.c_str(), "", | 63 user_prefs->RegisterStringPref(value.c_str(), "", |
63 PrefService::UNSYNCABLE_PREF); | 64 PrefServiceSyncable::UNSYNCABLE_PREF); |
64 user_prefs->RegisterStringPref(status.c_str(), "", | 65 user_prefs->RegisterStringPref(status.c_str(), "", |
65 PrefService::UNSYNCABLE_PREF); | 66 PrefServiceSyncable::UNSYNCABLE_PREF); |
66 user_prefs->RegisterStringPref(time.c_str(), "", | 67 user_prefs->RegisterStringPref(time.c_str(), "", |
67 PrefService::UNSYNCABLE_PREF); | 68 PrefServiceSyncable::UNSYNCABLE_PREF); |
68 } | 69 } |
69 } | 70 } |
70 | 71 |
71 ProfileKeyedService* AboutSigninInternalsFactory::BuildServiceInstanceFor( | 72 ProfileKeyedService* AboutSigninInternalsFactory::BuildServiceInstanceFor( |
72 Profile* profile) const { | 73 Profile* profile) const { |
73 AboutSigninInternals* service = new AboutSigninInternals(); | 74 AboutSigninInternals* service = new AboutSigninInternals(); |
74 service->Initialize(profile); | 75 service->Initialize(profile); |
75 return service; | 76 return service; |
76 } | 77 } |
OLD | NEW |