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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 15932008: Add managed user avatar menu for mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add unit test. Created 7 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "chrome/browser/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <numeric> 8 #include <numeric>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 } 1614 }
1615 1615
1616 - (void)onTabDetachedWithContents:(WebContents*)contents { 1616 - (void)onTabDetachedWithContents:(WebContents*)contents {
1617 [infoBarContainerController_ tabDetachedWithContents:contents]; 1617 [infoBarContainerController_ tabDetachedWithContents:contents];
1618 } 1618 }
1619 1619
1620 - (void)userChangedTheme { 1620 - (void)userChangedTheme {
1621 // TODO(dmaclach): Instead of redrawing the whole window, views that care 1621 // TODO(dmaclach): Instead of redrawing the whole window, views that care
1622 // about the active window state should be registering for notifications. 1622 // about the active window state should be registering for notifications.
1623 [[self window] setViewsNeedDisplay:YES]; 1623 [[self window] setViewsNeedDisplay:YES];
1624 if (avatarButtonController_.get())
1625 [avatarButtonController_ updateColors:[self themeProvider]];
1624 } 1626 }
1625 1627
1626 - (ui::ThemeProvider*)themeProvider { 1628 - (ui::ThemeProvider*)themeProvider {
1627 return ThemeServiceFactory::GetForProfile(browser_->profile()); 1629 return ThemeServiceFactory::GetForProfile(browser_->profile());
1628 } 1630 }
1629 1631
1630 - (ThemedWindowStyle)themedWindowStyle { 1632 - (ThemedWindowStyle)themedWindowStyle {
1631 ThemedWindowStyle style = 0; 1633 ThemedWindowStyle style = 0;
1632 if (browser_->profile()->IsOffTheRecord()) 1634 if (browser_->profile()->IsOffTheRecord())
1633 style |= THEMED_INCOGNITO; 1635 style |= THEMED_INCOGNITO;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 1717
1716 // If the browser is in incognito mode or has multi-profiles, install the image 1718 // If the browser is in incognito mode or has multi-profiles, install the image
1717 // view to decorate the window at the upper right. Use the same base y 1719 // view to decorate the window at the upper right. Use the same base y
1718 // coordinate as the tab strip. 1720 // coordinate as the tab strip.
1719 - (void)installAvatar { 1721 - (void)installAvatar {
1720 // Install the image into the badge view. Hide it for now; positioning and 1722 // Install the image into the badge view. Hide it for now; positioning and
1721 // sizing will be done by the layout code. The AvatarButton will choose which 1723 // sizing will be done by the layout code. The AvatarButton will choose which
1722 // image to display based on the browser. 1724 // image to display based on the browser.
1723 avatarButtonController_.reset( 1725 avatarButtonController_.reset(
1724 [[AvatarButtonController alloc] initWithBrowser:browser_.get()]); 1726 [[AvatarButtonController alloc] initWithBrowser:browser_.get()]);
1727 if ([avatarButtonController_ labelView])
1728 [avatarButtonController_ updateColors:[self themeProvider]];
1729
1725 NSView* view = [avatarButtonController_ view]; 1730 NSView* view = [avatarButtonController_ view];
1726 [view setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; 1731 [view setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin];
1727 [view setHidden:![self shouldShowAvatar]]; 1732 [view setHidden:![self shouldShowAvatar]];
1728 1733
1729 // Install the view. 1734 // Install the view.
1730 [[[[self window] contentView] superview] addSubview:view]; 1735 [[[[self window] contentView] superview] addSubview:view];
1731 } 1736 }
1732 1737
1733 // Called when we get a three-finger swipe. 1738 // Called when we get a three-finger swipe.
1734 - (void)swipeWithEvent:(NSEvent*)event { 1739 - (void)swipeWithEvent:(NSEvent*)event {
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 2237
2233 - (BOOL)supportsBookmarkBar { 2238 - (BOOL)supportsBookmarkBar {
2234 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2239 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2235 } 2240 }
2236 2241
2237 - (BOOL)isTabbedWindow { 2242 - (BOOL)isTabbedWindow {
2238 return browser_->is_type_tabbed(); 2243 return browser_->is_type_tabbed();
2239 } 2244 }
2240 2245
2241 @end // @implementation BrowserWindowController(WindowType) 2246 @end // @implementation BrowserWindowController(WindowType)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698