Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: components/signin/core/browser/about_signin_internals.cc

Issue 1162103003: ListAccounts will return the Gaia ID as well as the email of the account. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/hash.h" 8 #include "base/hash.h"
9 #include "base/i18n/time_formatting.h" 9 #include "base/i18n/time_formatting.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 const std::string& field_time = "") { 47 const std::string& field_time = "") {
48 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); 48 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue());
49 entry->SetString("label", field_name); 49 entry->SetString("label", field_name);
50 entry->SetString("status", field_status); 50 entry->SetString("status", field_status);
51 entry->SetString("time", field_time); 51 entry->SetString("time", field_time);
52 section_list->Append(entry.release()); 52 section_list->Append(entry.release());
53 } 53 }
54 54
55 void AddCookieEntry(base::ListValue* accounts_list, 55 void AddCookieEntry(base::ListValue* accounts_list,
56 const std::string& field_email, 56 const std::string& field_email,
57 const std::string& field_gaia_id,
57 const std::string& field_valid) { 58 const std::string& field_valid) {
58 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); 59 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue());
59 entry->SetString("email", field_email); 60 entry->SetString("email", field_email);
61 entry->SetString("gaia_id", field_gaia_id);
60 entry->SetString("valid", field_valid); 62 entry->SetString("valid", field_valid);
61 accounts_list->Append(entry.release()); 63 accounts_list->Append(entry.release());
62 } 64 }
63 65
64 std::string SigninStatusFieldToLabel(UntimedSigninStatusField field) { 66 std::string SigninStatusFieldToLabel(UntimedSigninStatusField field) {
65 switch (field) { 67 switch (field) {
66 case ACCOUNT_ID: 68 case ACCOUNT_ID:
67 return "Account Id"; 69 return "Account Id";
68 case GAIA_ID: 70 case GAIA_ID:
69 return "Gaia Id"; 71 return "Gaia Id";
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 const std::string& password) { 338 const std::string& password) {
337 NotifyObservers(); 339 NotifyObservers();
338 } 340 }
339 341
340 void AboutSigninInternals::GoogleSignedOut(const std::string& account_id, 342 void AboutSigninInternals::GoogleSignedOut(const std::string& account_id,
341 const std::string& username) { 343 const std::string& username) {
342 NotifyObservers(); 344 NotifyObservers();
343 } 345 }
344 346
345 void AboutSigninInternals::OnGaiaAccountsInCookieUpdated( 347 void AboutSigninInternals::OnGaiaAccountsInCookieUpdated(
346 const std::vector<std::pair<std::string, bool> >& gaia_accounts, 348 const std::vector<gaia::ListedAccount>& gaia_accounts,
347 const GoogleServiceAuthError& error) { 349 const GoogleServiceAuthError& error) {
348 if (error.state() != GoogleServiceAuthError::NONE) 350 if (error.state() != GoogleServiceAuthError::NONE)
349 return; 351 return;
350 352
351 base::DictionaryValue cookie_status; 353 base::DictionaryValue cookie_status;
352 base::ListValue* cookie_info = new base::ListValue(); 354 base::ListValue* cookie_info = new base::ListValue();
353 cookie_status.Set("cookie_info", cookie_info); 355 cookie_status.Set("cookie_info", cookie_info);
354 356
355 for (size_t i = 0; i < gaia_accounts.size(); ++i) { 357 for (size_t i = 0; i < gaia_accounts.size(); ++i) {
356 AddCookieEntry(cookie_info, 358 AddCookieEntry(cookie_info,
357 gaia_accounts[i].first, 359 gaia_accounts[i].raw_email,
358 gaia_accounts[i].second ? "Valid" : "Invalid"); 360 gaia_accounts[i].gaia_id,
361 gaia_accounts[i].valid ? "Valid" : "Invalid");
359 } 362 }
360 363
361 if (gaia_accounts.size() == 0) 364 if (gaia_accounts.size() == 0) {
362 AddCookieEntry(cookie_info, "No Accounts Present.", ""); 365 AddCookieEntry(cookie_info,
366 "No Accounts Present.",
367 std::string(),
368 std::string());
369 }
363 370
364 // Update the observers that the cookie's accounts are updated. 371 // Update the observers that the cookie's accounts are updated.
365 FOR_EACH_OBSERVER(AboutSigninInternals::Observer, 372 FOR_EACH_OBSERVER(AboutSigninInternals::Observer,
366 signin_observers_, 373 signin_observers_,
367 OnCookieAccountsFetched(&cookie_status)); 374 OnCookieAccountsFetched(&cookie_status));
368 } 375 }
369 376
370 AboutSigninInternals::TokenInfo::TokenInfo( 377 AboutSigninInternals::TokenInfo::TokenInfo(
371 const std::string& consumer_id, 378 const std::string& consumer_id,
372 const OAuth2TokenService::ScopeSet& scopes) 379 const OAuth2TokenService::ScopeSet& scopes)
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 } 599 }
593 600
594 for(const std::string& account_id : accounts_in_token_service) { 601 for(const std::string& account_id : accounts_in_token_service) {
595 base::DictionaryValue* entry = new base::DictionaryValue(); 602 base::DictionaryValue* entry = new base::DictionaryValue();
596 entry->SetString("accountId", account_id); 603 entry->SetString("accountId", account_id);
597 account_info->Append(entry); 604 account_info->Append(entry);
598 } 605 }
599 606
600 return signin_status.Pass(); 607 return signin_status.Pass();
601 } 608 }
OLDNEW
« no previous file with comments | « components/signin/core/browser/about_signin_internals.h ('k') | components/signin/core/browser/account_reconcilor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698