Chromium Code Reviews| Index: chrome/browser/ui/views/download/download_shelf_view.cc |
| diff --git a/chrome/browser/ui/views/download/download_shelf_view.cc b/chrome/browser/ui/views/download/download_shelf_view.cc |
| index ec8b4f1274dd9a4e22e236ba5a6f301d6e1e7db5..fd826322ff98749656318210becc4b4d376e1cb2 100644 |
| --- a/chrome/browser/ui/views/download/download_shelf_view.cc |
| +++ b/chrome/browser/ui/views/download/download_shelf_view.cc |
| @@ -167,6 +167,27 @@ void DownloadShelfView::RemoveDownloadView(View* view) { |
| SchedulePaint(); |
| } |
| +void DownloadShelfView::ConfigureButtonForTheme(views::MdTextButton* button) { |
| + if (!GetThemeProvider()) |
| + return; |
| + |
| + const SkColor bg_color = |
| + GetThemeProvider()->GetColor(ThemeProperties::COLOR_TOOLBAR); |
| + set_background(views::Background::CreateSolidBackground(bg_color)); |
|
msw
2016/10/20 21:54:05
Why would each call to ConfigureButtonForTheme cha
Evan Stade
2016/10/20 23:11:02
no reason, done
|
| + button->SetEnabledTextColors( |
| + GetThemeProvider()->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT)); |
| + if (ThemeServiceFactory::GetForProfile(browser_->profile()) |
| + ->UsingDefaultTheme()) { |
| + // For the normal theme, just use the default button bg color. |
| + button->SetBgColorOverride(base::Optional<SkColor>()); |
| + } else { |
| + // For custom themes, we have to make up a background color for the |
| + // button. Use a slight tint of the shelf background. |
| + button->SetBgColorOverride( |
| + color_utils::BlendTowardOppositeLuma(bg_color, 0x10)); |
| + } |
| +} |
| + |
| views::View* DownloadShelfView::GetDefaultFocusableChild() { |
| if (!download_views_.empty()) |
| return download_views_.back(); |
| @@ -310,23 +331,8 @@ bool DownloadShelfView::CanFitFirstDownloadItem() { |
| } |
| void DownloadShelfView::UpdateColorsFromTheme() { |
| - if (show_all_view_ && close_button_ && GetThemeProvider()) { |
| - const SkColor bg_color = |
| - GetThemeProvider()->GetColor(ThemeProperties::COLOR_TOOLBAR); |
| - set_background(views::Background::CreateSolidBackground(bg_color)); |
| - show_all_view_->SetEnabledTextColors( |
| - GetThemeProvider()->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT)); |
| - if (ThemeServiceFactory::GetForProfile(browser_->profile()) |
| - ->UsingDefaultTheme()) { |
| - // For the normal theme, just use the default button bg color. |
| - show_all_view_->SetBgColorOverride(base::Optional<SkColor>()); |
| - } else { |
| - // For custom themes, we have to make up a background color for the |
| - // button. Use a slight tint of the shelf background. |
| - show_all_view_->SetBgColorOverride( |
| - color_utils::BlendTowardOppositeLuma(bg_color, 0x10)); |
| - } |
| - } |
| + if (show_all_view_) |
| + ConfigureButtonForTheme(show_all_view_); |
| } |
| void DownloadShelfView::OnThemeChanged() { |