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 095ca155c811fff5db92d9fc7b87261a2159084f..db2aa0c911ca0cbe3d1446d029cb1318ca4cb553 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 "chrome/common/extensions/extension_switch_utils.h" |
#include "content/public/browser/download_item.h" |
@@ -47,6 +49,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() && |
@@ -66,7 +70,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; |
} |
@@ -165,8 +169,11 @@ 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() != |
+ DownloadItem::RESUME_MODE_INVALID)) { |
return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_RESUME_ITEM); |
+ } |
return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_PAUSE_ITEM); |
} |
case DISCARD: |