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

Unified Diff: content/browser/download/download_item_impl.cc

Issue 11711003: Remove the DownloadItem::TogglePause() interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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: content/browser/download/download_item_impl.cc
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc
index e2313415bed14f93b9d3fb2a09bf667cb6b0ef6d..b843859a30e1ab190b02ea79504ea7dbf7f54f6a 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -319,20 +319,27 @@ void DownloadItemImpl::DangerousDownloadValidated() {
MaybeCompleteDownload();
}
-void DownloadItemImpl::TogglePause() {
+void DownloadItemImpl::Pause() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(state_ == IN_PROGRESS_INTERNAL || state_ == COMPLETING_INTERNAL);
- VLOG(20) << __FUNCTION__ << " download=" << DebugString(true);
- // Ignore pauses when we've passed the commit point.
- if (state_ == COMPLETING_INTERNAL)
+ // Ignore irrelevant states.
+ if (state_ != IN_PROGRESS_INTERNAL || is_paused_)
return;
- if (is_paused_)
- request_handle_->ResumeRequest();
- else
- request_handle_->PauseRequest();
- is_paused_ = !is_paused_;
+ request_handle_->PauseRequest();
+ is_paused_ = true;
+ UpdateObservers();
+}
+
+void DownloadItemImpl::Resume() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ // Ignore irrelevant states.
+ if (state_ != IN_PROGRESS_INTERNAL || !is_paused_)
+ return;
+
+ request_handle_->ResumeRequest();
+ is_paused_ = false;
UpdateObservers();
}

Powered by Google App Engine
This is Rietveld 408576698