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

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

Issue 316863002: Rename "managed (mode|user)" to "supervised user" (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 | Annotate | Revision Log
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 <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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 [container addSubview:currentProfileAccountsView]; 1021 [container addSubview:currentProfileAccountsView];
1022 yOffset = NSMaxY([currentProfileAccountsView frame]); 1022 yOffset = NSMaxY([currentProfileAccountsView frame]);
1023 1023
1024 NSBox* accountsSeparator = [self separatorWithFrame: 1024 NSBox* accountsSeparator = [self separatorWithFrame:
1025 NSMakeRect(0, yOffset, kFixedMenuWidth, 0)]; 1025 NSMakeRect(0, yOffset, kFixedMenuWidth, 0)];
1026 [container addSubview:accountsSeparator]; 1026 [container addSubview:accountsSeparator];
1027 yOffset = NSMaxY([accountsSeparator frame]); 1027 yOffset = NSMaxY([accountsSeparator frame]);
1028 } 1028 }
1029 1029
1030 // For supervised users, add the disclaimer text. 1030 // For supervised users, add the disclaimer text.
1031 if (browser_->profile()->IsManaged()) { 1031 if (browser_->profile()->IsSupervised()) {
1032 yOffset += kSmallVerticalSpacing; 1032 yOffset += kSmallVerticalSpacing;
1033 NSView* disclaimerContainer = [self createSupervisedUserDisclaimerView]; 1033 NSView* disclaimerContainer = [self createSupervisedUserDisclaimerView];
1034 [disclaimerContainer setFrameOrigin:NSMakePoint(0, yOffset)]; 1034 [disclaimerContainer setFrameOrigin:NSMakePoint(0, yOffset)];
1035 [container addSubview:disclaimerContainer]; 1035 [container addSubview:disclaimerContainer];
1036 yOffset = NSMaxY([disclaimerContainer frame]); 1036 yOffset = NSMaxY([disclaimerContainer frame]);
1037 yOffset += kSmallVerticalSpacing; 1037 yOffset += kSmallVerticalSpacing;
1038 1038
1039 NSBox* separator = 1039 NSBox* separator =
1040 [self separatorWithFrame:NSMakeRect(0, yOffset, kFixedMenuWidth, 0)]; 1040 [self separatorWithFrame:NSMakeRect(0, yOffset, kFixedMenuWidth, 0)];
1041 [container addSubview:separator]; 1041 [container addSubview:separator];
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 NSView* linksContainer = 1232 NSView* linksContainer =
1233 [self createCurrentProfileLinksForItem:item 1233 [self createCurrentProfileLinksForItem:item
1234 rect:NSMakeRect(xOffset, yOffset, 1234 rect:NSMakeRect(xOffset, yOffset,
1235 availableTextWidth, 1235 availableTextWidth,
1236 0)]; 1236 0)];
1237 [container addSubview:linksContainer]; 1237 [container addSubview:linksContainer];
1238 yOffset = NSMaxY([linksContainer frame]); 1238 yOffset = NSMaxY([linksContainer frame]);
1239 } 1239 }
1240 1240
1241 // Profile name, centered. 1241 // Profile name, centered.
1242 bool editingAllowed = !isGuestSession_ && !browser_->profile()->IsManaged(); 1242 bool editingAllowed = !isGuestSession_ &&
1243 !browser_->profile()->IsSupervised();
1243 base::scoped_nsobject<EditableProfileNameButton> profileName( 1244 base::scoped_nsobject<EditableProfileNameButton> profileName(
1244 [[EditableProfileNameButton alloc] 1245 [[EditableProfileNameButton alloc]
1245 initWithFrame:NSMakeRect(xOffset, yOffset, 1246 initWithFrame:NSMakeRect(xOffset, yOffset,
1246 availableTextWidth, 1247 availableTextWidth,
1247 kProfileButtonHeight) 1248 kProfileButtonHeight)
1248 profile:browser_->profile() 1249 profile:browser_->profile()
1249 profileName:base::SysUTF16ToNSString( 1250 profileName:base::SysUTF16ToNSString(
1250 profiles::GetAvatarNameForProfile(browser_->profile())) 1251 profiles::GetAvatarNameForProfile(browser_->profile()))
1251 editingAllowed:editingAllowed 1252 editingAllowed:editingAllowed
1252 withController:self]); 1253 withController:self]);
1253 1254
1254 [container addSubview:profileName]; 1255 [container addSubview:profileName];
1255 yOffset = NSMaxY([profileName frame]); 1256 yOffset = NSMaxY([profileName frame]);
1256 1257
1257 // Profile icon, centered. 1258 // Profile icon, centered.
1258 xOffset = (kFixedMenuWidth - kLargeImageSide) / 2; 1259 xOffset = (kFixedMenuWidth - kLargeImageSide) / 2;
1259 base::scoped_nsobject<EditableProfilePhoto> iconView( 1260 base::scoped_nsobject<EditableProfilePhoto> iconView(
1260 [[EditableProfilePhoto alloc] 1261 [[EditableProfilePhoto alloc]
1261 initWithFrame:NSMakeRect(xOffset, yOffset, 1262 initWithFrame:NSMakeRect(xOffset, yOffset,
1262 kLargeImageSide, kLargeImageSide) 1263 kLargeImageSide, kLargeImageSide)
1263 avatarMenu:avatarMenu_.get() 1264 avatarMenu:avatarMenu_.get()
1264 profileIcon:item.icon 1265 profileIcon:item.icon
1265 editingAllowed:!isGuestSession_ 1266 editingAllowed:!isGuestSession_
1266 withController:self]); 1267 withController:self]);
1267 1268
1268 [container addSubview:iconView]; 1269 [container addSubview:iconView];
1269 yOffset = NSMaxY([iconView frame]); 1270 yOffset = NSMaxY([iconView frame]);
1270 1271
1271 if (browser_->profile()->IsManaged()) { 1272 if (browser_->profile()->IsSupervised()) {
1272 base::scoped_nsobject<NSImageView> supervisedIcon( 1273 base::scoped_nsobject<NSImageView> supervisedIcon(
1273 [[NSImageView alloc] initWithFrame:NSZeroRect]); 1274 [[NSImageView alloc] initWithFrame:NSZeroRect]);
1274 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); 1275 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
1275 [supervisedIcon setImage:rb->GetNativeImageNamed( 1276 [supervisedIcon setImage:rb->GetNativeImageNamed(
1276 IDR_ICON_PROFILES_MENU_SUPERVISED).ToNSImage()]; 1277 IDR_ICON_PROFILES_MENU_SUPERVISED).ToNSImage()];
1277 NSSize size = [[supervisedIcon image] size]; 1278 NSSize size = [[supervisedIcon image] size];
1278 [supervisedIcon setFrameSize:size]; 1279 [supervisedIcon setFrameSize:size];
1279 NSRect parentFrame = [iconView frame]; 1280 NSRect parentFrame = [iconView frame];
1280 [supervisedIcon setFrameOrigin:NSMakePoint(NSMaxX(parentFrame) - size.width, 1281 [supervisedIcon setFrameOrigin:NSMakePoint(NSMaxX(parentFrame) - size.width,
1281 NSMinY(parentFrame))]; 1282 NSMinY(parentFrame))];
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 } 1364 }
1364 1365
1365 - (NSView*)createSupervisedUserDisclaimerView { 1366 - (NSView*)createSupervisedUserDisclaimerView {
1366 base::scoped_nsobject<NSView> container( 1367 base::scoped_nsobject<NSView> container(
1367 [[NSView alloc] initWithFrame:NSZeroRect]); 1368 [[NSView alloc] initWithFrame:NSZeroRect]);
1368 1369
1369 int yOffset = 0; 1370 int yOffset = 0;
1370 int availableTextWidth = kFixedMenuWidth - 2 * kHorizontalSpacing; 1371 int availableTextWidth = kFixedMenuWidth - 2 * kHorizontalSpacing;
1371 1372
1372 NSTextField* disclaimer = BuildLabel( 1373 NSTextField* disclaimer = BuildLabel(
1373 base::SysUTF16ToNSString(avatarMenu_->GetManagedUserInformation()), 1374 base::SysUTF16ToNSString(avatarMenu_->GetSupervisedUserInformation()),
1374 NSMakePoint(kHorizontalSpacing, yOffset), 1375 NSMakePoint(kHorizontalSpacing, yOffset),
1375 nil /* background_color */, 1376 nil /* background_color */,
1376 nil /* text_color */); 1377 nil /* text_color */);
1377 [disclaimer setFrameSize:NSMakeSize(availableTextWidth, 0)]; 1378 [disclaimer setFrameSize:NSMakeSize(availableTextWidth, 0)];
1378 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:disclaimer]; 1379 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:disclaimer];
1379 yOffset = NSMaxY([disclaimer frame]); 1380 yOffset = NSMaxY([disclaimer frame]);
1380 1381
1381 [container addSubview:disclaimer]; 1382 [container addSubview:disclaimer];
1382 [container setFrameSize:NSMakeSize(kFixedMenuWidth, yOffset)]; 1383 [container setFrameSize:NSMakeSize(kFixedMenuWidth, yOffset)];
1383 return container.autorelease(); 1384 return container.autorelease();
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 [button addSubview:deleteButton]; 1783 [button addSubview:deleteButton];
1783 return button.autorelease(); 1784 return button.autorelease();
1784 } 1785 }
1785 1786
1786 - (void)postActionPerformed:(ProfileMetrics::ProfileDesktopMenu)action { 1787 - (void)postActionPerformed:(ProfileMetrics::ProfileDesktopMenu)action {
1787 ProfileMetrics::LogProfileDesktopMenu(action, serviceType_); 1788 ProfileMetrics::LogProfileDesktopMenu(action, serviceType_);
1788 serviceType_ = signin::GAIA_SERVICE_TYPE_NONE; 1789 serviceType_ = signin::GAIA_SERVICE_TYPE_NONE;
1789 } 1790 }
1790 1791
1791 @end 1792 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698