Commit 90a4f673 authored by Peter Kasting's avatar Peter Kasting Committed by Chromium LUCI CQ

Schedule download item paint each time new bytes are received.

This fixes a regression caused in r789502, which removed an apparently-
unnecessary SchedulePaint() call that was in fact necessary in some
cases.

Bug: 1145729
Change-Id: I37585cba537e725e0d34f41628295e5eca94bb91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2587652
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarMin Qin <qinmin@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836664}
parent 8191ae2f
...@@ -683,7 +683,7 @@ void DownloadItemView::UpdateMode(Mode mode) { ...@@ -683,7 +683,7 @@ void DownloadItemView::UpdateMode(Mode mode) {
// notifications would be redundant. // notifications would be redundant.
if (mode_ == Mode::kNormal) { if (mode_ == Mode::kNormal) {
UpdateAccessibleAlertAndTimersForNormalMode(); UpdateAccessibleAlertAndAnimationsForNormalMode();
} else if (is_download_warning(mode_)) { } else if (is_download_warning(mode_)) {
const auto danger_type = model_->GetDangerType(); const auto danger_type = model_->GetDangerType();
RecordDangerousDownloadWarningShown(danger_type); RecordDangerousDownloadWarningShown(danger_type);
...@@ -800,7 +800,7 @@ void DownloadItemView::UpdateButtons() { ...@@ -800,7 +800,7 @@ void DownloadItemView::UpdateButtons() {
dropdown_button_->SetVisible(model_->ShouldShowDropdown()); dropdown_button_->SetVisible(model_->ShouldShowDropdown());
} }
void DownloadItemView::UpdateAccessibleAlertAndTimersForNormalMode() { void DownloadItemView::UpdateAccessibleAlertAndAnimationsForNormalMode() {
using State = download::DownloadItem::DownloadState; using State = download::DownloadItem::DownloadState;
const State state = model_->GetState(); const State state = model_->GetState();
if ((state == State::IN_PROGRESS) && !model_->IsPaused()) { if ((state == State::IN_PROGRESS) && !model_->IsPaused()) {
...@@ -810,6 +810,11 @@ void DownloadItemView::UpdateAccessibleAlertAndTimersForNormalMode() { ...@@ -810,6 +810,11 @@ void DownloadItemView::UpdateAccessibleAlertAndTimersForNormalMode() {
indeterminate_progress_start_time_ = base::TimeTicks::Now(); indeterminate_progress_start_time_ = base::TimeTicks::Now();
indeterminate_progress_timer_.Reset(); indeterminate_progress_timer_.Reset();
} }
// For determinate progress, this function is called each time more data is
// received, which should result in updating the progress indicator.
if (model_->PercentComplete() > 0)
SchedulePaint();
return; return;
} }
......
...@@ -131,8 +131,8 @@ class DownloadItemView : public views::View, ...@@ -131,8 +131,8 @@ class DownloadItemView : public views::View,
// Updates the visible and enabled state of all buttons. // Updates the visible and enabled state of all buttons.
void UpdateButtons(); void UpdateButtons();
// Updates the accessible alert and timers for normal mode. // Updates the accessible alert and animation-related state for normal mode.
void UpdateAccessibleAlertAndTimersForNormalMode(); void UpdateAccessibleAlertAndAnimationsForNormalMode();
// Update accessible status text, and announce it if desired. // Update accessible status text, and announce it if desired.
void UpdateAccessibleAlert(const base::string16& alert); void UpdateAccessibleAlert(const base::string16& alert);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment