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

Side by Side Diff: chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm

Issue 2638853003: macOS: Setting focus to the first profile in profile switcher (Closed)
Patch Set: Removing useless import Created 3 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" 5 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h"
6 6
7 #import <Carbon/Carbon.h> // kVK_Return. 7 #import <Carbon/Carbon.h> // kVK_Return.
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 } else if (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) { 1587 } else if (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) {
1588 tutorialView = [self buildTutorialViewIfNeededForItem:item]; 1588 tutorialView = [self buildTutorialViewIfNeededForItem:item];
1589 } 1589 }
1590 currentProfileView = 1590 currentProfileView =
1591 switches::IsMaterialDesignUserMenu() 1591 switches::IsMaterialDesignUserMenu()
1592 ? [self createMaterialDesignCurrentProfileView:item] 1592 ? [self createMaterialDesignCurrentProfileView:item]
1593 : [self createCurrentProfileView:item]; 1593 : [self createCurrentProfileView:item];
1594 showLock = item.signed_in && 1594 showLock = item.signed_in &&
1595 profiles::IsLockAvailable(browser_->profile()); 1595 profiles::IsLockAvailable(browser_->profile());
1596 } else { 1596 } else {
1597 [otherProfiles addObject:[self createOtherProfileView:i]]; 1597 NSButton* otherProfileView = [self createOtherProfileView:i];
1598 if (!firstProfileView_) {
1599 firstProfileView_ = otherProfileView;
1600 }
1601 [otherProfiles addObject:otherProfileView];
1598 } 1602 }
1599 } 1603 }
1600 if (!currentProfileView) // Guest windows don't have an active profile. 1604 if (!currentProfileView) // Guest windows don't have an active profile.
1601 currentProfileView = [self createGuestProfileView]; 1605 currentProfileView = [self createGuestProfileView];
1602 1606
1603 // |yOffset| is the next position at which to draw in |container| 1607 // |yOffset| is the next position at which to draw in |container|
1604 // coordinates. Add a pixel offset so that the bottom option buttons don't 1608 // coordinates. Add a pixel offset so that the bottom option buttons don't
1605 // overlap the bubble's rounded corners. 1609 // overlap the bubble's rounded corners.
1606 CGFloat yOffset = 1; 1610 CGFloat yOffset = 1;
1607 1611
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after
2938 serviceType_ = signin::GAIA_SERVICE_TYPE_NONE; 2942 serviceType_ = signin::GAIA_SERVICE_TYPE_NONE;
2939 } 2943 }
2940 2944
2941 - (bool)shouldShowGoIncognito { 2945 - (bool)shouldShowGoIncognito {
2942 bool incognitoAvailable = 2946 bool incognitoAvailable =
2943 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 2947 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
2944 IncognitoModePrefs::DISABLED; 2948 IncognitoModePrefs::DISABLED;
2945 return incognitoAvailable && !browser_->profile()->IsGuestSession(); 2949 return incognitoAvailable && !browser_->profile()->IsGuestSession();
2946 } 2950 }
2947 2951
2952 - (void)showWindow:(id)sender {
2953 [super showWindow:sender];
2954 NSEvent *event = [[NSApplication sharedApplication] currentEvent];
2955 if (firstProfileView_ && [event type] == NSKeyDown) {
2956 [[self window] makeFirstResponder:firstProfileView_];
2957 }
2958 }
2959
2948 @end 2960 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698