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_button_cell.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/user_metrics.h" | 8 #include "base/metrics/user_metrics.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 10 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 - (void)configureBookmarkButtonCell; | 74 - (void)configureBookmarkButtonCell; |
75 - (void)applyTextColor; | 75 - (void)applyTextColor; |
76 // Returns the title the button cell displays. Note that a button cell can | 76 // Returns the title the button cell displays. Note that a button cell can |
77 // have a title string assigned but it won't be visible if its image position | 77 // have a title string assigned but it won't be visible if its image position |
78 // is NSImageOnly. | 78 // is NSImageOnly. |
79 - (NSString*)visibleTitle; | 79 - (NSString*)visibleTitle; |
80 // Returns the dictionary of attributes to associate with the button title. | 80 // Returns the dictionary of attributes to associate with the button title. |
81 - (NSDictionary*)titleTextAttributes; | 81 - (NSDictionary*)titleTextAttributes; |
82 @end | 82 @end |
83 | 83 |
| 84 |
84 @implementation BookmarkButtonCell | 85 @implementation BookmarkButtonCell |
85 | 86 |
86 @synthesize startingChildIndex = startingChildIndex_; | 87 @synthesize startingChildIndex = startingChildIndex_; |
87 @synthesize drawFolderArrow = drawFolderArrow_; | 88 @synthesize drawFolderArrow = drawFolderArrow_; |
88 | 89 |
89 + (id)buttonCellForNode:(const BookmarkNode*)node | 90 + (id)buttonCellForNode:(const BookmarkNode*)node |
90 text:(NSString*)text | 91 text:(NSString*)text |
91 image:(NSImage*)image | 92 image:(NSImage*)image |
92 menuController:(BookmarkContextMenuCocoaController*)menuController { | 93 menuController:(BookmarkContextMenuCocoaController*)menuController { |
93 id buttonCell = | 94 id buttonCell = |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 471 |
471 // Returns |title| with newlines and line feeds replaced with | 472 // Returns |title| with newlines and line feeds replaced with |
472 // spaces. | 473 // spaces. |
473 + (NSString*)cleanTitle:(NSString*)title { | 474 + (NSString*)cleanTitle:(NSString*)title { |
474 title = [title stringByReplacingOccurrencesOfString:@"\n" withString:@" "]; | 475 title = [title stringByReplacingOccurrencesOfString:@"\n" withString:@" "]; |
475 title = [title stringByReplacingOccurrencesOfString:@"\r" withString:@" "]; | 476 title = [title stringByReplacingOccurrencesOfString:@"\r" withString:@" "]; |
476 return title; | 477 return title; |
477 } | 478 } |
478 | 479 |
479 @end | 480 @end |
OLD | NEW |