summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkoz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-13 11:53:13 +0000
committerkoz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-13 11:53:13 +0000
commitd8e8864b7d39810c3ebab45595bc343def86de7b (patch)
tree8491f169057459f3f2f54a20a01bf9521fdd08ec
parentf900ab5c21998b9b727a99176428ce3db4f617ee (diff)
downloadchromium_src-d8e8864b7d39810c3ebab45595bc343def86de7b.zip
chromium_src-d8e8864b7d39810c3ebab45595bc343def86de7b.tar.gz
chromium_src-d8e8864b7d39810c3ebab45595bc343def86de7b.tar.bz2
Make the app list use images for the progress bar.
BUG=152854 Review URL: https://chromiumcodereview.appspot.com/12217129 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182195 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ui/app_list/DEPS1
-rw-r--r--ui/app_list/app_list.gyp1
-rw-r--r--ui/app_list/views/app_list_item_view.cc39
-rw-r--r--ui/resources/ui_resources.grd6
4 files changed, 33 insertions, 14 deletions
diff --git a/ui/app_list/DEPS b/ui/app_list/DEPS
index 4bb0b29..494c79b 100644
--- a/ui/app_list/DEPS
+++ b/ui/app_list/DEPS
@@ -2,6 +2,7 @@ include_rules = [
"+skia",
"+third_party/skia",
"+ui",
+ "+grit",
# Allow inclusion of third-party code:
"+third_party/GTM", # Google Toolbox for Mac.
diff --git a/ui/app_list/app_list.gyp b/ui/app_list/app_list.gyp
index 1572368..7732c5f 100644
--- a/ui/app_list/app_list.gyp
+++ b/ui/app_list/app_list.gyp
@@ -16,6 +16,7 @@
'../../skia/skia.gyp:skia',
'../compositor/compositor.gyp:compositor',
'../ui.gyp:ui',
+ '../ui.gyp:ui_resources',
],
'defines': [
'APP_LIST_IMPLEMENTATION',
diff --git a/ui/app_list/views/app_list_item_view.cc b/ui/app_list/views/app_list_item_view.cc
index 4793a99..545e533 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/ui_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;
@@ -75,6 +76,7 @@ AppListItemView::AppListItemView(AppsGridView* apps_grid_view,
title_->SetEnabledColor(kTitleColor);
title_->SetFont(rb.GetFont(ui::ResourceBundle::SmallBoldFont));
title_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ title_->SetVisible(!model_->is_installing());
const gfx::ShadowValue kIconShadows[] = {
gfx::ShadowValue(gfx::Point(0, 2), 2, SkColorSetARGB(0x24, 0, 0, 0)),
@@ -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();
}
@@ -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);
}
}
}
diff --git a/ui/resources/ui_resources.grd b/ui/resources/ui_resources.grd
index ccac364..d44f283 100644
--- a/ui/resources/ui_resources.grd
+++ b/ui/resources/ui_resources.grd
@@ -20,6 +20,12 @@
<!-- KEEP THESE IN ALPHABETICAL ORDER! DO NOT ADD TO RANDOM PLACES JUST
BECAUSE YOUR RESOURCES ARE FUNCTIONALLY RELATED OR FALL UNDER THE
SAME CONDITIONALS. -->
+ <if expr="pp_ifdef('enable_app_list')">
+ <structure type="chrome_scaled_image" name="IDR_APP_LIST_ITEM_PROGRESS_BACKGROUND" file="common/app_list_progress_bar_background.png" />
+ <structure type="chrome_scaled_image" name="IDR_APP_LIST_ITEM_PROGRESS_LEFT" file="common/app_list_progress_bar_left.png" />
+ <structure type="chrome_scaled_image" name="IDR_APP_LIST_ITEM_PROGRESS_CENTER" file="common/app_list_progress_bar_center.png" />
+ <structure type="chrome_scaled_image" name="IDR_APP_LIST_ITEM_PROGRESS_RIGHT" file="common/app_list_progress_bar_right.png" />
+ </if>
<structure type="chrome_scaled_image" name="IDR_APP_TOP_CENTER" file="app_top_center.png" />
<if expr="pp_ifdef('toolkit_views')">
<structure type="chrome_scaled_image" name="IDR_APP_TOP_LEFT" file="app_top_left.png" />