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

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

Issue 10831302: Download resumption - Preliminary (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed signed/unsigned compare issue. Created 8 years, 1 month 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
« no previous file with comments | « chrome/browser/download/download_item_model_unittest.cc ('k') | chrome/browser/plugins/plugin_installer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
« no previous file with comments | « chrome/browser/download/download_item_model_unittest.cc ('k') | chrome/browser/plugins/plugin_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698