Commit 6ebb53be authored by akuegel@chromium.org's avatar akuegel@chromium.org

Hide the add new profile link for managed users.

Do not show the add new profile link if ShowAddNewProfileLink returns false.
Screenshot for a managed user:
https://docs.google.com/a/google.com/file/d/0BzMCIwDgeNezRG9ZLVVucW9MSDQ/edit?usp=sharing
Screenshot for a normal user:
https://docs.google.com/a/google.com/file/d/0BzMCIwDgeNezZDRWdlFxUzNJOTA/edit?usp=sharing

BUG=228736
TEST=Manual

Review URL: https://chromiumcodereview.appspot.com/12539002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194872 0039d316-1c4b-4281-b951-d872f2087c98
parent 4ec47e27
......@@ -169,13 +169,10 @@ const AvatarMenuModel::Item& AvatarMenuModel::GetItemAt(size_t index) {
bool AvatarMenuModel::ShouldShowAddNewProfileLink() const {
#if defined(ENABLE_MANAGED_USERS)
Profile* active_profile = NULL;
if (!browser_)
active_profile = ProfileManager::GetLastUsedProfile();
else
active_profile = browser_->profile();
return true;
ManagedUserService* service = ManagedUserServiceFactory::GetForProfile(
active_profile);
browser_->profile());
return !service->ProfileIsManaged();
#endif
return true;
......
......@@ -128,17 +128,21 @@ const CGFloat kLabelInset = 49.0;
// into the xib, and this gives a little more space to visually match.
CGFloat yOffset = kLinkSpacing;
// Since drawing happens bottom-up, start with the "New User" link.
NSButton* newButton = [self configureNewUserButton:yOffset];
[contentView addSubview:newButton];
yOffset += NSHeight([newButton frame]) + kVerticalSpacing;
NSBox* separator = [self separatorWithFrame:
NSMakeRect(10, yOffset, NSWidth([contentView frame]) - 20, 0)];
[separator setAutoresizingMask:NSViewWidthSizable];
[contentView addSubview:separator];
yOffset += NSHeight([separator frame]);
if (model_->ShouldShowAddNewProfileLink()) {
// Since drawing happens bottom-up, start with the "New User" link.
NSButton* newButton = [self configureNewUserButton:yOffset];
[contentView addSubview:newButton];
yOffset += NSHeight([newButton frame]) + kVerticalSpacing;
NSBox* separator = [self separatorWithFrame:
NSMakeRect(10, yOffset, NSWidth([contentView frame]) - 20, 0)];
[separator setAutoresizingMask:NSViewWidthSizable];
[contentView addSubview:separator];
yOffset += NSHeight([separator frame]);
} else {
yOffset = 7;
}
// Loop over the profiles in reverse, constructing the menu items.
CGFloat widthAdjust = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment