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

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

Issue 377015: Theme the text of the download item so it's readable with dark themes.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698