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

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: 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: 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 1e51cd02c986e5f3248335974f50a88248892277..38785889ce7bbd6c5d3185cfd4cbc96ddffce16b 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();
}
« no previous file with comments | « content/browser/download/download_item_impl.h ('k') | content/browser/download/download_item_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698