OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bookmarks/bookmark_menu_cocoa_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h" |
6 | 6 |
7 #include "base/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" // IDC_BOOKMARK_MENU | 9 #include "chrome/app/chrome_command_ids.h" // IDC_BOOKMARK_MENU |
10 #import "chrome/browser/app_controller_mac.h" | 10 #import "chrome/browser/app_controller_mac.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // Menus more than this many pixels wide will get trimmed | 21 // Menus more than this many pixels wide will get trimmed |
22 // TODO(jrg): ask UI dudes what a good value is. | 22 // TODO(jrg): ask UI dudes what a good value is. |
23 const NSUInteger kMaximumMenuPixelsWide = 300; | 23 const NSUInteger kMaximumMenuPixelsWide = 300; |
24 | 24 |
25 } | 25 } |
26 | 26 |
27 @implementation BookmarkMenuCocoaController | 27 @implementation BookmarkMenuCocoaController |
28 | 28 |
29 + (NSString*)menuTitleForNode:(const BookmarkNode*)node { | 29 + (NSString*)menuTitleForNode:(const BookmarkNode*)node { |
30 NSFont* nsfont = [NSFont menuBarFontOfSize:0]; // 0 means "default" | 30 NSFont* nsfont = [NSFont menuBarFontOfSize:0]; // 0 means "default" |
31 gfx::Font font(base::SysNSStringToUTF16([nsfont fontName]), | 31 gfx::Font font(base::SysNSStringToUTF8([nsfont fontName]), |
32 static_cast<int>([nsfont pointSize])); | 32 static_cast<int>([nsfont pointSize])); |
33 string16 title = ui::ElideText(node->GetTitle(), | 33 string16 title = ui::ElideText(node->GetTitle(), |
34 font, | 34 font, |
35 kMaximumMenuPixelsWide, | 35 kMaximumMenuPixelsWide, |
36 false); | 36 false); |
37 return base::SysUTF16ToNSString(title); | 37 return base::SysUTF16ToNSString(title); |
38 } | 38 } |
39 | 39 |
40 + (NSString*)tooltipForNode:(const BookmarkNode*)node { | 40 + (NSString*)tooltipForNode:(const BookmarkNode*)node { |
41 NSString* title = base::SysUTF16ToNSString(node->GetTitle()); | 41 NSString* title = base::SysUTF16ToNSString(node->GetTitle()); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 - (IBAction)openAllBookmarksNewWindow:(id)sender { | 143 - (IBAction)openAllBookmarksNewWindow:(id)sender { |
144 [self openAll:[sender tag] withDisposition:NEW_WINDOW]; | 144 [self openAll:[sender tag] withDisposition:NEW_WINDOW]; |
145 } | 145 } |
146 | 146 |
147 - (IBAction)openAllBookmarksIncognitoWindow:(id)sender { | 147 - (IBAction)openAllBookmarksIncognitoWindow:(id)sender { |
148 [self openAll:[sender tag] withDisposition:OFF_THE_RECORD]; | 148 [self openAll:[sender tag] withDisposition:OFF_THE_RECORD]; |
149 } | 149 } |
150 | 150 |
151 @end // BookmarkMenuCocoaController | 151 @end // BookmarkMenuCocoaController |
OLD | NEW |