Chromium Code Reviews| Index: components/signin/core/browser/about_signin_internals.cc |
| diff --git a/components/signin/core/browser/about_signin_internals.cc b/components/signin/core/browser/about_signin_internals.cc |
| index a693d5e8004d0fe75ea7daf6f71c7ad3b09e61ad..ce22fe4f4044c04fb244e8d5b7d07ce1e9436917 100644 |
| --- a/components/signin/core/browser/about_signin_internals.cc |
| +++ b/components/signin/core/browser/about_signin_internals.cc |
| @@ -241,6 +241,7 @@ void AboutSigninInternals::NotifyObservers() { |
| scoped_ptr<base::DictionaryValue> signin_status_value = |
| signin_status_.ToValue(account_tracker_, signin_manager_, |
| + token_service_, |
| product_version); |
| // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is |
| @@ -256,6 +257,7 @@ void AboutSigninInternals::NotifyObservers() { |
| scoped_ptr<base::DictionaryValue> AboutSigninInternals::GetSigninStatus() { |
| return signin_status_.ToValue(account_tracker_, signin_manager_, |
| + token_service_, |
| client_->GetProductVersion()).Pass(); |
| } |
| @@ -407,8 +409,13 @@ AboutSigninInternals::TokenInfo::~TokenInfo() {} |
| bool AboutSigninInternals::TokenInfo::LessThan(const TokenInfo* a, |
| const TokenInfo* b) { |
| - return a->consumer_id < b->consumer_id || |
| - (a->consumer_id == b->consumer_id && a->scopes < b->scopes); |
| + if (a->request_time == b->request_time) { |
| + if (a->consumer_id == b->consumer_id) { |
| + return a->scopes < b->scopes; |
| + } |
| + return a->consumer_id < b->consumer_id; |
| + } |
| + return a->request_time < b->request_time; |
| } |
| void AboutSigninInternals::TokenInfo::Invalidate() { removed_ = true; } |
| @@ -479,6 +486,7 @@ AboutSigninInternals::TokenInfo* AboutSigninInternals::SigninStatus::FindToken( |
| scoped_ptr<base::DictionaryValue> AboutSigninInternals::SigninStatus::ToValue( |
| AccountTrackerService* account_tracker, |
| SigninManagerBase* signin_manager, |
| + ProfileOAuth2TokenService* token_service, |
| const std::string& product_version) { |
| // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is |
| // fixed. |
| @@ -588,5 +596,22 @@ scoped_ptr<base::DictionaryValue> AboutSigninInternals::SigninStatus::ToValue( |
| } |
| } |
| + base::ListValue* account_info = new base::ListValue(); |
| + signin_status->Set("account_info", account_info); |
|
James Hawkins
2015/04/01 16:19:44
nit: accountInfo, since this is ultimately a JS va
anthonyvd
2015/04/07 15:16:06
Done.
|
| + const std::vector<std::string>& accounts_in_token_service = |
| + token_service->GetAccounts(); |
| + |
| + if(accounts_in_token_service.size() == 0) { |
| + base::DictionaryValue* no_token_entry = new base::DictionaryValue(); |
| + no_token_entry->SetString("account_id", "No token in Token Service."); |
|
James Hawkins
2015/04/01 16:19:44
nit: accountId, since this is ultimately a JS vari
anthonyvd
2015/04/07 15:16:06
Done.
|
| + account_info->Append(no_token_entry); |
| + } |
| + |
| + for(const std::string& account_id : accounts_in_token_service) { |
| + base::DictionaryValue* entry = new base::DictionaryValue(); |
| + entry->SetString("account_id", account_id); |
|
James Hawkins
2015/04/01 16:19:44
nit: accountId, since this is ultimately a JS vari
anthonyvd
2015/04/07 15:16:06
Done.
|
| + account_info->Append(entry); |
| + } |
| + |
| return signin_status.Pass(); |
| } |