| 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 "components/signin/core/browser/about_signin_internals.h" | 5 #include "components/signin/core/browser/about_signin_internals.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 void AboutSigninInternals::RegisterPrefs( | 181 void AboutSigninInternals::RegisterPrefs( |
| 182 user_prefs::PrefRegistrySyncable* user_prefs) { | 182 user_prefs::PrefRegistrySyncable* user_prefs) { |
| 183 // SigninManager information for about:signin-internals. | 183 // SigninManager information for about:signin-internals. |
| 184 | 184 |
| 185 // TODO(rogerta): leaving untimed fields here for now because legacy | 185 // TODO(rogerta): leaving untimed fields here for now because legacy |
| 186 // profiles still have these prefs. In three or four version from M43 | 186 // profiles still have these prefs. In three or four version from M43 |
| 187 // we can probably remove them. | 187 // we can probably remove them. |
| 188 for (int i = UNTIMED_FIELDS_BEGIN; i < UNTIMED_FIELDS_END; ++i) { | 188 for (int i = UNTIMED_FIELDS_BEGIN; i < UNTIMED_FIELDS_END; ++i) { |
| 189 const std::string pref_path = | 189 const std::string pref_path = |
| 190 SigninStatusFieldToString(static_cast<UntimedSigninStatusField>(i)); | 190 SigninStatusFieldToString(static_cast<UntimedSigninStatusField>(i)); |
| 191 user_prefs->RegisterStringPref(pref_path.c_str(), std::string()); | 191 user_prefs->RegisterStringPref(pref_path, std::string()); |
| 192 } | 192 } |
| 193 | 193 |
| 194 for (int i = TIMED_FIELDS_BEGIN; i < TIMED_FIELDS_END; ++i) { | 194 for (int i = TIMED_FIELDS_BEGIN; i < TIMED_FIELDS_END; ++i) { |
| 195 const std::string value = | 195 const std::string value = |
| 196 SigninStatusFieldToString(static_cast<TimedSigninStatusField>(i)) + | 196 SigninStatusFieldToString(static_cast<TimedSigninStatusField>(i)) + |
| 197 ".value"; | 197 ".value"; |
| 198 const std::string time = | 198 const std::string time = |
| 199 SigninStatusFieldToString(static_cast<TimedSigninStatusField>(i)) + | 199 SigninStatusFieldToString(static_cast<TimedSigninStatusField>(i)) + |
| 200 ".time"; | 200 ".time"; |
| 201 user_prefs->RegisterStringPref(value.c_str(), std::string()); | 201 user_prefs->RegisterStringPref(value, std::string()); |
| 202 user_prefs->RegisterStringPref(time.c_str(), std::string()); | 202 user_prefs->RegisterStringPref(time, std::string()); |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| 206 void AboutSigninInternals::AddSigninObserver( | 206 void AboutSigninInternals::AddSigninObserver( |
| 207 AboutSigninInternals::Observer* observer) { | 207 AboutSigninInternals::Observer* observer) { |
| 208 signin_observers_.AddObserver(observer); | 208 signin_observers_.AddObserver(observer); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void AboutSigninInternals::RemoveSigninObserver( | 211 void AboutSigninInternals::RemoveSigninObserver( |
| 212 AboutSigninInternals::Observer* observer) { | 212 AboutSigninInternals::Observer* observer) { |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 new base::DictionaryValue()); | 459 new base::DictionaryValue()); |
| 460 token_info->SetString("service", consumer_id); | 460 token_info->SetString("service", consumer_id); |
| 461 | 461 |
| 462 std::string scopes_str; | 462 std::string scopes_str; |
| 463 for (OAuth2TokenService::ScopeSet::const_iterator it = scopes.begin(); | 463 for (OAuth2TokenService::ScopeSet::const_iterator it = scopes.begin(); |
| 464 it != scopes.end(); | 464 it != scopes.end(); |
| 465 ++it) { | 465 ++it) { |
| 466 scopes_str += *it + "<br/>"; | 466 scopes_str += *it + "<br/>"; |
| 467 } | 467 } |
| 468 token_info->SetString("scopes", scopes_str); | 468 token_info->SetString("scopes", scopes_str); |
| 469 token_info->SetString("request_time", GetTimeStr(request_time).c_str()); | 469 token_info->SetString("request_time", GetTimeStr(request_time)); |
| 470 | 470 |
| 471 if (removed_) { | 471 if (removed_) { |
| 472 token_info->SetString("status", "Token was revoked."); | 472 token_info->SetString("status", "Token was revoked."); |
| 473 } else if (!receive_time.is_null()) { | 473 } else if (!receive_time.is_null()) { |
| 474 if (error == GoogleServiceAuthError::AuthErrorNone()) { | 474 if (error == GoogleServiceAuthError::AuthErrorNone()) { |
| 475 bool token_expired = expiration_time < base::Time::Now(); | 475 bool token_expired = expiration_time < base::Time::Now(); |
| 476 std::string expiration_time_string = GetTimeStr(expiration_time); | 476 std::string expiration_time_string = GetTimeStr(expiration_time); |
| 477 if (expiration_time.is_null()) { | 477 if (expiration_time.is_null()) { |
| 478 token_expired = false; | 478 token_expired = false; |
| 479 expiration_time_string = "Expiration time not available"; | 479 expiration_time_string = "Expiration time not available"; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 } | 688 } |
| 689 | 689 |
| 690 for(const std::string& account_id : accounts_in_token_service) { | 690 for(const std::string& account_id : accounts_in_token_service) { |
| 691 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); | 691 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); |
| 692 entry->SetString("accountId", account_id); | 692 entry->SetString("accountId", account_id); |
| 693 account_info->Append(std::move(entry)); | 693 account_info->Append(std::move(entry)); |
| 694 } | 694 } |
| 695 | 695 |
| 696 return signin_status; | 696 return signin_status; |
| 697 } | 697 } |
| OLD | NEW |