diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-10 18:50:32 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-10 18:50:32 +0000 |
commit | 9ccbb370aa45f477941e0599d4ce7c89fac64101 (patch) | |
tree | 8b21818fa95d05ff00dfe5b9986d1d39eb4be722 /chrome/browser/views/download_tab_view.h | |
parent | a9acde54584ff37bcc5fad73cf25dce5d85348bc (diff) | |
download | chromium_src-9ccbb370aa45f477941e0599d4ce7c89fac64101.zip chromium_src-9ccbb370aa45f477941e0599d4ce7c89fac64101.tar.gz chromium_src-9ccbb370aa45f477941e0599d4ce7c89fac64101.tar.bz2 |
This CL adds prompting for dangerous types of files (executable) when they are automatically downloaded.
The file is saved with a temporary name (dangerous_download_xxxx.download) in the download directory and the user is presented (in the download shelf and the download tab if opened) with a warning message and buttons to save/discard the download.
If discarded the download is removed (and its file deleted).
If saved, download goes as usual.
Dangerous downloads not confirmed by the user are deleted on shutdown.
TEST=Download a small exe file, try using the save/discard button from the download shelf and from the download tab (the intent is that the file has been entirely downloaded by the time you take action). Try again with a slow/big download (that time the download is expected not to be finished when approved/discarded).
Review URL: http://codereview.chromium.org/6043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3228 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/download_tab_view.h')
-rw-r--r-- | chrome/browser/views/download_tab_view.h | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/chrome/browser/views/download_tab_view.h b/chrome/browser/views/download_tab_view.h index 5c1b2ec..f78ee4a 100644 --- a/chrome/browser/views/download_tab_view.h +++ b/chrome/browser/views/download_tab_view.h @@ -25,7 +25,8 @@ class Timer; } class DownloadItemTabView : public ChromeViews::View, - public ChromeViews::LinkController { + public ChromeViews::LinkController, + public ChromeViews::NativeButton::Listener { public: DownloadItemTabView(); virtual ~DownloadItemTabView(); @@ -44,10 +45,14 @@ class DownloadItemTabView : public ChromeViews::View, void LayoutComplete(); void LayoutCancelled(); void LayoutInProgress(); + void LayoutPromptDangerousDownload(); // LinkController overrides virtual void LinkActivated(ChromeViews::Link* source, int event_flags); + // NativeButton Listener overrides. + virtual void ButtonPressed(ChromeViews::NativeButton* sender); + // Used to set our model temporarily during layout and paint operations void SetModel(DownloadItem* model, DownloadTabView* parent); @@ -58,6 +63,9 @@ private: // Containing view. DownloadTabView* parent_; + // Whether we are the renderer for floating views. + bool is_floating_view_renderer_; + // Time display. ChromeViews::Label* since_; ChromeViews::Label* date_; @@ -72,11 +80,19 @@ private: ChromeViews::Label* time_remaining_; ChromeViews::Label* download_progress_; + // The message warning of a dangerous download. + ChromeViews::Label* dangerous_download_warning_; + // Actions that can be initiated. ChromeViews::Link* pause_; ChromeViews::Link* cancel_; ChromeViews::Link* show_; + // The buttons used to prompt the user when a dangerous download has been + // initiated. + ChromeViews::NativeButton* save_button_; + ChromeViews::NativeButton* discard_button_; + DISALLOW_EVIL_CONSTRUCTORS(DownloadItemTabView); }; @@ -154,10 +170,14 @@ class DownloadTabView : public ChromeViews::View, // Initiates an asynchronous icon extraction. void LoadIcon(DownloadItem* download); - // Clears the list of "in progress" downloads and removes the this - // DownloadTabView from their observer list. + // Clears the list of "in progress" downloads and removes this DownloadTabView + // from their observer list. void ClearDownloadInProgress(); + // Clears the list of dangerous downloads and removes this DownloadTabView + // from their observer list. + void ClearDangerousDownloads(); + // Our model DownloadManager* model_; @@ -178,6 +198,10 @@ class DownloadTabView : public ChromeViews::View, // does not own the DownloadItems. base::hash_set<DownloadItem*> in_progress_; + // Keeps track of the downloads we are an observer for as a consequence of + // being a dangerous download. + base::hash_set<DownloadItem*> dangerous_downloads_; + // Provide a start position for downloads with no known size. int start_angle_; |