summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/bookmark_button_cell.mm
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-05 00:48:22 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-05 00:48:22 +0000
commit76361d0b2bf453fd6a47f16fb7c765e0ece103b4 (patch)
tree3fbe28f9c7c3286cc8c8b5839fdaa7e011064f20 /chrome/browser/cocoa/bookmark_button_cell.mm
parentfb3aa11f5f8e53f482410466cd8d8823acd65bb5 (diff)
downloadchromium_src-76361d0b2bf453fd6a47f16fb7c765e0ece103b4.zip
chromium_src-76361d0b2bf453fd6a47f16fb7c765e0ece103b4.tar.gz
chromium_src-76361d0b2bf453fd6a47f16fb7c765e0ece103b4.tar.bz2
Enable the OK button when editing a bookmark even when there is no text, and keep alignment correct in both cases. Also strip out newlines from bookmark titles.
[Patch by feldstein.] BUG=26353 TEST=Add and remove titles from bookmarks in the bookmark bar and verify that they look correct, and icons are centered when there is no text. Review URL: http://codereview.chromium.org/353024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31047 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/bookmark_button_cell.mm')
-rw-r--r--chrome/browser/cocoa/bookmark_button_cell.mm17
1 files changed, 17 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/bookmark_button_cell.mm b/chrome/browser/cocoa/bookmark_button_cell.mm
index 2a5a3eb..1e2190b 100644
--- a/chrome/browser/cocoa/bookmark_button_cell.mm
+++ b/chrome/browser/cocoa/bookmark_button_cell.mm
@@ -34,6 +34,23 @@
return size;
}
+- (void)setBookmarkCellText:(NSString*)title
+ image:(NSImage*)image {
+ title = [title stringByReplacingOccurrencesOfString:@"\n"
+ withString:@" "];
+ title = [title stringByReplacingOccurrencesOfString:@"\r"
+ withString:@" "];
+ if (image) {
+ [self setImage:image];
+ if ([title length] < 1) {
+ [self setImagePosition:NSImageOnly];
+ } else {
+ [self setImagePosition:NSImageLeft];
+ }
+ }
+ [self setTitle:title];
+}
+
// We share the context menu among all bookmark buttons. To allow us
// to disambiguate when needed (e.g. "open bookmark"), we set the
// menu's delegate to be us. We (the cell) have the bookmark encoded