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

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

Issue 12217129: Make the app list use images for the progress bar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: respond to comments 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/app_list.gyp ('k') | no next file » | 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 4793a994a01be069183ab3856c8c1d0bbebadbd2..66eab7851e8daca1b47c2c21a4d5810a45fdf773 100644
--- a/ui/app_list/views/app_list_item_view.cc
+++ b/ui/app_list/views/app_list_item_view.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/utf_string_conversions.h"
+#include "grit/theme_resources.h"
#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 +32,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 +178,7 @@ void AppListItemView::ItemHighlightedChanged() {
void AppListItemView::ItemIsInstallingChanged() {
if (model_->is_installing())
apps_grid_view_->EnsureViewVisible(this);
+ title_->SetVisible(!model_->is_installing());
SchedulePaint();
}
@@ -207,6 +209,7 @@ void AppListItemView::Layout() {
title_size.height());
title_bounds.Intersect(rect);
title_->SetBoundsRect(title_bounds);
+ title_->SetVisible(!model_->is_installing());
xiyuan 2013/02/12 17:38:40 We had the logic in ItemIsInstallingChanged alread
koz (OOO until 15th September) 2013/02/13 00:09:03 Experimentation told me I needed this here, but yo
}
void AppListItemView::OnPaint(gfx::Canvas* canvas) {
@@ -228,21 +231,29 @@ 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;
+
+ canvas->DrawImageInt(background, bar_x, bar_y);
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);
+ 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);
}
}
}
« no previous file with comments | « ui/app_list/app_list.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698