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

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: alexei review 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
« no previous file with comments | « chrome/browser/ui/cocoa/browser/profile_chooser_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6c2e540b17468172080ae6f43e2a19b6246c2d8f 100644
--- a/chrome/browser/ui/views/profile_chooser_view.cc
+++ b/chrome/browser/ui/views/profile_chooser_view.cc
@@ -791,22 +791,16 @@ 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.
+ // from the others in the UI, so more work is likely required here:
+ // crbug.com/311124.
CreateAccountButton(layout, primary_account, true);
- for (size_t i = 0; i < accounts.size(); ++i) {
- if (primary_account != accounts[i])
- CreateAccountButton(layout, accounts[i], false);
- }
+ for (size_t i = 0; i < accounts.size(); ++i)
+ CreateAccountButton(layout, accounts[i], false);
layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
« no previous file with comments | « chrome/browser/ui/cocoa/browser/profile_chooser_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698