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

Unified Diff: chrome/browser/ui/views/download/download_shelf_view.cc

Issue 2439873002: Make all text buttons on download shelf work well with themes, not just (Closed)
Patch Set: dont set bg Created 4 years, 2 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/ui/views/download/download_shelf_view.h ('k') | ui/views/controls/button/md_text_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c9fcae9bbb09732462db62f9bc763f054c699399 100644
--- a/chrome/browser/ui/views/download/download_shelf_view.cc
+++ b/chrome/browser/ui/views/download/download_shelf_view.cc
@@ -167,6 +167,23 @@ void DownloadShelfView::RemoveDownloadView(View* view) {
SchedulePaint();
}
+void DownloadShelfView::ConfigureButtonForTheme(views::MdTextButton* button) {
+ DCHECK(GetThemeProvider());
+
+ button->SetEnabledTextColors(
+ GetThemeProvider()->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT));
+ // For the normal theme, just use the default button bg color.
+ base::Optional<SkColor> bg_color;
+ if (!ThemeServiceFactory::GetForProfile(browser_->profile())
+ ->UsingDefaultTheme()) {
+ // For custom themes, we have to make up a background color for the
+ // button. Use a slight tint of the shelf background.
+ bg_color = color_utils::BlendTowardOppositeLuma(
+ GetThemeProvider()->GetColor(ThemeProperties::COLOR_TOOLBAR), 0x10);
+ }
+ button->SetBgColorOverride(bg_color);
+}
+
views::View* DownloadShelfView::GetDefaultFocusableChild() {
if (!download_views_.empty())
return download_views_.back();
@@ -310,23 +327,14 @@ 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 (!GetThemeProvider())
+ return;
+
+ if (show_all_view_)
+ ConfigureButtonForTheme(show_all_view_);
+
+ set_background(views::Background::CreateSolidBackground(
+ GetThemeProvider()->GetColor(ThemeProperties::COLOR_TOOLBAR)));
}
void DownloadShelfView::OnThemeChanged() {
« no previous file with comments | « chrome/browser/ui/views/download/download_shelf_view.h ('k') | ui/views/controls/button/md_text_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698