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

Unified Diff: chrome/browser/views/tabs/tab_renderer.cc

Issue 155882: Make the tab close button color match the tab text.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 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/views/tabs/tab_renderer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/tabs/tab_renderer.cc
===================================================================
--- chrome/browser/views/tabs/tab_renderer.cc (revision 21189)
+++ chrome/browser/views/tabs/tab_renderer.cc (working copy)
@@ -54,6 +54,7 @@
static gfx::Font* title_font = NULL;
static int title_font_height = 0;
static SkBitmap* close_button_n = NULL;
+static SkBitmap* close_button_m = NULL;
static SkBitmap* close_button_h = NULL;
static SkBitmap* close_button_p = NULL;
static int close_button_height = 0;
@@ -81,6 +82,7 @@
title_font_height = title_font->height();
close_button_n = rb.GetBitmapNamed(IDR_TAB_CLOSE);
+ close_button_m = rb.GetBitmapNamed(IDR_TAB_CLOSE_MASK);
close_button_h = rb.GetBitmapNamed(IDR_TAB_CLOSE_H);
close_button_p = rb.GetBitmapNamed(IDR_TAB_CLOSE_P);
close_button_width = close_button_n->width();
@@ -232,6 +234,7 @@
showing_icon_(false),
showing_close_button_(false),
fav_icon_hiding_offset_(0),
+ close_button_color_(NULL),
crash_animation_(NULL),
should_display_crashed_favicon_(false),
theme_provider_(NULL) {
@@ -481,6 +484,18 @@
close_button_->SetBounds(lb.width() + kCloseButtonHorzFuzz,
close_button_top, close_button_width,
close_button_height);
+
+ // If the close button color has changed, generate a new one.
+ SkColor tab_text_color =
+ GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_TAB_TEXT);
+ if (!close_button_color_ || tab_text_color != close_button_color_) {
+ close_button_color_ = tab_text_color;
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ close_button_->SetBackground(close_button_color_,
+ rb.GetBitmapNamed(IDR_TAB_CLOSE),
+ rb.GetBitmapNamed(IDR_TAB_CLOSE_MASK));
+ }
+
close_button_->SetVisible(true);
} else {
close_button_->SetBounds(0, 0, 0, 0);
« no previous file with comments | « chrome/browser/views/tabs/tab_renderer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698