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 4793a994a01be069183ab3856c8c1d0bbebadbd2..21ff9349e2b5b4dca9fb9eccc3a67c7d7195d778 100644 |
--- a/ui/app_list/views/app_list_item_view.cc |
+++ b/ui/app_list/views/app_list_item_view.cc |
@@ -7,6 +7,8 @@ |
#include <algorithm> |
#include "base/utf_string_conversions.h" |
+#include "grit/generated_resources.h" |
+#include "grit/theme_resources.h" |
benwells
2013/02/12 07:55:17
Again, do we need generated resources here? I thou
koz (OOO until 15th September)
2013/02/12 08:20:11
Right you are. Done.
|
#include "ui/app_list/app_list_item_model.h" |
#include "ui/app_list/views/apps_grid_view.h" |
#include "ui/base/accessibility/accessible_view_state.h" |
@@ -31,7 +33,7 @@ namespace { |
const int kTopBottomPadding = 10; |
const int kTopPadding = 20; |
const int kIconTitleSpacing = 7; |
-const int kProgressBarHorizontalPadding = 8; |
+const int kProgressBarHorizontalPadding = 12; |
const int kProgressBarVerticalPadding = 4; |
const int kProgressBarHeight = 4; |
@@ -177,6 +179,7 @@ void AppListItemView::ItemHighlightedChanged() { |
void AppListItemView::ItemIsInstallingChanged() { |
if (model_->is_installing()) |
apps_grid_view_->EnsureViewVisible(this); |
+ title_->SetVisible(!model_->is_installing()); |
SchedulePaint(); |
} |
@@ -207,6 +210,7 @@ void AppListItemView::Layout() { |
title_size.height()); |
title_bounds.Intersect(rect); |
title_->SetBoundsRect(title_bounds); |
+ title_->SetVisible(!model_->is_installing()); |
} |
void AppListItemView::OnPaint(gfx::Canvas* canvas) { |
@@ -228,21 +232,32 @@ void AppListItemView::OnPaint(gfx::Canvas* canvas) { |
} |
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); |
- |
+ gfx::ImageSkia background = *ResourceBundle::GetSharedInstance(). |
+ GetImageSkiaNamed(IDR_APP_LIST_ITEM_PROGRESS_BACKGROUND); |
+ gfx::ImageSkia left = *ResourceBundle::GetSharedInstance(). |
+ GetImageSkiaNamed(IDR_APP_LIST_ITEM_PROGRESS_LEFT); |
+ gfx::ImageSkia center = *ResourceBundle::GetSharedInstance(). |
+ GetImageSkiaNamed(IDR_APP_LIST_ITEM_PROGRESS_CENTER); |
+ gfx::ImageSkia right = *ResourceBundle::GetSharedInstance(). |
+ GetImageSkiaNamed(IDR_APP_LIST_ITEM_PROGRESS_RIGHT); |
+ |
+ int bar_x = rect.x() + kProgressBarHorizontalPadding; |
+ int bar_y = |
+ icon_->bounds().bottom() + kIconTitleSpacing; |
benwells
2013/02/12 07:55:17
This can fit on one line.
koz (OOO until 15th September)
2013/02/12 08:20:11
Done.
|
+ // rect.y() + icon_size_.height() + kIconTitleSpacing; |
benwells
2013/02/12 07:55:17
Did you mean these comments to be here?
koz (OOO until 15th September)
2013/02/12 08:20:11
Done.
|
+ // rect.bottom() - kProgressBarVerticalPadding - kProgressBarHeight; |
+ |
+ canvas->DrawImageInt(background, bar_x, bar_y); |
if (model_->percent_downloaded() != -1) { |
benwells
2013/02/12 07:55:17
Should this be > 0?
koz (OOO until 15th September)
2013/02/12 08:20:11
No, on a 0 percent downloaded item we still want t
|
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); |
+ int bar_width = percent * |
+ (background.width() - (left.width() + right.width())); |
+ |
+ canvas->DrawImageInt(left, bar_x, bar_y); |
+ int x = bar_x + left.width(); |
+ canvas->TileImageInt(center, x, bar_y, bar_width, center.height()); |
+ x += bar_width; |
+ canvas->DrawImageInt(right, x, bar_y); |
} |
} |
} |