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

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

Issue 1972033002: Simplify some old avatar menu button code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reinstate ash browser test fix Created 4 years, 7 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/BUILD.gn ('k') | chrome/browser/ui/cocoa/profiles/profile_menu_controller.mm » ('j') | 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 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 imageTitleSpacing:kImageTitleSpacing 1915 imageTitleSpacing:kImageTitleSpacing
1916 backgroundColor:GetDialogBackgroundColor()]); 1916 backgroundColor:GetDialogBackgroundColor()]);
1917 1917
1918 NSString* title = base::SysUTF16ToNSString( 1918 NSString* title = base::SysUTF16ToNSString(
1919 profiles::GetProfileSwitcherTextForItem(item)); 1919 profiles::GetProfileSwitcherTextForItem(item));
1920 [profileButton setTitle:title]; 1920 [profileButton setTitle:title];
1921 1921
1922 // Use the low-res, small default avatars in the fast user switcher, like 1922 // Use the low-res, small default avatars in the fast user switcher, like
1923 // we do in the menu bar. 1923 // we do in the menu bar.
1924 gfx::Image itemIcon; 1924 gfx::Image itemIcon;
1925 bool isRectangle; 1925 AvatarMenu::GetImageForMenuButton(item.profile_path, &itemIcon);
1926 AvatarMenu::GetImageForMenuButton(item.profile_path, &itemIcon, &isRectangle);
1927 1926
1928 [profileButton setDefaultImage:CreateProfileImage( 1927 [profileButton setDefaultImage:CreateProfileImage(
1929 itemIcon, kSmallImageSide).ToNSImage()]; 1928 itemIcon, kSmallImageSide).ToNSImage()];
1930 [profileButton setImagePosition:NSImageLeft]; 1929 [profileButton setImagePosition:NSImageLeft];
1931 [profileButton setAlignment:NSLeftTextAlignment]; 1930 [profileButton setAlignment:NSLeftTextAlignment];
1932 [profileButton setBordered:NO]; 1931 [profileButton setBordered:NO];
1933 [profileButton setTag:itemIndex]; 1932 [profileButton setTag:itemIndex];
1934 [profileButton setTarget:self]; 1933 [profileButton setTarget:self];
1935 [profileButton setAction:@selector(switchToProfile:)]; 1934 [profileButton setAction:@selector(switchToProfile:)];
1936 1935
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2398 } 2397 }
2399 2398
2400 - (bool)shouldShowGoIncognito { 2399 - (bool)shouldShowGoIncognito {
2401 bool incognitoAvailable = 2400 bool incognitoAvailable =
2402 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 2401 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
2403 IncognitoModePrefs::DISABLED; 2402 IncognitoModePrefs::DISABLED;
2404 return incognitoAvailable && !browser_->profile()->IsGuestSession(); 2403 return incognitoAvailable && !browser_->profile()->IsGuestSession();
2405 } 2404 }
2406 2405
2407 @end 2406 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/cocoa/profiles/profile_menu_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698