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

Side by Side Diff: chrome/browser/download/download_manager.cc

Issue 7203004: Treat ERR_CONNECTION_CLOSED as a succesful download. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/download/download_manager.h" 5 #include "chrome/browser/download/download_manager.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 download_history_->UpdateEntry(download); 625 download_history_->UpdateEntry(download);
626 } 626 }
627 } 627 }
628 } 628 }
629 629
630 void DownloadManager::OnResponseCompleted(int32 download_id, 630 void DownloadManager::OnResponseCompleted(int32 download_id,
631 int64 size, 631 int64 size,
632 int os_error, 632 int os_error,
633 const std::string& hash) { 633 const std::string& hash) {
634 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 634 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
635 if (os_error == 0) { 635 // ERR_CONNECTION_CLOSED is allowed since a number of servers in the wild
636 // advertise a larger Content-Length than the amount of bytes in the message
637 // body, and then close the connection. Other browsers - IE8, Firefox 4.0.1,
638 // and Safari 5.0.4 - treat the download as complete in this case, so we
639 // follow their lead.
640 if (os_error == 0 || os_error == net::ERR_CONNECTION_CLOSED) {
636 OnAllDataSaved(download_id, size, hash); 641 OnAllDataSaved(download_id, size, hash);
637 } else { 642 } else {
638 OnDownloadError(download_id, size, os_error); 643 OnDownloadError(download_id, size, os_error);
639 } 644 }
640 } 645 }
641 646
642 void DownloadManager::OnAllDataSaved(int32 download_id, 647 void DownloadManager::OnAllDataSaved(int32 download_id,
643 int64 size, 648 int64 size,
644 const std::string& hash) { 649 const std::string& hash) {
645 VLOG(20) << __FUNCTION__ << "()" << " download_id = " << download_id 650 VLOG(20) << __FUNCTION__ << "()" << " download_id = " << download_id
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 observed_download_manager_->RemoveObserver(this); 1309 observed_download_manager_->RemoveObserver(this);
1305 } 1310 }
1306 1311
1307 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { 1312 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() {
1308 observing_download_manager_->NotifyModelChanged(); 1313 observing_download_manager_->NotifyModelChanged();
1309 } 1314 }
1310 1315
1311 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { 1316 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() {
1312 observed_download_manager_ = NULL; 1317 observed_download_manager_ = NULL;
1313 } 1318 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698