Chromium Code Reviews| 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/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #import "chrome/browser/bookmarks/bookmark_model.h" | 9 #import "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 size.width += 2; | 110 size.width += 2; |
| 111 size.height += 4; | 111 size.height += 4; |
| 112 return size; | 112 return size; |
| 113 } | 113 } |
| 114 | 114 |
| 115 - (void)setBookmarkCellText:(NSString*)title | 115 - (void)setBookmarkCellText:(NSString*)title |
| 116 image:(NSImage*)image { | 116 image:(NSImage*)image { |
| 117 title = [title stringByReplacingOccurrencesOfString:@"\n" | 117 title = [title stringByReplacingOccurrencesOfString:@"\n" |
| 118 withString:@" "]; | 118 withString:@" "]; |
| 119 title = [title stringByReplacingOccurrencesOfString:@"\r" | 119 title = [title stringByReplacingOccurrencesOfString:@"\r" |
| 120 withString:@" "]; | 120 withString:@" "]; |
|
Ilya Sherman
2011/12/05 23:53:58
nit: Hmm, this isn't relevant to this CL so much a
KushalP
2011/12/13 17:39:06
I'll have a look and see what happens when I remov
| |
| 121 // If there is no title, squeeze things tight by displaying only the image; by | 121 // If there is no title, squeeze things tight by displaying only the image; by |
| 122 // default, Cocoa leaves extra space in an attempt to display an empty title. | 122 // default, Cocoa leaves extra space in an attempt to display an empty title. |
|
Ilya Sherman
2011/12/05 23:53:58
nit: This comment should be moved into the "else"
| |
| 123 if ([title length]) { | 123 if ([title length]) { |
| 124 [self setImagePosition:NSImageLeft]; | 124 [self setImagePosition:NSImageLeft]; |
| 125 [self setTitle:title]; | 125 [self setTitle:title]; |
| 126 } else if ([self isFolderButtonCell]) { | |
| 127 // A folder button cell in the bookmark bar scroll view should have | |
| 128 // the favicon aligned to the left. | |
|
Ilya Sherman
2011/12/05 23:53:58
nit: "folder button cell" reads as slightly confus
| |
| 129 [self setImagePosition:NSImageLeft]; | |
| 126 } else { | 130 } else { |
| 127 [self setImagePosition:NSImageOnly]; | 131 [self setImagePosition:NSImageOnly]; |
| 128 } | 132 } |
| 129 | 133 |
| 130 if (image) | 134 if (image) |
| 131 [self setImage:image]; | 135 [self setImage:image]; |
| 132 } | 136 } |
| 133 | 137 |
| 134 - (void)setBookmarkNode:(const BookmarkNode*)node { | 138 - (void)setBookmarkNode:(const BookmarkNode*)node { |
| 135 [self setRepresentedObject:[NSValue valueWithPointer:node]]; | 139 [self setRepresentedObject:[NSValue valueWithPointer:node]]; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 NSRect drawRect = NSOffsetRect(imageRect, dX, dY); | 250 NSRect drawRect = NSOffsetRect(imageRect, dX, dY); |
| 247 [arrowImage_ drawInRect:drawRect | 251 [arrowImage_ drawInRect:drawRect |
| 248 fromRect:imageRect | 252 fromRect:imageRect |
| 249 operation:NSCompositeSourceOver | 253 operation:NSCompositeSourceOver |
| 250 fraction:[self isEnabled] ? 1.0 : 0.5 | 254 fraction:[self isEnabled] ? 1.0 : 0.5 |
| 251 neverFlipped:YES]; | 255 neverFlipped:YES]; |
| 252 } | 256 } |
| 253 } | 257 } |
| 254 | 258 |
| 255 @end | 259 @end |
| OLD | NEW |