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

Unified Diff: chrome/browser/ui/views/download/download_item_view.cc

Issue 16018005: Use DownloadItem::GetState() in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Stopping complete_animation_ when download is cancelled Created 7 years, 6 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
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 43ca68679e050b2253eff132cef0d0f77d8cb4f4..9b7f385bc7d9d556dffc28fcb0ff9625798fa5a3 100644
--- a/chrome/browser/ui/views/download/download_item_view.cc
+++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -286,6 +286,8 @@ void DownloadItemView::OnDownloadUpdated(DownloadItem* download_item) {
break;
case DownloadItem::CANCELLED:
StopDownloadProgress();
+ if (complete_animation_)
+ complete_animation_->Stop();
LoadIcon();
break;
default:
@@ -405,7 +407,7 @@ bool DownloadItemView::OnMouseDragged(const ui::MouseEvent& event) {
drag_start_point_ = event.location();
}
if (dragging_) {
- if (download()->IsComplete()) {
+ if (download()->GetState() == DownloadItem::COMPLETE) {
IconManager* im = g_browser_process->icon_manager();
gfx::Image* icon = im->LookupIconFromFilepath(
download()->GetTargetFilePath(), IconLoader::SMALL);
@@ -787,19 +789,20 @@ void DownloadItemView::OnPaint(gfx::Canvas* canvas) {
// triggered only when we think the status might change.
if (icon) {
if (!IsShowingWarningDialog()) {
- if (download()->IsInProgress()) {
+ DownloadItem::DownloadState state = download()->GetState();
+ if (state == DownloadItem::IN_PROGRESS) {
download_util::PaintDownloadProgress(canvas, this, 0, 0,
progress_angle_,
model_.PercentComplete(),
download_util::SMALL);
- } else if (download()->IsComplete() &&
- complete_animation_.get() &&
+ } else if (complete_animation_.get() &&
complete_animation_->is_animating()) {
- if (download()->IsInterrupted()) {
+ if (state == DownloadItem::INTERRUPTED) {
download_util::PaintDownloadInterrupted(canvas, this, 0, 0,
complete_animation_->GetCurrentValue(),
download_util::SMALL);
} else {
+ DCHECK_EQ(DownloadItem::COMPLETE, state);
download_util::PaintDownloadComplete(canvas, this, 0, 0,
complete_animation_->GetCurrentValue(),
download_util::SMALL);
« no previous file with comments | « chrome/browser/ui/gtk/download/download_shelf_gtk.cc ('k') | chrome/browser/ui/views/download/download_shelf_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698