Chromium Code Reviews| Index: ui/app_list/views/app_list_item_view.cc |
| diff --git a/ui/app_list/views/app_list_item_view.cc b/ui/app_list/views/app_list_item_view.cc |
| index e481cb46cc9854ba9887cfd19f821d5a23b076ae..6c2debbb396348a3100a82c554f18f3885639414 100644 |
| --- a/ui/app_list/views/app_list_item_view.cc |
| +++ b/ui/app_list/views/app_list_item_view.cc |
| @@ -31,6 +31,9 @@ namespace { |
| const int kTopBottomPadding = 10; |
| const int kTopPadding = 20; |
| const int kIconTitleSpacing = 7; |
| +const int kProgressBarHorizontalPadding = 8; |
| +const int kProgressBarVerticalPadding = 4; |
| +const int kProgressBarHeight = 4; |
| const SkColor kTitleColor = SkColorSetRGB(0x5A, 0x5A, 0x5A); |
| const SkColor kTitleHoverColor = SkColorSetRGB(0x3C, 0x3C, 0x3C); |
| @@ -38,6 +41,9 @@ const SkColor kTitleHoverColor = SkColorSetRGB(0x3C, 0x3C, 0x3C); |
| const SkColor kHoverAndPushedColor = SkColorSetARGB(0x19, 0, 0, 0); |
| const SkColor kSelectedColor = SkColorSetARGB(0x0D, 0, 0, 0); |
| const SkColor kHighlightedColor = kHoverAndPushedColor; |
| +const SkColor kDownloadProgressBackgroundColor = |
| + SkColorSetRGB(0x90, 0x90, 0x90); |
| +const SkColor kDownloadProgressColor = SkColorSetRGB(0x20, 0xAA, 0x20); |
| const int kLeftRightPaddingChars = 1; |
| @@ -168,6 +174,16 @@ void AppListItemView::ItemHighlightedChanged() { |
| SchedulePaint(); |
| } |
| +void AppListItemView::ItemIsInstallingChanged() { |
| + apps_grid_view_->EnsureViewVisible(this); |
|
xiyuan
2013/02/06 07:30:50
Can we just do it when model_->is_installing() is
koz (OOO until 15th September)
2013/02/06 07:40:55
Good point, done.
|
| + SchedulePaint(); |
| +} |
| + |
| +void AppListItemView::ItemPercentDownloadedChanged() { |
| + apps_grid_view_->EnsureViewVisible(this); |
|
xiyuan
2013/02/06 07:30:50
Calling it here would prevent user from switching
koz (OOO until 15th September)
2013/02/06 07:40:55
Done.
|
| + SchedulePaint(); |
| +} |
| + |
| std::string AppListItemView::GetClassName() const { |
| return kViewClassName; |
| } |
| @@ -210,6 +226,25 @@ void AppListItemView::OnPaint(gfx::Canvas* canvas) { |
| } else if (apps_grid_view_->IsSelectedView(this)) { |
| canvas->FillRect(rect, kSelectedColor); |
| } |
| + |
| + if (model_->is_installing()) { |
| + gfx::Rect progress_bar_background( |
| + rect.x() + kProgressBarHorizontalPadding, |
| + rect.bottom() - kProgressBarVerticalPadding - kProgressBarHeight, |
| + rect.width() - 2 * kProgressBarHorizontalPadding, |
| + kProgressBarHeight); |
| + canvas->FillRect(progress_bar_background, kDownloadProgressBackgroundColor); |
| + |
| + if (model_->percent_downloaded() != -1) { |
| + float percent = model_->percent_downloaded() / 100.0; |
| + gfx::Rect progress_bar( |
| + progress_bar_background.x(), |
| + progress_bar_background.y(), |
| + progress_bar_background.width() * percent, |
| + progress_bar_background.height()); |
| + canvas->FillRect(progress_bar, kDownloadProgressColor); |
| + } |
| + } |
| } |
| void AppListItemView::GetAccessibleState(ui::AccessibleViewState* state) { |