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

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

Issue 2268353003: [Mac][MD User Menu] Fixed the accessibility string of profile button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « chrome/app/generated_resources.grd ('k') | 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/profile_chooser_controller.mm
diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
index 328a875de2aaf489e73b14c1d5577de94c879db3..5b34ac922137211f3fa43e5318b659b0dc8cf4f6 100644
--- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
+++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
@@ -2049,6 +2049,8 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
}
// Profile card button that contains the profile icon, name, and username.
+ const base::string16 profileNameString =
+ profiles::GetAvatarNameForProfile(browser_->profile()->GetPath());
NSRect rect = NSMakeRect(0, yOffset, GetFixedMenuWidth(),
kMdImageSide + kVerticalSpacing);
NSButton* profileCard =
@@ -2058,6 +2060,20 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
profiles::SHAPE_CIRCLE)
action:@selector(editProfile:)];
[[profileCard cell] setImageDimsWhenDisabled:NO];
+ if (item.signed_in) {
+ [[profileCard cell]
+ accessibilitySetOverrideValue:
+ l10n_util::GetNSStringF(
+ IDS_PROFILES_EDIT_SIGNED_IN_PROFILE_ACCESSIBLE_NAME,
+ profileNameString, item.username)
+ forAttribute:NSAccessibilityTitleAttribute];
+ } else {
+ [[profileCard cell]
+ accessibilitySetOverrideValue:
+ l10n_util::GetNSStringF(IDS_PROFILES_EDIT_PROFILE_ACCESSIBLE_NAME,
+ profileNameString)
+ forAttribute:NSAccessibilityTitleAttribute];
+ }
[container addSubview:profileCard];
if (isGuestSession_)
[profileCard setEnabled:NO];
@@ -2087,10 +2103,8 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
// Profile name, left-aligned to the right of profile icon.
xOffset += kMdImageSide + kHorizontalSpacing;
CGFloat fontSize = kTextFontSize + 1.0;
- NSTextField* profileName = BuildLabel(
- base::SysUTF16ToNSString(
- profiles::GetAvatarNameForProfile(browser_->profile()->GetPath())),
- NSZeroPoint, nil);
+ NSTextField* profileName =
+ BuildLabel(base::SysUTF16ToNSString(profileNameString), NSZeroPoint, nil);
[[profileName cell] setLineBreakMode:NSLineBreakByTruncatingTail];
[profileName setFont:[NSFont labelFontOfSize:fontSize]];
[profileName sizeToFit];
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698