Chromium Code Reviews| Index: chrome/browser/ui/cocoa/browser_window_controller.mm |
| diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm |
| index 60a539c8347145784ac3aef4613ec2c28241d7a6..95c7bb981f0854ea53afb0dae9ac9886f4bba65c 100644 |
| --- a/chrome/browser/ui/cocoa/browser_window_controller.mm |
| +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm |
| @@ -35,6 +35,7 @@ |
| #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h" |
| #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" |
| +#import "chrome/browser/ui/cocoa/browser/avatar_label_controller.h" |
| #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
| #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
| #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
| @@ -80,6 +81,10 @@ |
| #include "ui/base/l10n/l10n_util_mac.h" |
| #include "ui/gfx/mac/scoped_ns_disable_screen_updates.h" |
| +#if defined(ENABLE_MANAGED_USERS) |
|
sail
2013/05/31 17:25:11
Can we get rid of this ifdef from the codebase bef
Adrian Kuegel
2013/05/31 20:28:16
Yes. I removed it, and it looks like it also works
sail
2013/05/31 20:41:44
Can't we just kill this ifdef though?
|
| +#include "chrome/browser/managed_mode/managed_user_service.h" |
| +#endif |
| + |
| using l10n_util::GetStringUTF16; |
| using l10n_util::GetNSStringWithFixup; |
| using l10n_util::GetNSStringFWithFixup; |
| @@ -528,6 +533,10 @@ enum { |
| return avatarButtonController_.get(); |
| } |
| +- (AvatarLabelController*)avatarLabelController { |
| + return avatarLabelController_.get(); |
| +} |
| + |
| - (void)destroyBrowser { |
| [NSApp removeWindowsItem:[self window]]; |
| @@ -1618,6 +1627,8 @@ enum { |
| // TODO(dmaclach): Instead of redrawing the whole window, views that care |
| // about the active window state should be registering for notifications. |
| [[self window] setViewsNeedDisplay:YES]; |
| + if (avatarLabelController_.get()) |
| + [avatarLabelController_ updateColors:[self themeProvider]]; |
| } |
| - (ui::ThemeProvider*)themeProvider { |
| @@ -1719,6 +1730,19 @@ enum { |
| // image to display based on the browser. |
| avatarButtonController_.reset( |
| [[AvatarButtonController alloc] initWithBrowser:browser_.get()]); |
| + if (browser_.get() && |
| + ManagedUserService::ProfileIsManaged(browser_->profile())) { |
| + avatarLabelController_.reset( |
| + [[AvatarLabelController alloc] init]); |
| + [avatarLabelController_ updateColors:[self themeProvider]]; |
| + NSView* view = [avatarLabelController_ view]; |
| + [view setNeedsDisplay:YES]; |
| + [view setHidden:![self shouldShowAvatar]]; |
| + |
| + // Install the view. |
| + [[[[self window] contentView] superview] addSubview:view]; |
| + } |
| + |
| NSView* view = [avatarButtonController_ view]; |
| [view setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; |
| [view setHidden:![self shouldShowAvatar]]; |