Chromium Code Reviews| Index: chrome/browser/cocoa/download_item_controller.mm |
| =================================================================== |
| --- chrome/browser/cocoa/download_item_controller.mm (revision 31252) |
| +++ chrome/browser/cocoa/download_item_controller.mm (working copy) |
| @@ -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 @@ |
| }; |
| @interface DownloadItemController (Private) |
| +- (void)themeDidChangeNotification:(NSNotification*)aNotification; |
| +- (void)updateTheme:(GTMTheme*)theme; |
| - (void)setState:(DownoadItemState)state; |
| @end |
| @@ -80,6 +83,12 @@ |
| 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]; |
|
Nico
2009/11/08 09:37:14
Oh, and you need to removeObserver:self in dealloc
Avi (use Gerrit)
2009/11/08 17:45:26
Um, I already _do_. Well, _I_ don't, but it's alre
|
| + |
| shelf_ = shelf; |
| state_ = kNormal; |
| creationTime_ = base::Time::Now(); |
| @@ -171,6 +180,9 @@ |
| } |
| - (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 @@ |
| [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. |