summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-24 18:09:10 +0000
committerskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-24 18:09:10 +0000
commitfabf529873f4cd782ec98980853365c161d65f48 (patch)
tree532a477780661b17410151b822f055269ba85440
parent8ccd594df1c045bc26def7ba623e262bd0d43218 (diff)
downloadchromium_src-fabf529873f4cd782ec98980853365c161d65f48.zip
chromium_src-fabf529873f4cd782ec98980853365c161d65f48.tar.gz
chromium_src-fabf529873f4cd782ec98980853365c161d65f48.tar.bz2
Reload the icon in the download shelf if the path changes while in progress.
BUG=87308 TEST=Download and install sample theme with lots of large images. Review URL: http://codereview.chromium.org/7248020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90387 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/views/download/download_item_view.cc12
-rw-r--r--chrome/browser/ui/views/download/download_item_view.h6
2 files changed, 17 insertions, 1 deletions
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc
index 567e702..2aa0558 100644
--- a/chrome/browser/ui/views/download/download_item_view.cc
+++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -347,6 +347,7 @@ void DownloadItemView::OnDownloadUpdated(DownloadItem* download) {
switch (download_->state()) {
case DownloadItem::IN_PROGRESS:
download_->is_paused() ? StopDownloadProgress() : StartDownloadProgress();
+ LoadIconIfItemPathChanged();
break;
case DownloadItem::INTERRUPTED:
StopDownloadProgress();
@@ -925,11 +926,20 @@ void DownloadItemView::OpenDownload() {
void DownloadItemView::LoadIcon() {
IconManager* im = g_browser_process->icon_manager();
- im->LoadIcon(download_->GetUserVerifiedFilePath(),
+ last_download_item_path_ = download_->GetUserVerifiedFilePath();
+ im->LoadIcon(last_download_item_path_,
IconLoader::SMALL, &icon_consumer_,
NewCallback(this, &DownloadItemView::OnExtractIconComplete));
}
+void DownloadItemView::LoadIconIfItemPathChanged() {
+ FilePath current_download_path = download_->GetUserVerifiedFilePath();
+ if (last_download_item_path_ == current_download_path)
+ return;
+
+ LoadIcon();
+}
+
// Load an icon for the file type we're downloading, and animate any in progress
// download state.
void DownloadItemView::PaintBitmaps(gfx::Canvas* canvas,
diff --git a/chrome/browser/ui/views/download/download_item_view.h b/chrome/browser/ui/views/download/download_item_view.h
index bc6264e..100a5c5 100644
--- a/chrome/browser/ui/views/download/download_item_view.h
+++ b/chrome/browser/ui/views/download/download_item_view.h
@@ -134,6 +134,7 @@ class DownloadItemView : public views::ButtonListener,
void OpenDownload();
void LoadIcon();
+ void LoadIconIfItemPathChanged();
// Convenience method to paint the 3 vertical bitmaps (bottom, middle, top)
// that form the background.
@@ -285,6 +286,11 @@ class DownloadItemView : public views::ButtonListener,
// The name of this view as reported to assistive technology.
string16 accessible_name_;
+ // The icon loaded in the download shelf is based on the file path of the
+ // item. Store the path used, so that we can detect a change in the path
+ // and reload the icon.
+ FilePath last_download_item_path_;
+
DISALLOW_COPY_AND_ASSIGN(DownloadItemView);
};