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

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: Styling issues Created 5 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_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/mac/sdk_forward_declarations.h"
8 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/avatar_menu.h" 11 #include "chrome/browser/profiles/avatar_menu.h"
11 #include "chrome/browser/profiles/profile_info_cache.h" 12 #include "chrome/browser/profiles/profile_info_cache.h"
12 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/browser/profiles/profile_metrics.h" 14 #include "chrome/browser/profiles/profile_metrics.h"
14 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_window.h" 16 #include "chrome/browser/ui/browser_window.h"
16 #import "chrome/browser/ui/cocoa/info_bubble_view.h" 17 #import "chrome/browser/ui/cocoa/info_bubble_view.h"
17 #import "chrome/browser/ui/cocoa/info_bubble_window.h" 18 #import "chrome/browser/ui/cocoa/info_bubble_window.h"
(...skipping 134 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 153 // 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. 154 // much the window needs to grow to accomodate the new size of the field.
154 NSTextField* nameField = itemView.nameField; 155 NSTextField* nameField = itemView.nameField;
155 nameField.stringValue = base::SysUTF16ToNSString(item.name); 156 nameField.stringValue = base::SysUTF16ToNSString(item.name);
156 NSSize delta = [GTMUILocalizerAndLayoutTweaker sizeToFitView:nameField]; 157 NSSize delta = [GTMUILocalizerAndLayoutTweaker sizeToFitView:nameField];
157 if (NSWidth([nameField frame]) > kMaxItemTextWidth) { 158 if (NSWidth([nameField frame]) > kMaxItemTextWidth) {
158 delta.width -= (NSWidth([nameField frame]) - kMaxItemTextWidth); 159 delta.width -= (NSWidth([nameField frame]) - kMaxItemTextWidth);
159 NSRect frame = [nameField frame]; 160 NSRect frame = [nameField frame];
160 frame.size.width = kMaxItemTextWidth; 161 frame.size.width = kMaxItemTextWidth;
161 [nameField setFrame:frame]; 162 [nameField setFrame:frame];
163 if ([nameField respondsToSelector:@selector(setAllowsExpansionToolTips:)])
164 [nameField setAllowsExpansionToolTips:YES];
162 } 165 }
163 *widthAdjust = std::max(*widthAdjust, delta.width); 166 *widthAdjust = std::max(*widthAdjust, delta.width);
164 167
165 // Repeat for the sync state/email. 168 // Repeat for the sync state/email.
166 NSTextField* emailField = itemView.emailField; 169 NSTextField* emailField = itemView.emailField;
167 emailField.stringValue = base::SysUTF16ToNSString(item.sync_state); 170 emailField.stringValue = base::SysUTF16ToNSString(item.sync_state);
168 delta = [GTMUILocalizerAndLayoutTweaker sizeToFitView:emailField]; 171 delta = [GTMUILocalizerAndLayoutTweaker sizeToFitView:emailField];
169 if (NSWidth([emailField frame]) > kMaxItemTextWidth) { 172 if (NSWidth([emailField frame]) > kMaxItemTextWidth) {
170 delta.width -= (NSWidth([emailField frame]) - kMaxItemTextWidth); 173 delta.width -= (NSWidth([emailField frame]) - kMaxItemTextWidth);
171 NSRect frame = [emailField frame]; 174 NSRect frame = [emailField frame];
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 - (BOOL)accessibilityIsIgnored { 713 - (BOOL)accessibilityIsIgnored {
711 return YES; 714 return YES;
712 } 715 }
713 @end 716 @end
714 717
715 @implementation AccessibilityIgnoredTextFieldCell 718 @implementation AccessibilityIgnoredTextFieldCell
716 - (BOOL)accessibilityIsIgnored { 719 - (BOOL)accessibilityIsIgnored {
717 return YES; 720 return YES;
718 } 721 }
719 @end 722 @end
OLDNEW
« no previous file with comments | « base/mac/sdk_forward_declarations.h ('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