diff options
-rw-r--r-- | chrome/app/theme/tab_close.png | bin | 257 -> 120 bytes | |||
-rw-r--r-- | chrome/app/theme/tab_close_mask.png | bin | 0 -> 243 bytes | |||
-rw-r--r-- | chrome/app/theme/theme_resources.grd | 2 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_renderer.cc | 19 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_renderer.h | 4 |
5 files changed, 22 insertions, 3 deletions
diff --git a/chrome/app/theme/tab_close.png b/chrome/app/theme/tab_close.png Binary files differindex d02ec42..fe8695c 100644 --- a/chrome/app/theme/tab_close.png +++ b/chrome/app/theme/tab_close.png diff --git a/chrome/app/theme/tab_close_mask.png b/chrome/app/theme/tab_close_mask.png Binary files differnew file mode 100644 index 0000000..e7ad4c0 --- /dev/null +++ b/chrome/app/theme/tab_close_mask.png diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 3e13670..6a742fe 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -57,6 +57,7 @@ <include name="IDR_TAB_CLOSE" file="tab_close.png" type="BINDATA" /> <include name="IDR_TAB_CLOSE_H" file="tab_close_h.png" type="BINDATA" /> <include name="IDR_TAB_CLOSE_P" file="tab_close_p.png" type="BINDATA" /> + <include name="IDR_TAB_CLOSE_MASK" file="tab_close_mask.png" type="BINDATA" /> <include name="IDR_TAB_INACTIVE_CENTER" file="tab_inactive_center.png" type="BINDATA" /> <include name="IDR_TAB_INACTIVE_LEFT" file="tab_inactive_left.png" type="BINDATA" /> <include name="IDR_TAB_INACTIVE_RIGHT" file="tab_inactive_right.png" type="BINDATA" /> @@ -285,6 +286,7 @@ <include name="IDR_THEME_TAB_BACKGROUND_V" file="theme_tab_background_glass.png" type="BINDATA" /> <include name="IDR_THEME_NTP_BACKGROUND" file="ntp_background.png" type="BINDATA" /> <include name="IDR_THEME_FRAME_OVERLAY" file="notused.png" type="BINDATA" /> + <include name="IDR_THEME_FRAME_OVERLAY_INACTIVE" file="notused.png" type="BINDATA" /> <include name="IDR_THEME_BUTTON_BACKGROUND" file="notused.png" type="BINDATA" /> <include name="IDR_THEME_NTP_ATTRIBUTION" file="notused.png" type="BINDATA" /> <include name="IDR_THEME_WINDOW_CONTROL_BACKGROUND" file="notused.png" type="BINDATA" /> diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc index 2b29341..584cb18 100644 --- a/chrome/browser/views/tabs/tab_renderer.cc +++ b/chrome/browser/views/tabs/tab_renderer.cc @@ -54,6 +54,7 @@ static const double kHoverOpacity = 0.33; 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 @@ void InitResources() { 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 @@ TabRenderer::TabRenderer() 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) { @@ -268,8 +271,6 @@ ThemeProvider* TabRenderer::GetThemeProvider() { if (theme_provider_) return theme_provider_; - // return contents->profile()->GetThemeProvider(); - NOTREACHED() << "Unable to find a theme provider"; return NULL; } @@ -481,6 +482,20 @@ void TabRenderer::Layout() { 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. + if (GetThemeProvider()) { + 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); diff --git a/chrome/browser/views/tabs/tab_renderer.h b/chrome/browser/views/tabs/tab_renderer.h index c618ba6..d157ceb 100644 --- a/chrome/browser/views/tabs/tab_renderer.h +++ b/chrome/browser/views/tabs/tab_renderer.h @@ -198,6 +198,9 @@ class TabRenderer : public views::View, // The offset used to animate the favicon location. int fav_icon_hiding_offset_; + // The current color of the close button. + SkColor close_button_color_; + // The animation object used to swap the favicon with the sad tab icon. class FavIconCrashAnimation; FavIconCrashAnimation* crash_animation_; @@ -213,4 +216,3 @@ class TabRenderer : public views::View, }; #endif // CHROME_BROWSER_VIEWS_TABS_TAB_RENDERER_H__ - |