Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: chrome/browser/download/download_shelf_context_menu.cc

Issue 11673003: UI changes associated with downloads resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged from DownloadsResumption; includes CanResumeDownload, which was nuked in the original CL. Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 43c85ed2a6390c998bfad5f644934000a02593ae..f426c76a63940ea22a1dcfe3e24cadaa30996e28 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/url_constants.h"
#include "content/public/browser/download_item.h"
@@ -49,6 +51,8 @@ ui::SimpleMenuModel* DownloadShelfContextMenu::GetMenuModel() {
}
bool DownloadShelfContextMenu::IsCommandIdEnabled(int command_id) const {
+ static bool restart_enabled = CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableDownloadResumption);
switch (static_cast<ContextMenuCommands>(command_id)) {
case SHOW_IN_FOLDER:
return download_item_->CanShowInFolder();
@@ -64,7 +68,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();
case DISCARD:
case KEEP:
case LEARN_MORE_SCANNING:
@@ -173,8 +177,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:
« no previous file with comments | « chrome/browser/download/download_item_model_unittest.cc ('k') | chrome/browser/resources/downloads/downloads.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698