diff options
Diffstat (limited to 'chrome/browser/gtk/gtk_theme_provider.cc')
| -rw-r--r-- | chrome/browser/gtk/gtk_theme_provider.cc | 78 |
1 files changed, 5 insertions, 73 deletions
diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc index ab8cd00..651fdda 100644 --- a/chrome/browser/gtk/gtk_theme_provider.cc +++ b/chrome/browser/gtk/gtk_theme_provider.cc @@ -91,30 +91,10 @@ const int kThemeImages[] = { IDR_THEME_FRAME_INCOGNITO_INACTIVE, }; -// A list of icons used in the autocomplete view that should be tinted to the -// current gtk theme selection color so they stand out against the GtkEntry's -// base color. -const int kAutocompleteImages[] = { - IDR_OMNIBOX_HTTP, - IDR_OMNIBOX_HTTP_DARK, - IDR_OMNIBOX_HISTORY, - IDR_OMNIBOX_HISTORY_DARK, - IDR_OMNIBOX_SEARCH, - IDR_OMNIBOX_SEARCH_DARK, - IDR_OMNIBOX_MORE, - IDR_OMNIBOX_MORE_DARK, - IDR_OMNIBOX_STAR, - IDR_OMNIBOX_STAR_DARK, - IDR_GEOLOCATION_ALLOWED_LOCATIONBAR_ICON, - IDR_GEOLOCATION_DENIED_LOCATIONBAR_ICON -}; - bool IsOverridableImage(int id) { static std::set<int> images; if (images.empty()) { images.insert(kThemeImages, kThemeImages + arraysize(kThemeImages)); - images.insert(kAutocompleteImages, - kAutocompleteImages + arraysize(kAutocompleteImages)); const std::set<int>& buttons = BrowserThemeProvider::GetTintableToolbarButtons(); @@ -758,49 +738,15 @@ SkBitmap* GtkThemeProvider::GenerateGtkThemeBitmap(int id) const { return GenerateFrameImage( BrowserThemeProvider::TINT_FRAME_INCOGNITO_INACTIVE); } - // Two sets of omnibox icons, the one for normal http and the one for - // history, include white backgrounds (and are supposed to, for the windows - // chrome-theme). On linux, where we have all sorts of wacky themes and - // color combinations we need to deal with, switch them out with - // transparent background versions. - case IDR_OMNIBOX_HTTP: { - TintMap::const_iterator it = tints_.find( - BrowserThemeProvider::TINT_BUTTONS); - DCHECK(it != tints_.end()); - return GenerateTintedIcon(IDR_OMNIBOX_HTTP_TRANSPARENT, it->second); - } - case IDR_OMNIBOX_HISTORY: { - TintMap::const_iterator it = tints_.find( - BrowserThemeProvider::TINT_BUTTONS); - DCHECK(it != tints_.end()); - return GenerateTintedIcon(IDR_OMNIBOX_HISTORY_TRANSPARENT, it->second); - } - // In GTK mode, the dark versions of the omnibox icons only ever appear in - // the autocomplete popup and only against the current theme's GtkEntry - // base[GTK_STATE_SELECTED] color, so tint the icons so they won't collide - // with the selected color. - case IDR_OMNIBOX_HTTP_DARK: { - color_utils::HSL tint; - GetEntryForegroundHSL(&tint); - return GenerateTintedIcon(IDR_OMNIBOX_HTTP_DARK_TRANSPARENT, tint); - } - case IDR_OMNIBOX_HISTORY_DARK: { - color_utils::HSL tint; - GetEntryForegroundHSL(&tint); - return GenerateTintedIcon(IDR_OMNIBOX_HISTORY_DARK_TRANSPARENT, tint); - } - case IDR_OMNIBOX_SEARCH_DARK: - case IDR_OMNIBOX_MORE_DARK: - case IDR_OMNIBOX_STAR_DARK: { - color_utils::HSL tint; - GetEntryForegroundHSL(&tint); - return GenerateTintedIcon(id, tint); - } 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 GenerateTintedIcon(id, it->second); + return new SkBitmap(SkBitmapOperations::CreateHSLShiftedBitmap( + *button, it->second)); } } } @@ -822,20 +768,6 @@ SkBitmap* GtkThemeProvider::GenerateTabImage(int base_id) const { bg_tint, 0, 0, bg_tint.width(), bg_tint.height())); } -SkBitmap* GtkThemeProvider::GenerateTintedIcon(int base_id, - color_utils::HSL tint) const { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - scoped_ptr<SkBitmap> button(new SkBitmap(*rb.GetBitmapNamed(base_id))); - return new SkBitmap(SkBitmapOperations::CreateHSLShiftedBitmap( - *button, tint)); -} - -void GtkThemeProvider::GetEntryForegroundHSL(color_utils::HSL* tint) const { - GtkStyle* style = gtk_rc_get_style(fake_entry_.get()); - const GdkColor color = style->text[GTK_STATE_SELECTED]; - color_utils::SkColorToHSL(GdkToSkColor(&color), tint); -} - void GtkThemeProvider::OnDestroyChromeButton(GtkWidget* button) { std::vector<GtkWidget*>::iterator it = find(chrome_buttons_.begin(), chrome_buttons_.end(), button); |
