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

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

Issue 943453003: Add tooltips to profile name when truncated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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_menu_bubble_controller.h" 5 #import "chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller.h"
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/avatar_menu.h" 10 #include "chrome/browser/profiles/avatar_menu.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // Adjust the name field to fit the string. If it overflows, record by how 152 // Adjust the name field to fit the string. If it overflows, record by how
153 // much the window needs to grow to accomodate the new size of the field. 153 // much the window needs to grow to accomodate the new size of the field.
154 NSTextField* nameField = itemView.nameField; 154 NSTextField* nameField = itemView.nameField;
155 nameField.stringValue = base::SysUTF16ToNSString(item.name); 155 nameField.stringValue = base::SysUTF16ToNSString(item.name);
156 NSSize delta = [GTMUILocalizerAndLayoutTweaker sizeToFitView:nameField]; 156 NSSize delta = [GTMUILocalizerAndLayoutTweaker sizeToFitView:nameField];
157 if (NSWidth([nameField frame]) > kMaxItemTextWidth) { 157 if (NSWidth([nameField frame]) > kMaxItemTextWidth) {
158 delta.width -= (NSWidth([nameField frame]) - kMaxItemTextWidth); 158 delta.width -= (NSWidth([nameField frame]) - kMaxItemTextWidth);
159 NSRect frame = [nameField frame]; 159 NSRect frame = [nameField frame];
160 frame.size.width = kMaxItemTextWidth; 160 frame.size.width = kMaxItemTextWidth;
161 [nameField setFrame:frame]; 161 [nameField setFrame:frame];
162 [nameField setAllowsExpansionToolTips:YES];
groby-ooo-7-16 2015/02/19 19:00:10 This is only available in 10.8 or later. You'll ne
162 } 163 }
163 *widthAdjust = std::max(*widthAdjust, delta.width); 164 *widthAdjust = std::max(*widthAdjust, delta.width);
164 165
165 // Repeat for the sync state/email. 166 // Repeat for the sync state/email.
166 NSTextField* emailField = itemView.emailField; 167 NSTextField* emailField = itemView.emailField;
167 emailField.stringValue = base::SysUTF16ToNSString(item.sync_state); 168 emailField.stringValue = base::SysUTF16ToNSString(item.sync_state);
168 delta = [GTMUILocalizerAndLayoutTweaker sizeToFitView:emailField]; 169 delta = [GTMUILocalizerAndLayoutTweaker sizeToFitView:emailField];
169 if (NSWidth([emailField frame]) > kMaxItemTextWidth) { 170 if (NSWidth([emailField frame]) > kMaxItemTextWidth) {
170 delta.width -= (NSWidth([emailField frame]) - kMaxItemTextWidth); 171 delta.width -= (NSWidth([emailField frame]) - kMaxItemTextWidth);
171 NSRect frame = [emailField frame]; 172 NSRect frame = [emailField frame];
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 - (BOOL)accessibilityIsIgnored { 711 - (BOOL)accessibilityIsIgnored {
711 return YES; 712 return YES;
712 } 713 }
713 @end 714 @end
714 715
715 @implementation AccessibilityIgnoredTextFieldCell 716 @implementation AccessibilityIgnoredTextFieldCell
716 - (BOOL)accessibilityIsIgnored { 717 - (BOOL)accessibilityIsIgnored {
717 return YES; 718 return YES;
718 } 719 }
719 @end 720 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698