Index: chrome/browser/download/download_shelf_context_menu.cc |
diff --git a/chrome/browser/download/download_shelf_context_menu.cc b/chrome/browser/download/download_shelf_context_menu.cc |
index 393436aae2d0be84e55908a348499a69853237d2..b7cd0d4c2c41c13ef9f41a8f29f81cdeced13e7d 100644 |
--- a/chrome/browser/download/download_shelf_context_menu.cc |
+++ b/chrome/browser/download/download_shelf_context_menu.cc |
@@ -4,12 +4,14 @@ |
#include "chrome/browser/download/download_shelf_context_menu.h" |
+#include "base/command_line.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/download/download_crx_util.h" |
#include "chrome/browser/download/download_item_model.h" |
#include "chrome/browser/download/download_prefs.h" |
#include "chrome/browser/safe_browsing/download_protection_service.h" |
#include "chrome/browser/safe_browsing/safe_browsing_service.h" |
+#include "chrome/common/chrome_switches.h" |
#include "chrome/common/extensions/extension.h" |
#include "content/public/browser/download_item.h" |
#include "content/public/browser/download_manager.h" |
@@ -46,6 +48,8 @@ ui::SimpleMenuModel* DownloadShelfContextMenu::GetMenuModel() { |
} |
bool DownloadShelfContextMenu::IsCommandIdEnabled(int command_id) const { |
+ static bool restart_enabled = CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableDownloadResumption); |
switch (command_id) { |
case SHOW_IN_FOLDER: |
return download_item_->CanShowInFolder() && |
@@ -65,7 +69,7 @@ bool DownloadShelfContextMenu::IsCommandIdEnabled(int command_id) const { |
case CANCEL: |
return download_item_->IsPartialDownload(); |
case TOGGLE_PAUSE: |
- return download_item_->IsInProgress(); |
+ return restart_enabled && download_item_->CanResumeDownload(); |
default: |
return command_id > 0 && command_id < MENU_LAST; |
} |
@@ -164,8 +168,10 @@ string16 DownloadShelfContextMenu::GetLabelForCommandId(int command_id) const { |
case CANCEL: |
return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_CANCEL); |
case TOGGLE_PAUSE: { |
- if (download_item_->IsPaused()) |
+ if (download_item_->IsPaused() || |
+ download_item_->CanResumeInterrupted()) { |
return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_RESUME_ITEM); |
+ } |
return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_PAUSE_ITEM); |
} |
case DISCARD: |