diff --git a/chrome/browser/cocoa/download_item_controller.mm b/chrome/browser/cocoa/download_item_controller.mm index 5094bd2c1a28..3bd09057d383 100644 --- a/chrome/browser/cocoa/download_item_controller.mm +++ b/chrome/browser/cocoa/download_item_controller.mm @@ -18,6 +18,7 @@ #include "chrome/browser/download/download_util.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#import "third_party/GTM/AppKit/GTMTheme.h" #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" static const int kTextWidth = 140; // Pixels @@ -65,6 +66,8 @@ void WidenView(NSView* view, CGFloat widthChange) { }; @interface DownloadItemController (Private) +- (void)themeDidChangeNotification:(NSNotification*)aNotification; +- (void)updateTheme:(GTMTheme*)theme; - (void)setState:(DownoadItemState)state; @end @@ -80,6 +83,12 @@ - (id)initWithModel:(BaseDownloadItemModel*)downloadModel bridge_.reset(new DownloadItemMac(downloadModel, self)); menuBridge_.reset(new DownloadShelfContextMenuMac(downloadModel)); + NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter]; + [defaultCenter addObserver:self + selector:@selector(themeDidChangeNotification:) + name:kGTMThemeDidChangeNotification + object:nil]; + shelf_ = shelf; state_ = kNormal; creationTime_ = base::Time::Now(); @@ -171,6 +180,9 @@ - (void)remove { } - (void)updateVisibility:(id)sender { + if ([[self view] window]) + [self updateTheme:[[self view] gtm_theme]]; + // TODO(thakis): Make this prettier, by fading the items out or overlaying // the partial visible one with a horizontal alpha gradient -- crbug.com/17830 NSView* view = [self view]; @@ -226,6 +238,17 @@ - (void)setState:(DownoadItemState)state { [shelf_ layoutItems]; } +- (void)themeDidChangeNotification:(NSNotification*)aNotification { + GTMTheme* theme = [aNotification object]; + [self updateTheme:theme]; +} + +- (void)updateTheme:(GTMTheme*)theme { + NSColor* color = [theme textColorForStyle:GTMThemeStyleTabBarSelected + state:GTMThemeStateActiveWindow]; + [dangerousDownloadLabel_ setTextColor:color]; +} + - (IBAction)saveDownload:(id)sender { // The user has confirmed a dangerous download. We record how quickly the // user did this to detect whether we're being clickjacked.