Commit c1b7cebf authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Refetch file icon when download completes.

Bug: 1116440
Change-Id: I969ef6466a56fdd8d4d76cc2d8abbeeeff830536
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2356969
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Min Qin <qinmin@chromium.org>
Reviewed-by: default avatarMin Qin <qinmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798716}
parent a866c351
......@@ -680,7 +680,7 @@ DownloadItemView::Mode DownloadItemView::GetDesiredMode() const {
void DownloadItemView::UpdateMode(Mode mode) {
mode_ = mode;
UpdateFilePath();
UpdateFilePathAndIcons();
UpdateLabels();
UpdateButtons();
......@@ -720,9 +720,13 @@ void DownloadItemView::UpdateMode(Mode mode) {
shelf_->InvalidateLayout();
}
void DownloadItemView::UpdateFilePath() {
void DownloadItemView::UpdateFilePathAndIcons() {
// The file icon may change when the download completes, and the path to look
// up is |file_path_| and thus changes if that changes. If neither of those
// is the case, there's nothing to do.
const base::FilePath file_path = model_->GetTargetFilePath();
if (file_path_ == file_path)
if ((model_->GetState() != download::DownloadItem::COMPLETE) &&
(file_path_ == file_path))
return;
file_path_ = file_path;
......
......@@ -126,7 +126,7 @@ class DownloadItemView : public views::View,
// Updates the file path, and if necessary, begins loading the file icon in
// various sizes. This may eventually result in a callback to
// OnFileIconLoaded().
void UpdateFilePath();
void UpdateFilePathAndIcons();
// Updates the visibility, text, size, etc. of all labels.
void UpdateLabels();
......
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