Chromium Code Reviews| Index: ui/views/controls/throbber.cc |
| diff --git a/ui/views/controls/throbber.cc b/ui/views/controls/throbber.cc |
| index 9ecdbd7303236fe9870900ce12a67147ba30c205..f72659a000dae08b504314c406b50e5d5a9a2330 100644 |
| --- a/ui/views/controls/throbber.cc |
| +++ b/ui/views/controls/throbber.cc |
| @@ -10,6 +10,7 @@ |
| #include "ui/gfx/image/image.h" |
| #include "ui/gfx/image/image_skia.h" |
| #include "ui/gfx/paint_throbber.h" |
| +#include "ui/gfx/vector_icons.h" |
| #include "ui/native_theme/common_theme.h" |
| #include "ui/native_theme/native_theme.h" |
| #include "ui/resources/grit/ui_resources.h" |
| @@ -17,7 +18,7 @@ |
| namespace views { |
| -Throbber::Throbber() : checked_(false), checkmark_(nullptr) { |
| +Throbber::Throbber() : checked_(false) { |
| } |
| Throbber::~Throbber() { |
| @@ -57,23 +58,20 @@ gfx::Size Throbber::GetPreferredSize() const { |
| } |
| void Throbber::OnPaint(gfx::Canvas* canvas) { |
| + SkColor color = GetNativeTheme()->GetSystemColor( |
| + ui::NativeTheme::kColorId_ThrobberSpinningColor); |
| + |
| if (!IsRunning()) { |
| if (checked_) { |
| - if (!checkmark_) { |
| - checkmark_ = ui::ResourceBundle::GetSharedInstance() |
| - .GetImageNamed(IDR_CHECKMARK) |
| - .ToImageSkia(); |
| - } |
| - |
| - int checkmark_x = (width() - checkmark_->width()) / 2; |
| - int checkmark_y = (height() - checkmark_->height()) / 2; |
| - canvas->DrawImageInt(*checkmark_, checkmark_x, checkmark_y); |
| + const int kDipSize = 18; |
|
Peter Kasting
2015/07/01 22:26:58
Hardcoding this makes me sad... is there any way t
Evan Stade
2015/07/02 00:08:06
Yea, it's tricky. 18 is the magic dp for which the
|
| + canvas->Translate(gfx::Vector2d((width() - kDipSize) / 2, |
| + (height() - kDipSize) / 2)); |
| + gfx::PaintVectorIcon(canvas, gfx::VectorIconId::CHECK_CIRCLE, kDipSize, |
| + color); |
| } |
| return; |
| } |
| - SkColor color = GetNativeTheme()->GetSystemColor( |
| - ui::NativeTheme::kColorId_ThrobberSpinningColor); |
| base::TimeDelta elapsed_time = base::TimeTicks::Now() - start_time_; |
| gfx::PaintThrobberSpinning(canvas, GetContentsBounds(), color, elapsed_time); |
| } |