Index: ash/shelf/shelf_button.cc |
diff --git a/ash/shelf/shelf_button.cc b/ash/shelf/shelf_button.cc |
index 328fe5180694112bd59d89976e3d58ababbcc2a2..14dd82f468fb3fb1d7af5786cd3e7c70aa5b7b21 100644 |
--- a/ash/shelf/shelf_button.cc |
+++ b/ash/shelf/shelf_button.cc |
@@ -37,6 +37,10 @@ const int kIconPad = 5; |
const int kIconPadVertical = 6; |
const int kAttentionThrobDurationMS = 800; |
const int kMaxAnimationSeconds = 10; |
+const int kShelfIconHeight = 48; |
+const int kShelfIconWidth = 48; |
+const int kBarPadVertical = 3; |
+const int kBarRadius = 2; |
// Simple AnimationDelegate that owns a single ThrobAnimation instance to |
// keep all Draw Attention animations in sync. |
@@ -486,8 +490,12 @@ void ShelfButton::UpdateBar() { |
if (bar_id != 0) { |
Shelf* shelf = shelf_view_->shelf(); |
- ResourceBundle* rb = &ResourceBundle::GetSharedInstance(); |
- gfx::ImageSkia image = *rb->GetImageNamed(bar_id).ToImageSkia(); |
+ // ResourceBundle* rb = &ResourceBundle::GetSharedInstance(); |
varkha
2016/04/28 16:49:03
nit: You probably want to remove this before landi
yiyix
2016/05/02 15:55:04
I keep these lines, so it is easier to add the ash
|
+ // gfx::ImageSkia image = *rb->GetImageNamed(bar_id).ToImageSkia(); |
bruthig
2016/04/27 18:56:00
FYI You will need to 'hide' this feature behind th
yiyix
2016/05/02 15:55:03
Done.
|
+ gfx::Canvas canvas(gfx::Size(kShelfIconHeight, kShelfIconWidth), |
+ kShelfIconHeight, true /* is_opaque */); |
+ GetActivityIndicatorImage(canvas); |
+ gfx::ImageSkia image = gfx::ImageSkia(canvas.ExtractImageRep()); |
if (!shelf->IsHorizontalAlignment()) { |
image = gfx::ImageSkiaOperations::CreateRotatedImage( |
image, shelf->alignment() == SHELF_ALIGNMENT_LEFT |
@@ -503,8 +511,16 @@ void ShelfButton::UpdateBar() { |
views::ImageView::CENTER)); |
bar_->SchedulePaint(); |
} |
- |
bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); |
} |
+void ShelfButton::GetActivityIndicatorImage(gfx::Canvas& canvas) { |
+ SkCanvas* skcanvas = canvas.sk_canvas(); |
+ SkPaint paint; |
bruthig
2016/04/27 18:56:00
Make sure to #include everything you use. i.e. Sk
yiyix
2016/05/02 15:55:04
Done.
|
+ paint.setColor(SK_ColorWHITE); |
bruthig
2016/04/27 18:56:00
nit: Assign SK_ColorWHITE to a constant above and
yiyix
2016/05/02 15:55:03
Done.
|
+ int patVertical = kBarPadVertical + kBarRadius; |
bruthig
2016/04/27 18:56:00
Should this be 'padVertical'?
yiyix
2016/05/02 15:55:03
Done.
|
+ skcanvas->drawCircle(kShelfIconWidth / 2, kShelfIconHeight - patVertical, 2, |
bruthig
2016/04/27 18:56:00
Is it necessary to paint to the SkCanvas or would
yiyix
2016/05/02 15:55:04
Good catch. I draw the circle in Canvas now.
|
+ paint); |
+} |
+ |
} // namespace ash |