summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/download_item_view.h
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 19:58:03 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 19:58:03 +0000
commit45e3c12431d29fc90143a03b0b318f4cf2021b4e (patch)
treee1b4009b34c64f0d2d6d60200928241910e651e3 /chrome/browser/views/download_item_view.h
parentd3278a9a559f409e717c70fa926bdd3f9f39e486 (diff)
downloadchromium_src-45e3c12431d29fc90143a03b0b318f4cf2021b4e.zip
chromium_src-45e3c12431d29fc90143a03b0b318f4cf2021b4e.tar.gz
chromium_src-45e3c12431d29fc90143a03b0b318f4cf2021b4e.tar.bz2
Disables the download item on the download-shelf when the file is opened.
This is to mitigate against multiple clicks when a file takes some time to show anything to the user when opened (typically a setup.exe). By changing the title and disabling the button, we indicate to the user that an action was taken. BUG=7264 TEST=Download a file (image for example). In the download shelf, press the download item. The download item text should change to "Opening..." and it should be disabled (not responsive to clicks/drag and drops). Review URL: http://codereview.chromium.org/58014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13273 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/download_item_view.h')
-rw-r--r--chrome/browser/views/download_item_view.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/chrome/browser/views/download_item_view.h b/chrome/browser/views/download_item_view.h
index d266935..4cd805f 100644
--- a/chrome/browser/views/download_item_view.h
+++ b/chrome/browser/views/download_item_view.h
@@ -50,6 +50,7 @@ class DownloadItemView : public views::ButtonListener,
// DownloadObserver method
virtual void OnDownloadUpdated(DownloadItem* download);
+ virtual void OnDownloadOpened(DownloadItem* download);
// View overrides
virtual void Layout();
@@ -136,6 +137,10 @@ class DownloadItemView : public views::ButtonListener,
// and simply returned on subsequent calls.
void SizeLabelToMinWidth();
+ // Reenables the item after it has been disabled when a user clicked it to
+ // open the downloaded file.
+ void Reenable();
+
// The different images used for the background.
BodyImageSet normal_body_image_set_;
BodyImageSet hot_body_image_set_;
@@ -220,6 +225,13 @@ class DownloadItemView : public views::ButtonListener,
// The size of the buttons. Cached so animation works when hidden.
gfx::Size cached_button_size_;
+ // Whether we are currently disabled as part of opening the downloaded file.
+ bool disabled_while_opening_;
+
+ // Method factory used to delay reenabling of the item when opening the
+ // downloaded file.
+ ScopedRunnableMethodFactory<DownloadItemView> reenable_method_factory_;
+
DISALLOW_COPY_AND_ASSIGN(DownloadItemView);
};