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

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

Issue 8369005: Fix a bug where putting a laptop to sleep causes downloads to end normally. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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_file_manager.cc
diff --git a/content/browser/download/download_file_manager.cc b/content/browser/download/download_file_manager.cc
index e5a7285920d19a294786ed8b6c4870711701b33d..8450c0fcb87e2641569ec3f8e574d552fe87ad28 100644
--- a/content/browser/download/download_file_manager.cc
+++ b/content/browser/download/download_file_manager.cc
@@ -14,7 +14,6 @@
#include "content/browser/download/download_file.h"
#include "content/browser/download/download_create_info.h"
#include "content/browser/download/download_manager.h"
-#include "content/browser/download/interrupt_reasons.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/download_manager_delegate.h"
@@ -189,10 +188,10 @@ void DownloadFileManager::UpdateDownload(
void DownloadFileManager::OnResponseCompleted(
DownloadId global_id,
- net::Error net_error,
+ InterruptReason reason,
const std::string& security_info) {
VLOG(20) << __FUNCTION__ << "()" << " id = " << global_id
- << " net_error = " << net_error
+ << " reason = " << InterruptReasonDebugString(reason)
<< " security_info = \"" << security_info << "\"";
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
DownloadFile* download_file = GetDownloadFile(global_id);
@@ -211,12 +210,7 @@ void DownloadFileManager::OnResponseCompleted(
if (!download_file->GetSha256Hash(&hash))
hash.clear();
- // ERR_CONNECTION_CLOSED is allowed since a number of servers in the wild
- // advertise a larger Content-Length than the amount of bytes in the message
- // body, and then close the connection. Other browsers - IE8, Firefox 4.0.1,
- // and Safari 5.0.4 - treat the download as complete in this case, so we
- // follow their lead.
- if (net_error == net::OK || net_error == net::ERR_CONNECTION_CLOSED) {
+ if (reason == DOWNLOAD_INTERRUPT_REASON_NONE) {
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
@@ -235,9 +229,7 @@ void DownloadFileManager::OnResponseCompleted(
&DownloadManager::OnDownloadInterrupted,
global_id.local(),
download_file->bytes_so_far(),
- ConvertNetErrorToInterruptReason(
- net_error,
- DOWNLOAD_INTERRUPT_FROM_NETWORK)));
+ reason));
}
// We need to keep the download around until the UI thread has finalized
// the name.
« no previous file with comments | « content/browser/download/download_file_manager.h ('k') | content/browser/download/download_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698