diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-15 17:38:28 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-15 17:38:28 +0000 |
commit | d626574fa210139585bb2b76a87edfe1b25d0e38 (patch) | |
tree | 5259ef60ec8120fc5ba80c2b9c60d186804244e4 /chrome/browser/gtk/gtk_theme_provider.cc | |
parent | f741e936aaf0f554c8ec3539c59265d8a0fe67b3 (diff) | |
download | chromium_src-d626574fa210139585bb2b76a87edfe1b25d0e38.zip chromium_src-d626574fa210139585bb2b76a87edfe1b25d0e38.tar.gz chromium_src-d626574fa210139585bb2b76a87edfe1b25d0e38.tar.bz2 |
GTK: Fix regression where we don't build tinted buttons in GTK theme mode.
(Caused by my r34486)
TEST=Use GTK+ mode. page/app menu button should have same tint as title bar.
BUG=NONE
Review URL: http://codereview.chromium.org/507002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34566 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/gtk_theme_provider.cc')
-rw-r--r-- | chrome/browser/gtk/gtk_theme_provider.cc | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc index 9330f30..7881bae 100644 --- a/chrome/browser/gtk/gtk_theme_provider.cc +++ b/chrome/browser/gtk/gtk_theme_provider.cc @@ -71,12 +71,16 @@ const int kThemeImages[] = { }; bool IsOverridableImage(int id) { - for (size_t i = 0; i < arraysize(kThemeImages); ++i) { - if (kThemeImages[i] == id) - return true; + static std::set<int> images; + if (images.empty()) { + images.insert(kThemeImages, kThemeImages + arraysize(kThemeImages)); + + const std::set<int>& buttons = + BrowserThemeProvider::GetTintableToolbarButtons(); + images.insert(buttons.begin(), buttons.end()); } - return false; + return images.count(id) > 0; } } // namespace @@ -619,10 +623,17 @@ SkBitmap* GtkThemeProvider::GenerateGtkThemeBitmap(int id) const { return GenerateFrameImage( BrowserThemeProvider::TINT_FRAME_INCOGNITO_INACTIVE); } + default: { + // This is a tinted button. Tint it and return it. + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + scoped_ptr<SkBitmap> button(new SkBitmap(*rb.GetBitmapNamed(id))); + TintMap::const_iterator it = tints_.find( + BrowserThemeProvider::TINT_BUTTONS); + DCHECK(it != tints_.end()); + return new SkBitmap(SkBitmapOperations::CreateHSLShiftedBitmap( + *button, it->second)); + } } - - NOTREACHED() << "Invalid bitmap request " << id; - return NULL; } SkBitmap* GtkThemeProvider::GenerateFrameImage(int tint_id) const { |