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

Unified Diff: chrome/browser/ui/views/profile_chooser_view.cc

Issue 128513002: Refactor the code that creates the list of secondary accounts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/profile_chooser_view.cc
diff --git a/chrome/browser/ui/views/profile_chooser_view.cc b/chrome/browser/ui/views/profile_chooser_view.cc
index 03a5fd3fb5cf816facae9f1bb6642239eda9bc85..595b46d570e62bca1e48cbe82aec5627d0f67797 100644
--- a/chrome/browser/ui/views/profile_chooser_view.cc
+++ b/chrome/browser/ui/views/profile_chooser_view.cc
@@ -791,21 +791,15 @@ views::View* ProfileChooserView::CreateCurrentProfileAccountsView(
std::string primary_account =
SigninManagerFactory::GetForProfile(profile)->GetAuthenticatedUsername();
DCHECK(!primary_account.empty());
- std::vector<std::string> accounts(
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile)->GetAccounts());
- DCHECK_EQ(1, std::count_if(accounts.begin(), accounts.end(),
- std::bind1st(std::equal_to<std::string>(),
- primary_account)));
-
- // The primary account should always be listed first. However, the vector
- // returned by ProfileOAuth2TokenService::GetAccounts() will contain the
- // primary account too. Ignore it when it appears later.
+ std::vector<std::string>accounts =
+ profiles::GetSecondaryAccountsForProfile(profile, primary_account);
+
+ // The primary account should always be listed first.
// TODO(rogerta): we still need to further differentiate the primary account
// from the others, so more work is likely required here: crbug.com/311124.
CreateAccountButton(layout, primary_account, true);
for (size_t i = 0; i < accounts.size(); ++i) {
sky 2014/01/08 21:00:15 nit: remove {}
noms (inactive) 2014/01/08 21:04:27 Eeek, oops. Done. On 2014/01/08 21:00:15, sky wrot
- if (primary_account != accounts[i])
- CreateAccountButton(layout, accounts[i], false);
+ CreateAccountButton(layout, accounts[i], false);
}
layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);

Powered by Google App Engine
This is Rietveld 408576698