| Index: chrome/browser/ui/cocoa/browser/avatar_label_controller.mm
|
| diff --git a/chrome/browser/ui/cocoa/browser/avatar_label_controller.mm b/chrome/browser/ui/cocoa/browser/avatar_label_controller.mm
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..386f9b3abd807d9a5d3d742bab359e3b58d838c3
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/cocoa/browser/avatar_label_controller.mm
|
| @@ -0,0 +1,69 @@
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#import "chrome/browser/ui/cocoa/browser/avatar_label_controller.h"
|
| +
|
| +#include "base/memory/scoped_nsobject.h"
|
| +#include "base/strings/sys_string_conversions.h"
|
| +#include "chrome/app/chrome_command_ids.h"
|
| +#include "chrome/browser/browser_process.h"
|
| +#include "chrome/browser/command_updater.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"
|
| +#include "grit/generated_resources.h"
|
| +#include "grit/theme_resources.h"
|
| +#include "ui/base/l10n/l10n_util_mac.h"
|
| +
|
| +// Declare a 10.7+ private API.
|
| +// NSThemeFrame < NSTitledFrame < NSFrameView < NSView.
|
| +@interface NSView (NSThemeFrame)
|
| +- (void)_tileTitlebarAndRedisplay:(BOOL)redisplay;
|
| +@end
|
| +
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +
|
| +@implementation AvatarLabelController
|
| +
|
| +- (id)init {
|
| + if ((self = [super init])) {
|
| + scoped_nsobject<NSTextField> label([[NSTextField alloc]
|
| + initWithFrame:NSMakeRect(0, 0, CGFLOAT_MAX, CGFLOAT_MAX)]);
|
| + [label setEditable:NO];
|
| + [label setSelectable:NO];
|
| + [label setBezeled:NO];
|
| + [label setDrawsBackground:YES];
|
| + [label setBackgroundColor:[NSColor whiteColor]];
|
| + [label
|
| + setStringValue:l10n_util::GetNSString(IDS_MANAGED_USER_AVATAR_LABEL)];
|
| + [label sizeToFit];
|
| + [self setView:label];
|
| + }
|
| + return self;
|
| +}
|
| +
|
| +- (void)updateColors:(ui::ThemeProvider*)themeProvider {
|
| + if (themeProvider) {
|
| + NSTextField* view = [self labelView];
|
| + NSColor* backgroundColor =
|
| + themeProvider->GetNSColor(ThemeProperties::COLOR_TOOLBAR, true);
|
| + [view setBackgroundColor:backgroundColor];
|
| + NSColor* textColor =
|
| + themeProvider->GetNSColor(ThemeProperties::COLOR_BOOKMARK_TEXT, true);
|
| + [view setTextColor:textColor];
|
| + }
|
| +}
|
| +
|
| +- (NSTextField*)labelView {
|
| + return static_cast<NSTextField*>(self.view);
|
| +}
|
| +
|
| +@end
|
|
|