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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm

Issue 6134010: Revert 71167 - Remove wstring from gfx.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/text_elider.h" 7 #include "app/text_elider.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" // IDC_BOOKMARK_MENU 10 #include "chrome/app/chrome_command_ids.h" // IDC_BOOKMARK_MENU
11 #import "chrome/browser/app_controller_mac.h" 11 #import "chrome/browser/app_controller_mac.h"
12 #include "chrome/browser/bookmarks/bookmark_model.h" 12 #include "chrome/browser/bookmarks/bookmark_model.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" 14 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h"
15 #include "chrome/browser/ui/cocoa/event_utils.h" 15 #include "chrome/browser/ui/cocoa/event_utils.h"
16 #include "webkit/glue/window_open_disposition.h" 16 #include "webkit/glue/window_open_disposition.h"
17 17
18 namespace { 18 namespace {
19 19
20 // Menus more than this many pixels wide will get trimmed 20 // Menus more than this many pixels wide will get trimmed
21 // TODO(jrg): ask UI dudes what a good value is. 21 // TODO(jrg): ask UI dudes what a good value is.
22 const NSUInteger kMaximumMenuPixelsWide = 300; 22 const NSUInteger kMaximumMenuPixelsWide = 300;
23 23
24 } 24 }
25 25
26 @implementation BookmarkMenuCocoaController 26 @implementation BookmarkMenuCocoaController
27 27
28 + (NSString*)menuTitleForNode:(const BookmarkNode*)node { 28 + (NSString*)menuTitleForNode:(const BookmarkNode*)node {
29 NSFont* nsfont = [NSFont menuBarFontOfSize:0]; // 0 means "default" 29 NSFont* nsfont = [NSFont menuBarFontOfSize:0]; // 0 means "default"
30 gfx::Font font(base::SysNSStringToUTF16([nsfont fontName]), 30 gfx::Font font(base::SysNSStringToWide([nsfont fontName]),
31 static_cast<int>([nsfont pointSize])); 31 static_cast<int>([nsfont pointSize]));
32 string16 title = gfx::ElideText(node->GetTitle(), 32 string16 title = gfx::ElideText(node->GetTitle(),
33 font, 33 font,
34 kMaximumMenuPixelsWide, 34 kMaximumMenuPixelsWide,
35 false); 35 false);
36 return base::SysUTF16ToNSString(title); 36 return base::SysUTF16ToNSString(title);
37 } 37 }
38 38
39 - (id)initWithBridge:(BookmarkMenuBridge *)bridge { 39 - (id)initWithBridge:(BookmarkMenuBridge *)bridge {
40 if ((self = [super init])) { 40 if ((self = [super init])) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 const BookmarkNode* node = [self nodeForIdentifier:identifier]; 87 const BookmarkNode* node = [self nodeForIdentifier:identifier];
88 DCHECK(node); 88 DCHECK(node);
89 if (!node) 89 if (!node)
90 return; // shouldn't be reached 90 return; // shouldn't be reached
91 91
92 [self openURLForNode:node]; 92 [self openURLForNode:node];
93 } 93 }
94 94
95 @end // BookmarkMenuCocoaController 95 @end // BookmarkMenuCocoaController
96 96
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_setup_flow.cc ('k') | chrome/browser/ui/cocoa/download/download_item_cell.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698