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

Unified Diff: chrome/browser/ui/cocoa/browser/profile_chooser_controller.mm

Issue 149603009: [Mac] Sort the "other" profiles correctly in the new avatar bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 6 years, 10 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 | « no previous file | chrome/browser/ui/cocoa/browser/profile_chooser_controller_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/browser/profile_chooser_controller.mm
diff --git a/chrome/browser/ui/cocoa/browser/profile_chooser_controller.mm b/chrome/browser/ui/cocoa/browser/profile_chooser_controller.mm
index bd31c4e5d699bc15472b7cb993351497c3e8ea95..fa320aae4a7582c60c33186934750f6a7c19d69a 100644
--- a/chrome/browser/ui/cocoa/browser/profile_chooser_controller.mm
+++ b/chrome/browser/ui/cocoa/browser/profile_chooser_controller.mm
@@ -673,8 +673,9 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
base::scoped_nsobject<NSMutableArray> otherProfiles(
[[NSMutableArray alloc] init]);
- // Separate items into active and other profiles.
- for (size_t i = 0; i < avatarMenu_->GetNumberOfItems(); ++i) {
+ // Loop over the profiles in reverse, so that they are sorted by their
+ // y-coordinate, and separate them into active and "other" profiles.
+ for (int i = avatarMenu_->GetNumberOfItems() - 1; i >= 0; --i) {
const AvatarMenu::Item& item = avatarMenu_->GetItemAt(i);
if (item.active) {
currentProfileView = [self createCurrentProfileView:item];
@@ -701,7 +702,8 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
yOffset = NSMaxY([separator frame]) + kVerticalSpacing;
if (viewToDisplay == PROFILE_CHOOSER_VIEW) {
- // Other profiles switcher.
+ // Other profiles switcher. The profiles have already been sorted
+ // by their y-coordinate, so they can be added in the existing order.
for (NSView *otherProfileView in otherProfiles.get()) {
[otherProfileView setFrameOrigin:NSMakePoint(kHorizontalSpacing,
yOffset)];
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/browser/profile_chooser_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698