Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Unified Diff: ui/app_list/views/app_list_item_view.cc

Issue 12208040: [win] Add a progress bar in the app launcher for app installs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux compile Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/views/app_list_item_view.h ('k') | ui/app_list/views/app_list_main_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4793a994a01be069183ab3856c8c1d0bbebadbd2 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() {
+ if (model_->is_installing())
+ apps_grid_view_->EnsureViewVisible(this);
+ SchedulePaint();
+}
+
+void AppListItemView::ItemPercentDownloadedChanged() {
+ 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) {
« no previous file with comments | « ui/app_list/views/app_list_item_view.h ('k') | ui/app_list/views/app_list_main_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698