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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_helper.cc

Issue 33753002: Sooper experimental refactoring of the profile info cache. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 1 month 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 "chrome/browser/ui/sync/one_click_signin_helper.h" 5 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 } 732 }
733 733
734 // If some profile, not just the current one, is already connected to this 734 // If some profile, not just the current one, is already connected to this
735 // account, don't show the infobar. 735 // account, don't show the infobar.
736 if (g_browser_process && !same_email) { 736 if (g_browser_process && !same_email) {
737 ProfileManager* manager = g_browser_process->profile_manager(); 737 ProfileManager* manager = g_browser_process->profile_manager();
738 if (manager) { 738 if (manager) {
739 string16 email16 = UTF8ToUTF16(email); 739 string16 email16 = UTF8ToUTF16(email);
740 ProfileInfoCache& cache = manager->GetProfileInfoCache(); 740 ProfileInfoCache& cache = manager->GetProfileInfoCache();
741 741
742 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { 742 const std::vector<ProfileInfoEntry> entries(cache.GetProfilesSortedByNam e());
743 if (email16 == cache.GetUserNameOfProfileAtIndex(i)) { 743 for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin();
744 it != entries.end(); ++it) {
745 if (email16 == it->user_name()) {
744 if (error_message) { 746 if (error_message) {
745 error_message->assign( 747 error_message->assign(
746 l10n_util::GetStringUTF8(IDS_SYNC_USER_NAME_IN_USE_ERROR)); 748 l10n_util::GetStringUTF8(IDS_SYNC_USER_NAME_IN_USE_ERROR));
747 } 749 }
748 return false; 750 return false;
749 } 751 }
750 } 752 }
751 } 753 }
752 } 754 }
753 755
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 // If the web contents is showing a blank page and not about to be closed, 1467 // If the web contents is showing a blank page and not about to be closed,
1466 // redirect to the NTP or apps page. 1468 // redirect to the NTP or apps page.
1467 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && 1469 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) &&
1468 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { 1470 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) {
1469 RedirectToNtpOrAppsPage( 1471 RedirectToNtpOrAppsPage(
1470 web_contents(), 1472 web_contents(),
1471 signin::GetSourceForPromoURL(original_continue_url_)); 1473 signin::GetSourceForPromoURL(original_continue_url_));
1472 } 1474 }
1473 } 1475 }
1474 } 1476 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_view_delegate.cc ('k') | chrome/browser/ui/views/avatar_menu_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698