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 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1795 - (NSButton*)createOtherProfileView:(int)itemIndex { | 1795 - (NSButton*)createOtherProfileView:(int)itemIndex { |
1796 const AvatarMenu::Item& item = avatarMenu_->GetItemAt(itemIndex); | 1796 const AvatarMenu::Item& item = avatarMenu_->GetItemAt(itemIndex); |
1797 | 1797 |
1798 NSRect rect = NSMakeRect( | 1798 NSRect rect = NSMakeRect( |
1799 0, 0, kFixedMenuWidth, kBlueButtonHeight + kSmallVerticalSpacing); | 1799 0, 0, kFixedMenuWidth, kBlueButtonHeight + kSmallVerticalSpacing); |
1800 base::scoped_nsobject<BackgroundColorHoverButton> profileButton( | 1800 base::scoped_nsobject<BackgroundColorHoverButton> profileButton( |
1801 [[BackgroundColorHoverButton alloc] | 1801 [[BackgroundColorHoverButton alloc] |
1802 initWithFrame:rect | 1802 initWithFrame:rect |
1803 imageTitleSpacing:kImageTitleSpacing | 1803 imageTitleSpacing:kImageTitleSpacing |
1804 backgroundColor:GetDialogBackgroundColor()]); | 1804 backgroundColor:GetDialogBackgroundColor()]); |
1805 [profileButton setTitle:base::SysUTF16ToNSString(item.name)]; | 1805 |
1806 NSString* title; | |
1807 if (item.legacy_supervised) { | |
msw
2015/04/14 18:15:12
This general logic seems to be useful for profile_
Marc Treib
2015/04/15 07:47:11
Acknowledged.
| |
1808 title = l10n_util::GetNSStringF(IDS_SUPERVISED_USER_NEW_AVATAR_LABEL, | |
1809 item.name); | |
1810 } else if (item.child_account) { | |
1811 title = l10n_util::GetNSStringF(IDS_CHILD_AVATAR_LABEL, item.name); | |
1812 } else { | |
1813 title = base::SysUTF16ToNSString(item.name); | |
1814 } | |
1815 [profileButton setTitle:title]; | |
1806 | 1816 |
1807 // Use the low-res, small default avatars in the fast user switcher, like | 1817 // Use the low-res, small default avatars in the fast user switcher, like |
1808 // we do in the menu bar. | 1818 // we do in the menu bar. |
1809 gfx::Image itemIcon; | 1819 gfx::Image itemIcon; |
1810 bool isRectangle; | 1820 bool isRectangle; |
1811 AvatarMenu::GetImageForMenuButton(item.profile_path, &itemIcon, &isRectangle); | 1821 AvatarMenu::GetImageForMenuButton(item.profile_path, &itemIcon, &isRectangle); |
1812 | 1822 |
1813 [profileButton setDefaultImage:CreateProfileImage( | 1823 [profileButton setDefaultImage:CreateProfileImage( |
1814 itemIcon, kSmallImageSide).ToNSImage()]; | 1824 itemIcon, kSmallImageSide).ToNSImage()]; |
1815 [profileButton setImagePosition:NSImageLeft]; | 1825 [profileButton setImagePosition:NSImageLeft]; |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2308 } | 2318 } |
2309 | 2319 |
2310 - (bool)shouldShowGoIncognito { | 2320 - (bool)shouldShowGoIncognito { |
2311 bool incognitoAvailable = | 2321 bool incognitoAvailable = |
2312 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2322 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
2313 IncognitoModePrefs::DISABLED; | 2323 IncognitoModePrefs::DISABLED; |
2314 return incognitoAvailable && !browser_->profile()->IsGuestSession(); | 2324 return incognitoAvailable && !browser_->profile()->IsGuestSession(); |
2315 } | 2325 } |
2316 | 2326 |
2317 @end | 2327 @end |
OLD | NEW |