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

Unified Diff: chrome/browser/extensions/api/downloads/downloads_api.cc

Issue 11711003: Remove the DownloadItem::TogglePause() interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync'd to r175145. 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/extensions/api/downloads/downloads_api.cc
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc
index afc5fb7cb8dde580a590bf957f3f6bf0efbd11c4..be9e39421986c1bc1e11845a545dfa4425d1678b 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -703,9 +703,10 @@ bool DownloadsPauseFunction::RunImpl() {
// This could be due to an invalid download ID, or it could be due to the
// download not being currently active.
error_ = download_extension_errors::kInvalidOperationError;
- } else if (!download_item->IsPaused()) {
- // If download_item->IsPaused() already then we treat it as a success.
- download_item->TogglePause();
+ } else {
+ // If the item is already paused, this is a no-op and the
+ // operation will silently succeed.
+ download_item->Pause();
}
if (error_.empty())
RecordApiFunctions(DOWNLOADS_FUNCTION_PAUSE);
@@ -725,9 +726,10 @@ bool DownloadsResumeFunction::RunImpl() {
// This could be due to an invalid download ID, or it could be due to the
// download not being currently active.
error_ = download_extension_errors::kInvalidOperationError;
- } else if (download_item->IsPaused()) {
- // If !download_item->IsPaused() already, then we treat it as a success.
- download_item->TogglePause();
+ } else {
+ // Note that if the item isn't paused, this will be a no-op, and
+ // we will silently treat the extension call as a success.
+ download_item->Resume();
}
if (error_.empty())
RecordApiFunctions(DOWNLOADS_FUNCTION_RESUME);
« no previous file with comments | « chrome/browser/download/download_shelf_context_menu.cc ('k') | chrome/browser/resources/downloads/downloads.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698