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

Unified Diff: chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm

Issue 2347283003: [Material][Mac] Adjust User Account Button (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
diff --git a/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm b/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
index 6163f015f1daf352ec8af7f7bcdc90c51664d6d1..86c4dad4ffe827fc88c0de2bc63dcdcd8d0acdb8 100644
--- a/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
+++ b/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
@@ -74,6 +74,9 @@ CGFloat ButtonExtraPadding() {
// Extra padding for the MD signed out avatar button.
const CGFloat kMaterialSignedOutWidthPadding = 2;
+// Kern value for the MD avatar button title.
+const CGFloat kMaterialTitleKern = 0.25;
+
} // namespace
// Button cell with a custom border given by a set of nine-patch image grids.
@@ -340,13 +343,28 @@ const CGFloat kMaterialSignedOutWidthPadding = 2;
[[NSMutableParagraphStyle alloc] init]);
[paragraphStyle setAlignment:NSLeftTextAlignment];
- base::scoped_nsobject<NSAttributedString> attributedTitle(
- [[NSAttributedString alloc]
- initWithString:buttonTitle
- attributes:@{ NSShadowAttributeName : shadow.get(),
- NSForegroundColorAttributeName : foregroundColor,
- NSParagraphStyleAttributeName : paragraphStyle }]);
- [button_ setAttributedTitle:attributedTitle];
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ base::scoped_nsobject<NSAttributedString> attributedTitle(
+ [[NSAttributedString alloc]
+ initWithString:buttonTitle
+ attributes:@{
+ NSForegroundColorAttributeName : foregroundColor,
+ NSParagraphStyleAttributeName : paragraphStyle,
+ NSKernAttributeName :
+ [NSNumber numberWithFloat:kMaterialTitleKern]
+ }]);
+ [button_ setAttributedTitle:attributedTitle];
+ } else {
+ base::scoped_nsobject<NSAttributedString> attributedTitle(
+ [[NSAttributedString alloc]
+ initWithString:buttonTitle
+ attributes:@{
+ NSShadowAttributeName : shadow.get(),
+ NSForegroundColorAttributeName : foregroundColor,
+ NSParagraphStyleAttributeName : paragraphStyle
+ }]);
+ [button_ setAttributedTitle:attributedTitle];
+ }
[button_ sizeToFit];
if (layoutParent) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698