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 | 6 |
7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" | 7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" |
8 | 8 |
9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 NSView* linksContainer = | 1172 NSView* linksContainer = |
1173 [self createCurrentProfileLinksForItem:item | 1173 [self createCurrentProfileLinksForItem:item |
1174 rect:NSMakeRect(xOffset, yOffset, | 1174 rect:NSMakeRect(xOffset, yOffset, |
1175 availableTextWidth, | 1175 availableTextWidth, |
1176 0)]; | 1176 0)]; |
1177 [container addSubview:linksContainer]; | 1177 [container addSubview:linksContainer]; |
1178 yOffset = NSMaxY([linksContainer frame]); | 1178 yOffset = NSMaxY([linksContainer frame]); |
1179 } | 1179 } |
1180 | 1180 |
1181 // Profile name, centered. | 1181 // Profile name, centered. |
| 1182 bool editingAllowed = !isGuestSession_ && !browser_->profile()->IsManaged(); |
1182 base::scoped_nsobject<EditableProfileNameButton> profileName( | 1183 base::scoped_nsobject<EditableProfileNameButton> profileName( |
1183 [[EditableProfileNameButton alloc] | 1184 [[EditableProfileNameButton alloc] |
1184 initWithFrame:NSMakeRect(xOffset, yOffset, | 1185 initWithFrame:NSMakeRect(xOffset, yOffset, |
1185 availableTextWidth, | 1186 availableTextWidth, |
1186 kProfileButtonHeight) | 1187 kProfileButtonHeight) |
1187 profile:browser_->profile() | 1188 profile:browser_->profile() |
1188 profileName:base::SysUTF16ToNSString( | 1189 profileName:base::SysUTF16ToNSString( |
1189 profiles::GetAvatarNameForProfile(browser_->profile())) | 1190 profiles::GetAvatarNameForProfile(browser_->profile())) |
1190 editingAllowed:!isGuestSession_]); | 1191 editingAllowed:editingAllowed]); |
1191 | 1192 |
1192 [container addSubview:profileName]; | 1193 [container addSubview:profileName]; |
1193 yOffset = NSMaxY([profileName frame]); | 1194 yOffset = NSMaxY([profileName frame]); |
1194 | 1195 |
1195 // Profile icon, centered. | 1196 // Profile icon, centered. |
1196 xOffset = (kFixedMenuWidth - kLargeImageSide) / 2; | 1197 xOffset = (kFixedMenuWidth - kLargeImageSide) / 2; |
1197 base::scoped_nsobject<EditableProfilePhoto> iconView( | 1198 base::scoped_nsobject<EditableProfilePhoto> iconView( |
1198 [[EditableProfilePhoto alloc] | 1199 [[EditableProfilePhoto alloc] |
1199 initWithFrame:NSMakeRect(xOffset, yOffset, | 1200 initWithFrame:NSMakeRect(xOffset, yOffset, |
1200 kLargeImageSide, kLargeImageSide) | 1201 kLargeImageSide, kLargeImageSide) |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1683 IDR_CLOSE_1_P).ToNSImage()]; | 1684 IDR_CLOSE_1_P).ToNSImage()]; |
1684 [deleteButton setTarget:self]; | 1685 [deleteButton setTarget:self]; |
1685 [deleteButton setAction:@selector(showAccountRemovalView:)]; | 1686 [deleteButton setAction:@selector(showAccountRemovalView:)]; |
1686 [deleteButton setTag:tag]; | 1687 [deleteButton setTag:tag]; |
1687 | 1688 |
1688 [button addSubview:deleteButton]; | 1689 [button addSubview:deleteButton]; |
1689 return button.autorelease(); | 1690 return button.autorelease(); |
1690 } | 1691 } |
1691 | 1692 |
1692 @end | 1693 @end |
OLD | NEW |