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

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

Issue 890143005: [Mac] Allow "Enter" to activate the buttons in the new avatar bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: simplify code Created 5 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 | « no previous file | 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 <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 #import <Carbon/Carbon.h> // kVK_Return.
6 7
7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" 8 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h"
8 9
9 #include "base/mac/bundle_locations.h" 10 #include "base/mac/bundle_locations.h"
10 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 #include "base/strings/sys_string_conversions.h" 13 #include "base/strings/sys_string_conversions.h"
13 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/app/chrome_command_ids.h" 15 #include "chrome/app/chrome_command_ids.h"
15 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 } 783 }
783 784
784 - (void)setHoverState:(HoverState)state { 785 - (void)setHoverState:(HoverState)state {
785 [super setHoverState:state]; 786 [super setHoverState:state];
786 bool isHighlighted = ([self hoverState] != kHoverStateNone); 787 bool isHighlighted = ([self hoverState] != kHoverStateNone);
787 788
788 NSColor* backgroundColor = isHighlighted ? hoverColor_ : backgroundColor_; 789 NSColor* backgroundColor = isHighlighted ? hoverColor_ : backgroundColor_;
789 [[self cell] setBackgroundColor:backgroundColor]; 790 [[self cell] setBackgroundColor:backgroundColor];
790 } 791 }
791 792
793 -(void)keyDown:(NSEvent*)event {
794 // Since there is no default button in the bubble, it is safe to activate
795 // all buttons on Enter as well, and be consistent with the Windows
796 // implementation.
797 if ([event keyCode] == kVK_Return)
798 [self performClick:self];
799 else
800 [super keyDown:event];
801 }
802
792 - (BOOL)canBecomeKeyView { 803 - (BOOL)canBecomeKeyView {
793 return YES; 804 return YES;
794 } 805 }
795 806
796 @end 807 @end
797 808
798 // A custom view with the given background color. 809 // A custom view with the given background color.
799 @interface BackgroundColorView : NSView { 810 @interface BackgroundColorView : NSView {
800 @private 811 @private
801 base::scoped_nsobject<NSColor> backgroundColor_; 812 base::scoped_nsobject<NSColor> backgroundColor_;
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
2259 } 2270 }
2260 2271
2261 - (bool)shouldShowGoIncognito { 2272 - (bool)shouldShowGoIncognito {
2262 bool incognitoAvailable = 2273 bool incognitoAvailable =
2263 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 2274 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
2264 IncognitoModePrefs::DISABLED; 2275 IncognitoModePrefs::DISABLED;
2265 return incognitoAvailable && !browser_->profile()->IsGuestSession(); 2276 return incognitoAvailable && !browser_->profile()->IsGuestSession();
2266 } 2277 }
2267 2278
2268 @end 2279 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698