OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |