| Index: chrome/browser/ui/views/download/download_item_view.cc
|
| diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc
|
| index 77e704c7d965ead84a6b1a5c51abba7445384272..db59444c1693dd661dfdc98db981eaad9b213bdf 100644
|
| --- a/chrome/browser/ui/views/download/download_item_view.cc
|
| +++ b/chrome/browser/ui/views/download/download_item_view.cc
|
| @@ -96,16 +96,6 @@ static const int kDisabledOnOpenDuration = 3000;
|
| // light-on-dark themes.
|
| static const double kDownloadItemLuminanceMod = 0.8;
|
|
|
| -namespace {
|
| -
|
| -// Callback for DownloadShelf paint functions to mirror the progress animation
|
| -// in RTL locales.
|
| -void RTLMirrorXForView(views::View* containing_view, gfx::Rect* bounds) {
|
| - bounds->set_x(containing_view->GetMirroredXForRect(*bounds));
|
| -}
|
| -
|
| -} // namespace
|
| -
|
| DownloadItemView::DownloadItemView(DownloadItem* download_item,
|
| DownloadShelfView* parent)
|
| : warning_icon_(NULL),
|
| @@ -114,7 +104,6 @@ DownloadItemView::DownloadItemView(DownloadItem* download_item,
|
| body_state_(NORMAL),
|
| drop_down_state_(NORMAL),
|
| mode_(NORMAL_MODE),
|
| - progress_angle_(DownloadShelf::kStartAngleDegrees),
|
| drop_down_pressed_(false),
|
| dragging_(false),
|
| starting_drag_(false),
|
| @@ -244,19 +233,13 @@ DownloadItemView::~DownloadItemView() {
|
|
|
| // Progress animation handlers.
|
|
|
| -void DownloadItemView::UpdateDownloadProgress() {
|
| - progress_angle_ =
|
| - (progress_angle_ + DownloadShelf::kUnknownIncrementDegrees) %
|
| - DownloadShelf::kMaxDegrees;
|
| - SchedulePaint();
|
| -}
|
| -
|
| void DownloadItemView::StartDownloadProgress() {
|
| if (progress_timer_.IsRunning())
|
| return;
|
| - progress_timer_.Start(FROM_HERE,
|
| - base::TimeDelta::FromMilliseconds(DownloadShelf::kProgressRateMs), this,
|
| - &DownloadItemView::UpdateDownloadProgress);
|
| + progress_start_time_ = base::TimeTicks::Now();
|
| + progress_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(
|
| + DownloadShelf::kProgressRateMs),
|
| + this, &DownloadItemView::SchedulePaint);
|
| }
|
|
|
| void DownloadItemView::StopDownloadProgress() {
|
| @@ -870,23 +853,26 @@ void DownloadItemView::OnPaintBackground(gfx::Canvas* canvas) {
|
| if (icon) {
|
| if (!IsShowingWarningDialog()) {
|
| DownloadItem::DownloadState state = download()->GetState();
|
| - DownloadShelf::BoundsAdjusterCallback rtl_mirror =
|
| - base::Bind(&RTLMirrorXForView, base::Unretained(this));
|
| + canvas->Save();
|
| + if (base::i18n::IsRTL())
|
| + canvas->Translate(
|
| + gfx::Vector2d(width() - DownloadShelf::kSmallProgressIconSize, 0));
|
| +
|
| if (state == DownloadItem::IN_PROGRESS) {
|
| - DownloadShelf::PaintDownloadProgress(canvas, rtl_mirror, 0, 0,
|
| - progress_angle_,
|
| + DownloadShelf::PaintDownloadProgress(canvas, progress_start_time_,
|
| model_.PercentComplete());
|
| } else if (complete_animation_.get() &&
|
| complete_animation_->is_animating()) {
|
| if (state == DownloadItem::INTERRUPTED) {
|
| DownloadShelf::PaintDownloadInterrupted(
|
| - canvas, rtl_mirror, 0, 0, complete_animation_->GetCurrentValue());
|
| + canvas, complete_animation_->GetCurrentValue());
|
| } else {
|
| DCHECK_EQ(DownloadItem::COMPLETE, state);
|
| DownloadShelf::PaintDownloadComplete(
|
| - canvas, rtl_mirror, 0, 0, complete_animation_->GetCurrentValue());
|
| + canvas, complete_animation_->GetCurrentValue());
|
| }
|
| }
|
| + canvas->Restore();
|
| }
|
|
|
| // Draw the icon image.
|
|
|