Chromium Code Reviews| Index: chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| index caac7e85b636c9820ddf40ac024d3837bbee4bf5..d2fbb4272d5b24c88cb7a75342c61408c3b1ebe7 100644 |
| --- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| +++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| @@ -4,6 +4,7 @@ |
| #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" |
| +#import <AppKit/NSEvent.h> |
|
Mark Mentovai
2017/02/06 19:39:18
We don’t do this in Chrome, we just #import the to
jlebel
2017/02/07 10:03:26
Yes, this import is not necessary. Sorry.
|
| #import <Carbon/Carbon.h> // kVK_Return. |
| #import <Cocoa/Cocoa.h> |
| #include <stddef.h> |
| @@ -1594,7 +1595,11 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| showLock = item.signed_in && |
| profiles::IsLockAvailable(browser_->profile()); |
| } else { |
| - [otherProfiles addObject:[self createOtherProfileView:i]]; |
| + NSButton* otherProfileView = [self createOtherProfileView:i]; |
| + if (!firstProfileView_) { |
| + firstProfileView_ = otherProfileView; |
| + } |
| + [otherProfiles addObject:otherProfileView]; |
| } |
| } |
| if (!currentProfileView) // Guest windows don't have an active profile. |
| @@ -2945,4 +2950,12 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| return incognitoAvailable && !browser_->profile()->IsGuestSession(); |
| } |
| +- (void)showWindow:(id)sender { |
| + [super showWindow:sender]; |
| + NSEvent *event = [[NSApplication sharedApplication] currentEvent]; |
| + if (firstProfileView_ && [event type] == NSKeyDown) { |
| + [[self window] makeFirstResponder:firstProfileView_]; |
| + } |
| +} |
| + |
| @end |