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

Side by Side Diff: chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm

Issue 2708073002: Removing pre-material design menu setting. (Closed)
Patch Set: Removing header Created 3 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/profiles/avatar_button_controller.h" 5 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/app/vector_icons/vector_icons.h" 9 #include "chrome/app/vector_icons/vector_icons.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 NSRect frameAfterPadding = NSInsetRect(frame, kButtonExtraPadding, 0); 93 NSRect frameAfterPadding = NSInsetRect(frame, kButtonExtraPadding, 0);
94 [super drawInteriorWithFrame:frameAfterPadding inView:controlView]; 94 [super drawInteriorWithFrame:frameAfterPadding inView:controlView];
95 } 95 }
96 96
97 - (void)drawImage:(NSImage*)image 97 - (void)drawImage:(NSImage*)image
98 withFrame:(NSRect)frame 98 withFrame:(NSRect)frame
99 inView:(NSView*)controlView { 99 inView:(NSView*)controlView {
100 // The image used in the generic button case as well as the error icon both 100 // The image used in the generic button case as well as the error icon both
101 // need to be shifted down slightly to be centered correctly. 101 // need to be shifted down slightly to be centered correctly.
102 // TODO(noms): When the assets are fixed, remove this latter offset. 102 // TODO(noms): When the assets are fixed, remove this latter offset.
103 if (!hasError_ || switches::IsMaterialDesignUserMenu()) 103 frame = NSOffsetRect(frame, 0, 1);
104 frame = NSOffsetRect(frame, 0, 1);
105 [super drawImage:image withFrame:frame inView:controlView]; 104 [super drawImage:image withFrame:frame inView:controlView];
106 } 105 }
107 106
108 - (void)drawBezelWithFrame:(NSRect)frame 107 - (void)drawBezelWithFrame:(NSRect)frame
109 inView:(NSView*)controlView { 108 inView:(NSView*)controlView {
110 AvatarButton* button = base::mac::ObjCCastStrict<AvatarButton>(controlView); 109 AvatarButton* button = base::mac::ObjCCastStrict<AvatarButton>(controlView);
111 HoverState hoverState = [button hoverState]; 110 HoverState hoverState = [button hoverState];
112 111
113 NSColor* backgroundColor = nil; 112 NSColor* backgroundColor = nil;
114 if (hoverState == kHoverStateMouseDown || [button isActive]) { 113 if (hoverState == kHoverStateMouseDown || [button isActive]) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 base::scoped_nsobject<NSButtonCell> cell( 174 base::scoped_nsobject<NSButtonCell> cell(
176 [[CustomThemeButtonCell alloc] initWithThemedWindow:isThemedWindow_]); 175 [[CustomThemeButtonCell alloc] initWithThemedWindow:isThemedWindow_]);
177 176
178 [avatarButton setCell:cell.get()]; 177 [avatarButton setCell:cell.get()];
179 178
180 [avatarButton setWantsLayer:YES]; 179 [avatarButton setWantsLayer:YES];
181 [self setView:avatarButton]; 180 [self setView:avatarButton];
182 181
183 [avatarButton setBezelStyle:NSShadowlessSquareBezelStyle]; 182 [avatarButton setBezelStyle:NSShadowlessSquareBezelStyle];
184 [avatarButton setButtonType:NSMomentaryChangeButton]; 183 [avatarButton setButtonType:NSMomentaryChangeButton];
185 if (switches::IsMaterialDesignUserMenu()) 184 [[avatarButton cell] setHighlightsBy:NSNoCellMask];
186 [[avatarButton cell] setHighlightsBy:NSNoCellMask];
187 [avatarButton setBordered:YES]; 185 [avatarButton setBordered:YES];
188 186
189 if (cocoa_l10n_util::ShouldFlipWindowControlsInRTL()) 187 if (cocoa_l10n_util::ShouldFlipWindowControlsInRTL())
190 [avatarButton setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin]; 188 [avatarButton setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin];
191 else 189 else
192 [avatarButton setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; 190 [avatarButton setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin];
193 [avatarButton setTarget:self]; 191 [avatarButton setTarget:self];
194 [avatarButton setAction:@selector(buttonClicked:)]; 192 [avatarButton setAction:@selector(buttonClicked:)];
195 [avatarButton setRightAction:@selector(buttonClicked:)]; 193 [avatarButton setRightAction:@selector(buttonClicked:)];
196 194
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 342 }
345 343
346 - (void)bubbleWillClose:(NSNotification*)notif { 344 - (void)bubbleWillClose:(NSNotification*)notif {
347 AvatarButton* button = base::mac::ObjCCastStrict<AvatarButton>(button_); 345 AvatarButton* button = base::mac::ObjCCastStrict<AvatarButton>(button_);
348 [button setIsActive:NO]; 346 [button setIsActive:NO];
349 [self updateAvatarButtonAndLayoutParent:NO]; 347 [self updateAvatarButtonAndLayoutParent:NO];
350 [super bubbleWillClose:notif]; 348 [super bubbleWillClose:notif];
351 } 349 }
352 350
353 @end 351 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/avatar_button_error_controller.cc ('k') | chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698