OLD | NEW |
1 // Copyright (c) 2009 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/cocoa/bookmark_button_cell.h" | 5 #import "chrome/browser/cocoa/bookmark_button_cell.h" |
6 | 6 |
7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/nsimage_cache_mac.h" | 9 #include "base/nsimage_cache_mac.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
11 #import "chrome/browser/bookmarks/bookmark_model.h" | 11 #import "chrome/browser/bookmarks/bookmark_model.h" |
(...skipping 29 matching lines...) Expand all Loading... |
41 - (id)initForNode:(const BookmarkNode*)node | 41 - (id)initForNode:(const BookmarkNode*)node |
42 contextMenu:(NSMenu*)contextMenu | 42 contextMenu:(NSMenu*)contextMenu |
43 cellText:(NSString*)cellText | 43 cellText:(NSString*)cellText |
44 cellImage:(NSImage*)cellImage { | 44 cellImage:(NSImage*)cellImage { |
45 if ((self = [super initTextCell:cellText])) { | 45 if ((self = [super initTextCell:cellText])) { |
46 [self configureBookmarkButtonCell]; | 46 [self configureBookmarkButtonCell]; |
47 | 47 |
48 [self setBookmarkNode:node]; | 48 [self setBookmarkNode:node]; |
49 | 49 |
50 if (node) { | 50 if (node) { |
51 NSString* title = base::SysWideToNSString(node->GetTitle()); | 51 NSString* title = base::SysUTF16ToNSString(node->GetTitleAsString16()); |
52 [self setBookmarkCellText:title image:cellImage]; | 52 [self setBookmarkCellText:title image:cellImage]; |
53 [self setMenu:contextMenu]; | 53 [self setMenu:contextMenu]; |
54 } else { | 54 } else { |
55 [self setEmpty:YES]; | 55 [self setEmpty:YES]; |
56 [self setBookmarkCellText:l10n_util::GetNSString(IDS_MENU_EMPTY_SUBMENU) | 56 [self setBookmarkCellText:l10n_util::GetNSString(IDS_MENU_EMPTY_SUBMENU) |
57 image:nil]; | 57 image:nil]; |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 return self; | 61 return self; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 (NSHeight(imageRect) / 2.0)); | 228 (NSHeight(imageRect) / 2.0)); |
229 [arrowImage_ drawInRect:drawRect | 229 [arrowImage_ drawInRect:drawRect |
230 fromRect:imageRect | 230 fromRect:imageRect |
231 operation:NSCompositeSourceOver | 231 operation:NSCompositeSourceOver |
232 fraction:[self isEnabled] ? 1.0 : 0.5 | 232 fraction:[self isEnabled] ? 1.0 : 0.5 |
233 neverFlipped:YES]; | 233 neverFlipped:YES]; |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 @end | 237 @end |
OLD | NEW |