| 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 24 matching lines...) Expand all Loading... |
| 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 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(pref_path.c_str(), |
| 46 std::string(), |
| 46 PrefRegistrySyncable::UNSYNCABLE_PREF); | 47 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 47 } | 48 } |
| 48 for (int i = TIMED_FIELDS_BEGIN; i < TIMED_FIELDS_END; ++i) { | 49 for (int i = TIMED_FIELDS_BEGIN; i < TIMED_FIELDS_END; ++i) { |
| 49 const std::string value = SigninStatusFieldToString( | 50 const std::string value = SigninStatusFieldToString( |
| 50 static_cast<TimedSigninStatusField>(i)) + ".value"; | 51 static_cast<TimedSigninStatusField>(i)) + ".value"; |
| 51 const std::string time = SigninStatusFieldToString( | 52 const std::string time = SigninStatusFieldToString( |
| 52 static_cast<TimedSigninStatusField>(i)) + ".time"; | 53 static_cast<TimedSigninStatusField>(i)) + ".time"; |
| 53 user_prefs->RegisterStringPref(value.c_str(), "", | 54 user_prefs->RegisterStringPref( |
| 54 PrefRegistrySyncable::UNSYNCABLE_PREF); | 55 value.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 55 user_prefs->RegisterStringPref(time.c_str(), "", | 56 user_prefs->RegisterStringPref( |
| 56 PrefRegistrySyncable::UNSYNCABLE_PREF); | 57 time.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 57 } | 58 } |
| 58 // TokenService information for about:signin-internals. | 59 // TokenService information for about:signin-internals. |
| 59 for (size_t i = 0; i < kNumTokenPrefs; i++) { | 60 for (size_t i = 0; i < kNumTokenPrefs; i++) { |
| 60 const std::string pref = TokenPrefPath(kTokenPrefsArray[i]); | 61 const std::string pref = TokenPrefPath(kTokenPrefsArray[i]); |
| 61 const std::string value = pref + ".value"; | 62 const std::string value = pref + ".value"; |
| 62 const std::string status = pref + ".status"; | 63 const std::string status = pref + ".status"; |
| 63 const std::string time = pref + ".time"; | 64 const std::string time = pref + ".time"; |
| 64 user_prefs->RegisterStringPref(value.c_str(), "", | 65 user_prefs->RegisterStringPref( |
| 65 PrefRegistrySyncable::UNSYNCABLE_PREF); | 66 value.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 66 user_prefs->RegisterStringPref(status.c_str(), "", | 67 user_prefs->RegisterStringPref( |
| 67 PrefRegistrySyncable::UNSYNCABLE_PREF); | 68 status.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 68 user_prefs->RegisterStringPref(time.c_str(), "", | 69 user_prefs->RegisterStringPref( |
| 69 PrefRegistrySyncable::UNSYNCABLE_PREF); | 70 time.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 70 } | 71 } |
| 71 } | 72 } |
| 72 | 73 |
| 73 ProfileKeyedService* AboutSigninInternalsFactory::BuildServiceInstanceFor( | 74 ProfileKeyedService* AboutSigninInternalsFactory::BuildServiceInstanceFor( |
| 74 Profile* profile) const { | 75 Profile* profile) const { |
| 75 AboutSigninInternals* service = new AboutSigninInternals(); | 76 AboutSigninInternals* service = new AboutSigninInternals(); |
| 76 service->Initialize(profile); | 77 service->Initialize(profile); |
| 77 return service; | 78 return service; |
| 78 } | 79 } |
| OLD | NEW |