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

Unified Diff: chrome/browser/cocoa/bookmark_bar_controller.mm

Issue 2958016: Give imported bookmarks the properly themed button text.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/bookmark_bar_controller.mm
===================================================================
--- chrome/browser/cocoa/bookmark_bar_controller.mm (revision 52354)
+++ chrome/browser/cocoa/bookmark_bar_controller.mm (working copy)
@@ -991,7 +991,7 @@
- (BookmarkButton*)buttonForNode:(const BookmarkNode*)node
xOffset:(int*)xOffset {
- NSCell* cell = [self cellForBookmarkNode:node];
+ BookmarkButtonCell* cell = [self cellForBookmarkNode:node];
NSRect frame = [self frameForBookmarkButtonFromCell:cell xOffset:xOffset];
scoped_nsobject<BookmarkButton>
@@ -1006,6 +1006,20 @@
[button setCell:cell];
[button setDelegate:self];
+ // We cannot set the button cell's text color until it is placed in
+ // the button (e.g. the [button setCell:cell] call right above). We
+ // also cannot set the cell's text color until the view is added to
+ // the hierarchy. If that second part is now true, set the color.
+ // (If not we'll set the color on the 1st themeChanged:
+ // notification.)
+ ThemeProvider* themeProvider = [[[self view] window] themeProvider];
+ if (themeProvider) {
+ NSColor* color =
+ themeProvider->GetNSColor(BrowserThemeProvider::COLOR_BOOKMARK_TEXT,
+ true);
+ [cell setTextColor:color];
+ }
+
if (node->is_folder()) {
[button setTarget:self];
[button setAction:@selector(openBookmarkFolderFromButton:)];
@@ -1369,7 +1383,7 @@
// Return an autoreleased NSCell suitable for a bookmark button.
// TODO(jrg): move much of the cell config into the BookmarkButtonCell class.
-- (NSCell*)cellForBookmarkNode:(const BookmarkNode*)node {
+- (BookmarkButtonCell*)cellForBookmarkNode:(const BookmarkNode*)node {
NSImage* image = node ? [self favIconForNode:node] : nil;
NSMenu* menu = node && node->is_folder() ? buttonFolderContextMenu_ :
buttonContextMenu_;
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698