Index: chrome/browser/ui/sync/one_click_signin_helper.cc |
diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc |
index 5fc58e462f5d4534127997d383b77963e7c79d43..1d7bb192d0a755bb8831ee2dcc5713b6d7060681 100644 |
--- a/chrome/browser/ui/sync/one_click_signin_helper.cc |
+++ b/chrome/browser/ui/sync/one_click_signin_helper.cc |
@@ -739,8 +739,10 @@ bool OneClickSigninHelper::CanOffer(content::WebContents* web_contents, |
string16 email16 = UTF8ToUTF16(email); |
ProfileInfoCache& cache = manager->GetProfileInfoCache(); |
- for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { |
- if (email16 == cache.GetUserNameOfProfileAtIndex(i)) { |
+ const std::vector<ProfileInfoEntry> entries(cache.GetProfilesSortedByName()); |
+ for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin(); |
+ it != entries.end(); ++it) { |
+ if (email16 == it->user_name()) { |
if (error_message) { |
error_message->assign( |
l10n_util::GetStringUTF8(IDS_SYNC_USER_NAME_IN_USE_ERROR)); |