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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 117533002: [Mac] Redesign of the avatar menu button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
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 dac410f90fe45fd4635a59f9ce7667d3cb193214..78506f8c86dce2b66061a8e0ae12af320913fc86 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -22,6 +22,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/signin/signin_ui_util.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h"
@@ -36,6 +37,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_icon_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"
@@ -68,6 +70,7 @@
#include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
#include "chrome/browser/ui/window_sizer/window_sizer.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/profile_management_switches.h"
#include "chrome/common/url_constants.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/render_view_host.h"
@@ -1497,6 +1500,11 @@ enum {
return AvatarMenu::ShouldShowAvatarMenu();
}
+- (BOOL)shouldUseNewAvatarButton {
+ return switches::IsNewProfileManagement() &&
+ profiles::IsRegularOrGuestSession(browser_.get());
+}
+
- (BOOL)isBookmarkBarVisible {
return [bookmarkBarController_ isVisible];
}
@@ -1710,12 +1718,18 @@ enum {
// coordinate as the tab strip.
- (void)installAvatar {
// Install the image into the badge view. Hide it for now; positioning and
- // sizing will be done by the layout code. The AvatarButton will choose which
- // image to display based on the browser.
- avatarButtonController_.reset(
+ // sizing will be done by the layout code. The AvatarIcon will choose which
+ // image to display based on the browser. The AvatarButton will display
+ // the browser profile's name unless the browser is incognito.
+ NSView* view;
+ if ([self shouldUseNewAvatarButton]) {
+ avatarButtonController_.reset(
[[AvatarButtonController alloc] initWithBrowser:browser_.get()]);
-
- NSView* view = [avatarButtonController_ view];
+ } else {
+ avatarButtonController_.reset(
+ [[AvatarIconController alloc] initWithBrowser:browser_.get()]);
+ }
+ view = [avatarButtonController_ view];
[view setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin];
[view setHidden:![self shouldShowAvatar]];

Powered by Google App Engine
This is Rietveld 408576698