diff options
author | mhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 05:28:29 +0000 |
---|---|---|
committer | mhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 05:28:29 +0000 |
commit | 731acac768c212b02df98e79f3355250c28e9253 (patch) | |
tree | 76b395bc6f59d7734e0980a30c9fec4a3cfe37d6 /chrome/browser/download | |
parent | b9ceb59eae3b0de56b4db47033cc0b192dcf12b5 (diff) | |
download | chromium_src-731acac768c212b02df98e79f3355250c28e9253.zip chromium_src-731acac768c212b02df98e79f3355250c28e9253.tar.gz chromium_src-731acac768c212b02df98e79f3355250c28e9253.tar.bz2 |
Add "Remove from list" for download item in the download shelf.
This would remove the download list (CTRL+J) as well.
BUG=60 (http://crbug.com/60)
TEST=Download a file from the net, download shelf appears, click the download item's arrow and "Remove from list". The item removes from the shelf and list.
Review URL: http://codereview.chromium.org/155749
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22143 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download')
-rw-r--r-- | chrome/browser/download/download_shelf.cc | 7 | ||||
-rw-r--r-- | chrome/browser/download/download_shelf.h | 9 |
2 files changed, 12 insertions, 4 deletions
diff --git a/chrome/browser/download/download_shelf.cc b/chrome/browser/download/download_shelf.cc index d3d6ade..2be924f 100644 --- a/chrome/browser/download/download_shelf.cc +++ b/chrome/browser/download/download_shelf.cc @@ -55,6 +55,8 @@ std::wstring DownloadShelfContextMenu::GetItemLabel(int id) const { return l10n_util::GetString(IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE); case CANCEL: return l10n_util::GetString(IDS_DOWNLOAD_MENU_CANCEL); + case REMOVE_ITEM: + return l10n_util::GetString(IDS_DOWNLOAD_MENU_REMOVE_ITEM); default: NOTREACHED(); } @@ -70,6 +72,8 @@ bool DownloadShelfContextMenu::IsItemCommandEnabled(int id) const { return download_util::CanOpenDownload(download_); case CANCEL: return download_->state() == DownloadItem::IN_PROGRESS; + case REMOVE_ITEM: + return download_->state() == DownloadItem::COMPLETE; default: return id > 0 && id < MENU_LAST; } @@ -93,6 +97,9 @@ void DownloadShelfContextMenu::ExecuteItemCommand(int id) { case CANCEL: model_->CancelTask(); break; + case REMOVE_ITEM: + download_->Remove(false); + break; default: NOTREACHED(); } diff --git a/chrome/browser/download/download_shelf.h b/chrome/browser/download/download_shelf.h index 61cae0e..6718a9b 100644 --- a/chrome/browser/download/download_shelf.h +++ b/chrome/browser/download/download_shelf.h @@ -51,10 +51,11 @@ class DownloadShelfContextMenu { explicit DownloadShelfContextMenu(BaseDownloadItemModel* download_model); enum ContextMenuCommands { - SHOW_IN_FOLDER = 1, // Open a file explorer window with the item selected - OPEN_WHEN_COMPLETE, // Open the download when it's finished - ALWAYS_OPEN_TYPE, // Default this file extension to always open - CANCEL, // Cancel the download + SHOW_IN_FOLDER = 1, // Open a file explorer window with the item selected. + OPEN_WHEN_COMPLETE, // Open the download when it's finished. + ALWAYS_OPEN_TYPE, // Default this file extension to always open. + CANCEL, // Cancel the download. + REMOVE_ITEM, // Removes the item from the download shelf. MENU_LAST }; |