| 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 "base/prefs/pref_service.h" | 7 #include "base/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 19 matching lines...) Expand all Loading... |
| 30 return static_cast<AboutSigninInternals*>( | 30 return static_cast<AboutSigninInternals*>( |
| 31 GetInstance()->GetServiceForProfile(profile, true)); | 31 GetInstance()->GetServiceForProfile(profile, true)); |
| 32 } | 32 } |
| 33 | 33 |
| 34 // static | 34 // static |
| 35 AboutSigninInternalsFactory* AboutSigninInternalsFactory::GetInstance() { | 35 AboutSigninInternalsFactory* AboutSigninInternalsFactory::GetInstance() { |
| 36 return Singleton<AboutSigninInternalsFactory>::get(); | 36 return Singleton<AboutSigninInternalsFactory>::get(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void AboutSigninInternalsFactory::RegisterUserPrefs( | 39 void AboutSigninInternalsFactory::RegisterUserPrefs( |
| 40 PrefRegistrySyncable* user_prefs) { | 40 user_prefs::PrefRegistrySyncable* user_prefs) { |
| 41 // SigninManager information for about:signin-internals. | 41 // SigninManager information for about:signin-internals. |
| 42 for (int i = UNTIMED_FIELDS_BEGIN; i < UNTIMED_FIELDS_END; ++i) { | 42 for (int i = UNTIMED_FIELDS_BEGIN; i < UNTIMED_FIELDS_END; ++i) { |
| 43 const std::string pref_path = SigninStatusFieldToString( | 43 const std::string pref_path = SigninStatusFieldToString( |
| 44 static_cast<UntimedSigninStatusField>(i)); | 44 static_cast<UntimedSigninStatusField>(i)); |
| 45 user_prefs->RegisterStringPref(pref_path.c_str(), | 45 user_prefs->RegisterStringPref( |
| 46 std::string(), | 46 pref_path.c_str(), |
| 47 PrefRegistrySyncable::UNSYNCABLE_PREF); | 47 std::string(), |
| 48 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 48 } | 49 } |
| 49 for (int i = TIMED_FIELDS_BEGIN; i < TIMED_FIELDS_END; ++i) { | 50 for (int i = TIMED_FIELDS_BEGIN; i < TIMED_FIELDS_END; ++i) { |
| 50 const std::string value = SigninStatusFieldToString( | 51 const std::string value = SigninStatusFieldToString( |
| 51 static_cast<TimedSigninStatusField>(i)) + ".value"; | 52 static_cast<TimedSigninStatusField>(i)) + ".value"; |
| 52 const std::string time = SigninStatusFieldToString( | 53 const std::string time = SigninStatusFieldToString( |
| 53 static_cast<TimedSigninStatusField>(i)) + ".time"; | 54 static_cast<TimedSigninStatusField>(i)) + ".time"; |
| 54 user_prefs->RegisterStringPref( | 55 user_prefs->RegisterStringPref( |
| 55 value.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); | 56 value.c_str(), |
| 57 std::string(), |
| 58 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 56 user_prefs->RegisterStringPref( | 59 user_prefs->RegisterStringPref( |
| 57 time.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); | 60 time.c_str(), |
| 61 std::string(), |
| 62 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 58 } | 63 } |
| 59 // TokenService information for about:signin-internals. | 64 // TokenService information for about:signin-internals. |
| 60 for (size_t i = 0; i < kNumTokenPrefs; i++) { | 65 for (size_t i = 0; i < kNumTokenPrefs; i++) { |
| 61 const std::string pref = TokenPrefPath(kTokenPrefsArray[i]); | 66 const std::string pref = TokenPrefPath(kTokenPrefsArray[i]); |
| 62 const std::string value = pref + ".value"; | 67 const std::string value = pref + ".value"; |
| 63 const std::string status = pref + ".status"; | 68 const std::string status = pref + ".status"; |
| 64 const std::string time = pref + ".time"; | 69 const std::string time = pref + ".time"; |
| 65 user_prefs->RegisterStringPref( | 70 user_prefs->RegisterStringPref( |
| 66 value.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); | 71 value.c_str(), |
| 72 std::string(), |
| 73 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 67 user_prefs->RegisterStringPref( | 74 user_prefs->RegisterStringPref( |
| 68 status.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); | 75 status.c_str(), |
| 76 std::string(), |
| 77 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 69 user_prefs->RegisterStringPref( | 78 user_prefs->RegisterStringPref( |
| 70 time.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); | 79 time.c_str(), |
| 80 std::string(), |
| 81 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 71 } | 82 } |
| 72 } | 83 } |
| 73 | 84 |
| 74 ProfileKeyedService* AboutSigninInternalsFactory::BuildServiceInstanceFor( | 85 ProfileKeyedService* AboutSigninInternalsFactory::BuildServiceInstanceFor( |
| 75 content::BrowserContext* profile) const { | 86 content::BrowserContext* profile) const { |
| 76 AboutSigninInternals* service = new AboutSigninInternals(); | 87 AboutSigninInternals* service = new AboutSigninInternals(); |
| 77 service->Initialize(static_cast<Profile*>(profile)); | 88 service->Initialize(static_cast<Profile*>(profile)); |
| 78 return service; | 89 return service; |
| 79 } | 90 } |
| OLD | NEW |