Index: chrome/browser/ui/cocoa/browser/avatar_button_controller.mm |
diff --git a/chrome/browser/ui/cocoa/browser/avatar_button_controller.mm b/chrome/browser/ui/cocoa/browser/avatar_button_controller.mm |
index 2cafa33998bd2031a3572c80ac78bb2d46398991..c93a41d5066280e9401d2426186c2f878b8ef0f9 100644 |
--- a/chrome/browser/ui/cocoa/browser/avatar_button_controller.mm |
+++ b/chrome/browser/ui/cocoa/browser/avatar_button_controller.mm |
@@ -8,11 +8,14 @@ |
#include "chrome/app/chrome_command_ids.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/command_updater.h" |
+#include "chrome/browser/managed_mode/managed_user_service.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/profiles/profile_info_cache.h" |
#include "chrome/browser/profiles/profile_info_util.h" |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/browser/profiles/profile_metrics.h" |
+#include "chrome/browser/themes/theme_properties.h" |
+#include "chrome/browser/themes/theme_service.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/browser_commands.h" |
#include "chrome/browser/ui/browser_window.h" |
@@ -126,7 +129,8 @@ const CGFloat kMenuYOffsetAdjust = 1.0; |
[self setView:button]; |
- if (browser_->profile()->IsOffTheRecord()) { |
+ Profile* profile = browser_->profile(); |
+ if (profile->IsOffTheRecord()) { |
ResourceBundle& bundle = ResourceBundle::GetSharedInstance(); |
NSImage* otrIcon = bundle.GetNativeImageNamed(IDR_OTR_ICON).ToNSImage(); |
[self setImage:[self compositeImageWithShadow:otrIcon]]; |
@@ -135,6 +139,18 @@ const CGFloat kMenuYOffsetAdjust = 1.0; |
[self setButtonEnabled:YES]; |
observer_.reset(new AvatarButtonControllerInternal::Observer(self)); |
[self updateAvatar]; |
+ if (ManagedUserService::ProfileIsManaged(profile)) { |
+ label_.reset([[NSTextField alloc] |
+ initWithFrame:NSMakeRect(0, 0, CGFLOAT_MAX, CGFLOAT_MAX)]); |
Robert Sesek
2013/06/04 20:59:10
Since you're calling -sizeToFit, NSZeroRect is oka
Adrian Kuegel
2013/06/05 16:01:38
Done.
|
+ [label_ setEditable:NO]; |
+ [label_ setSelectable:NO]; |
+ [label_ setBezeled:NO]; |
+ [label_ setDrawsBackground:YES]; |
+ [label_ setFont:[NSFont labelFontOfSize:12.0]]; |
+ [label_ setStringValue: |
+ l10n_util::GetNSString(IDS_MANAGED_USER_AVATAR_LABEL)]; |
+ [label_ sizeToFit]; |
+ } |
} |
} |
return self; |
@@ -152,10 +168,25 @@ const CGFloat kMenuYOffsetAdjust = 1.0; |
return static_cast<NSButton*>(self.view); |
} |
+- (NSTextField*)labelView { |
+ return label_.get(); |
+} |
+ |
- (void)setImage:(NSImage*)image { |
[self.buttonView setImage:image]; |
} |
+- (void)updateColors:(ui::ThemeProvider*)themeProvider { |
+ if (themeProvider && label_.get()) { |
+ NSColor* backgroundColor = |
+ themeProvider->GetNSColor(ThemeProperties::COLOR_TOOLBAR, true); |
+ [label_ setBackgroundColor:backgroundColor]; |
+ NSColor* textColor = |
+ themeProvider->GetNSColor(ThemeProperties::COLOR_BOOKMARK_TEXT, true); |
+ [label_ setTextColor:textColor]; |
+ } |
+} |
+ |
- (void)showAvatarBubble { |
if (menuController_) |
return; |