Chromium Code Reviews| Index: chrome/browser/ui/views/status_bubble_views.cc |
| diff --git a/chrome/browser/ui/views/status_bubble_views.cc b/chrome/browser/ui/views/status_bubble_views.cc |
| index 346f7b7b60931c9c188da7e68857f4b7b01e255a..c2c56cce3ab4821ec0bb5ba1685de173967e8dd7 100644 |
| --- a/chrome/browser/ui/views/status_bubble_views.cc |
| +++ b/chrome/browser/ui/views/status_bubble_views.cc |
| @@ -136,9 +136,8 @@ class StatusBubbleViews::StatusView : public views::View { |
| }; |
| StatusView(views::Widget* popup, |
| - const gfx::Size& popup_size_, |
| - SkColor bubble_color, |
| - SkColor bubble_text_color, |
| + const gfx::Size& popup_size, |
| + const ui::ThemeProvider* theme_provider, |
| bool has_client_edge); |
| ~StatusView() override; |
| @@ -201,8 +200,7 @@ class StatusBubbleViews::StatusView : public views::View { |
| gfx::Size popup_size_; |
| - const SkColor bubble_color_; |
| - const SkColor bubble_text_color_; |
| + const ui::ThemeProvider* theme_provider_; |
| const bool has_client_edge_; |
| base::WeakPtrFactory<StatusBubbleViews::StatusView> timer_factory_; |
| @@ -210,18 +208,17 @@ class StatusBubbleViews::StatusView : public views::View { |
| DISALLOW_COPY_AND_ASSIGN(StatusView); |
| }; |
| -StatusBubbleViews::StatusView::StatusView(views::Widget* popup, |
| - const gfx::Size& popup_size, |
| - SkColor bubble_color, |
| - SkColor bubble_text_color, |
| - bool has_client_edge) |
| +StatusBubbleViews::StatusView::StatusView( |
| + views::Widget* popup, |
| + const gfx::Size& popup_size, |
| + const ui::ThemeProvider* theme_provider, |
|
Peter Kasting
2016/09/24 06:07:40
So I know we're on the same page, the other soluti
Bret
2016/09/24 19:28:36
Windows does nuke the class when the theme changes
|
| + bool has_client_edge) |
| : state_(BUBBLE_HIDDEN), |
| style_(STYLE_STANDARD), |
| animation_(new StatusViewAnimation(this, 0, 0)), |
| popup_(popup), |
| popup_size_(popup_size), |
| - bubble_color_(bubble_color), |
| - bubble_text_color_(bubble_text_color), |
| + theme_provider_(theme_provider), |
| has_client_edge_(has_client_edge), |
| timer_factory_(this) {} |
| @@ -470,7 +467,9 @@ void StatusBubbleViews::StatusView::OnPaint(gfx::Canvas* canvas) { |
| SkPath fill_path; |
| Op(path, stroke_path, kDifference_SkPathOp, &fill_path); |
| paint.setStyle(SkPaint::kFill_Style); |
| - paint.setColor(bubble_color_); |
| + const SkColor bubble_color = |
| + theme_provider_->GetColor(ThemeProperties::COLOR_TOOLBAR); |
| + paint.setColor(bubble_color); |
| canvas->sk_canvas()->drawPath(fill_path, paint); |
| paint.setColor(kShadowColor); |
| @@ -487,11 +486,12 @@ void StatusBubbleViews::StatusView::OnPaint(gfx::Canvas* canvas) { |
| text_rect.set_x(GetMirroredXForRect(text_rect)); |
| // Text color is the foreground tab text color at 60% alpha. |
| - SkColor blended_text_color = |
| - color_utils::AlphaBlend(bubble_text_color_, bubble_color_, 0x99); |
| + SkColor blended_text_color = color_utils::AlphaBlend( |
| + theme_provider_->GetColor(ThemeProperties::COLOR_TAB_TEXT), bubble_color, |
| + 0x99); |
| canvas->DrawStringRect( |
| text_, gfx::FontList(), |
| - color_utils::GetReadableColor(blended_text_color, bubble_color_), |
| + color_utils::GetReadableColor(blended_text_color, bubble_color), |
| text_rect); |
| } |
| @@ -634,12 +634,8 @@ void StatusBubbleViews::Init() { |
| popup_.reset(new views::Widget); |
| views::Widget* frame = base_view_->GetWidget(); |
| if (!view_) { |
| - const ui::ThemeProvider* theme_provider = frame->GetThemeProvider(); |
| - view_ = new StatusView( |
| - popup_.get(), size_, |
| - theme_provider->GetColor(ThemeProperties::COLOR_TOOLBAR), |
| - theme_provider->GetColor(ThemeProperties::COLOR_TAB_TEXT), |
| - has_client_edge_); |
| + view_ = new StatusView(popup_.get(), size_, frame->GetThemeProvider(), |
| + has_client_edge_); |
| } |
| if (!expand_view_.get()) |
| expand_view_.reset(new StatusViewExpander(this, view_)); |