Chromium Code Reviews| 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 caac7e85b636c9820ddf40ac024d3837bbee4bf5..e86d6733b42485dd3758fe9c141263ce64a0daff 100644 |
| --- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| +++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| @@ -2146,6 +2146,12 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| const int profileNameYOffset = |
| cardYOffset + |
| std::floor((kMdImageSide - NSHeight([profileName frame])) / 2); |
| + if (profileName.frame.size.width > availableTextWidth) { |
| + // Add the tooltip only if the profile name is truncated. This method to |
| + // test if text field is truncated is not ideal (spaces between characters |
| + // can be reduced without truncated). |
| + profileName.toolTip = base::SysUTF16ToNSString(profileNameString); |
|
msarda
2017/01/17 13:26:44
profileNameString is converted from NSString to UT
jlebel
2017/01/17 13:54:28
Done.
|
| + } |
| [profileName |
| setFrame:NSMakeRect(xOffset, profileNameYOffset, availableTextWidth, |
| NSHeight([profileName frame]))]; |
| @@ -2162,6 +2168,11 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| ElideEmail(base::UTF16ToUTF8(item.username), availableTextWidth), |
| NSZeroPoint, skia::SkColorToSRGBNSColor(SK_ColorGRAY)); |
| [username setFrameOrigin:NSMakePoint(xOffset, NSMaxY([profileName frame]))]; |
| + if (![[username stringValue] |
| + isEqualToString:base::SysUTF16ToNSString(item.username)]) { |
| + // Add the tooltip only if the user name is truncated. |
| + username.toolTip = base::SysUTF16ToNSString(item.username); |
|
msarda
2017/01/17 13:26:44
base::SysUTF16ToNSString(item.username) is convert
jlebel
2017/01/17 13:54:28
Done.
|
| + } |
| [profileCard addSubview:username]; |
| } |