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

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

Issue 6881106: Treat ERR_CONNECTION_CLOSED as end-of-data marker for downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 download_history_->UpdateEntry(download); 532 download_history_->UpdateEntry(download);
533 } 533 }
534 } 534 }
535 } 535 }
536 536
537 void DownloadManager::OnResponseCompleted(int32 download_id, 537 void DownloadManager::OnResponseCompleted(int32 download_id,
538 int64 size, 538 int64 size,
539 int os_error, 539 int os_error,
540 const std::string& hash) { 540 const std::string& hash) {
541 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 541 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
542 if (os_error == 0) { 542 // Some web sites lie about the size of the data (for example, using gzip
543 // encoding and specifying the size of the expanded data) and disconnect
544 // when the data is done. Unfortunately, this means that if we get a
545 // disconnect and the data hasn't been completely downloaded we can't tell.
546 // See http://code.google.com/p/chromium/issues/detail?id=78769.
547 if ((os_error == 0) || (os_error == net::ERR_CONNECTION_CLOSED)) {
cbentzel 2011/04/21 17:16:41 We discussed doing this at a lower-layer [in HttpS
543 OnAllDataSaved(download_id, size, hash); 548 OnAllDataSaved(download_id, size, hash);
544 } else { 549 } else {
545 OnDownloadError(download_id, size, os_error); 550 OnDownloadError(download_id, size, os_error);
546 } 551 }
547 } 552 }
548 553
549 void DownloadManager::OnAllDataSaved(int32 download_id, 554 void DownloadManager::OnAllDataSaved(int32 download_id,
550 int64 size, 555 int64 size,
551 const std::string& hash) { 556 const std::string& hash) {
552 VLOG(20) << __FUNCTION__ << "()" << " download_id = " << download_id 557 VLOG(20) << __FUNCTION__ << "()" << " download_id = " << download_id
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 observed_download_manager_->RemoveObserver(this); 1179 observed_download_manager_->RemoveObserver(this);
1175 } 1180 }
1176 1181
1177 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { 1182 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() {
1178 observing_download_manager_->NotifyModelChanged(); 1183 observing_download_manager_->NotifyModelChanged();
1179 } 1184 }
1180 1185
1181 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { 1186 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() {
1182 observed_download_manager_ = NULL; 1187 observed_download_manager_ = NULL;
1183 } 1188 }
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