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 #import <Carbon/Carbon.h> // kVK_Return. |
7 | 7 |
8 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" | 8 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" |
9 | 9 |
10 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 const AvatarMenu::Item& item = avatarMenu_->GetItemAt(itemIndex); | 1775 const AvatarMenu::Item& item = avatarMenu_->GetItemAt(itemIndex); |
1776 | 1776 |
1777 NSRect rect = NSMakeRect( | 1777 NSRect rect = NSMakeRect( |
1778 0, 0, kFixedMenuWidth, kBlueButtonHeight + kSmallVerticalSpacing); | 1778 0, 0, kFixedMenuWidth, kBlueButtonHeight + kSmallVerticalSpacing); |
1779 base::scoped_nsobject<BackgroundColorHoverButton> profileButton( | 1779 base::scoped_nsobject<BackgroundColorHoverButton> profileButton( |
1780 [[BackgroundColorHoverButton alloc] | 1780 [[BackgroundColorHoverButton alloc] |
1781 initWithFrame:rect | 1781 initWithFrame:rect |
1782 imageTitleSpacing:kImageTitleSpacing | 1782 imageTitleSpacing:kImageTitleSpacing |
1783 backgroundColor:GetDialogBackgroundColor()]); | 1783 backgroundColor:GetDialogBackgroundColor()]); |
1784 [profileButton setTitle:base::SysUTF16ToNSString(item.name)]; | 1784 [profileButton setTitle:base::SysUTF16ToNSString(item.name)]; |
| 1785 |
| 1786 // Use the low-res, small default avatars in the fast user switcher, like |
| 1787 // we do in the menu bar. |
| 1788 gfx::Image itemIcon; |
| 1789 bool isRectangle; |
| 1790 AvatarMenu::GetImageForMenuButton(item.profile_path, &itemIcon, &isRectangle); |
| 1791 |
1785 [profileButton setDefaultImage:CreateProfileImage( | 1792 [profileButton setDefaultImage:CreateProfileImage( |
1786 item.icon, kSmallImageSide).ToNSImage()]; | 1793 itemIcon, kSmallImageSide).ToNSImage()]; |
1787 [profileButton setImagePosition:NSImageLeft]; | 1794 [profileButton setImagePosition:NSImageLeft]; |
1788 [profileButton setAlignment:NSLeftTextAlignment]; | 1795 [profileButton setAlignment:NSLeftTextAlignment]; |
1789 [profileButton setBordered:NO]; | 1796 [profileButton setBordered:NO]; |
1790 [profileButton setTag:itemIndex]; | 1797 [profileButton setTag:itemIndex]; |
1791 [profileButton setTarget:self]; | 1798 [profileButton setTarget:self]; |
1792 [profileButton setAction:@selector(switchToProfile:)]; | 1799 [profileButton setAction:@selector(switchToProfile:)]; |
1793 | 1800 |
1794 return profileButton.autorelease(); | 1801 return profileButton.autorelease(); |
1795 } | 1802 } |
1796 | 1803 |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2270 } | 2277 } |
2271 | 2278 |
2272 - (bool)shouldShowGoIncognito { | 2279 - (bool)shouldShowGoIncognito { |
2273 bool incognitoAvailable = | 2280 bool incognitoAvailable = |
2274 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2281 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
2275 IncognitoModePrefs::DISABLED; | 2282 IncognitoModePrefs::DISABLED; |
2276 return incognitoAvailable && !browser_->profile()->IsGuestSession(); | 2283 return incognitoAvailable && !browser_->profile()->IsGuestSession(); |
2277 } | 2284 } |
2278 | 2285 |
2279 @end | 2286 @end |
OLD | NEW |