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

Side by Side Diff: content/browser/download/save_package.cc

Issue 8404049: Added member data to classes to support download resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with trunk Created 9 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 unified diff | Download patch | Annotate | Revision Log
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 "content/browser/download/save_package.h" 5 #include "content/browser/download/save_package.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 // Let SaveItem set end state. 697 // Let SaveItem set end state.
698 save_item->Finish(size, is_success); 698 save_item->Finish(size, is_success);
699 // Remove the associated save id and SavePackage. 699 // Remove the associated save id and SavePackage.
700 file_manager_->RemoveSaveFile(save_id, save_item->url(), this); 700 file_manager_->RemoveSaveFile(save_id, save_item->url(), this);
701 701
702 PutInProgressItemToSavedMap(save_item); 702 PutInProgressItemToSavedMap(save_item);
703 703
704 // Inform the DownloadItem to update UI. 704 // Inform the DownloadItem to update UI.
705 // We use the received bytes as number of saved files. 705 // We use the received bytes as number of saved files.
706 if (download_) 706 if (download_)
707 download_->UpdateProgress(completed_count(), CurrentSpeed()); 707 download_->UpdateProgress(completed_count(), CurrentSpeed(), "");
708 708
709 if (save_item->save_source() == SaveFileCreateInfo::SAVE_FILE_FROM_DOM && 709 if (save_item->save_source() == SaveFileCreateInfo::SAVE_FILE_FROM_DOM &&
710 save_item->url() == page_url_ && !save_item->received_bytes()) { 710 save_item->url() == page_url_ && !save_item->received_bytes()) {
711 // If size of main HTML page is 0, treat it as disk error. 711 // If size of main HTML page is 0, treat it as disk error.
712 Cancel(false); 712 Cancel(false);
713 return; 713 return;
714 } 714 }
715 715
716 if (canceled()) { 716 if (canceled()) {
717 DCHECK(finished_); 717 DCHECK(finished_);
(...skipping 21 matching lines...) Expand all
739 } 739 }
740 SaveItem* save_item = it->second; 740 SaveItem* save_item = it->second;
741 741
742 save_item->Finish(0, false); 742 save_item->Finish(0, false);
743 743
744 PutInProgressItemToSavedMap(save_item); 744 PutInProgressItemToSavedMap(save_item);
745 745
746 // Inform the DownloadItem to update UI. 746 // Inform the DownloadItem to update UI.
747 // We use the received bytes as number of saved files. 747 // We use the received bytes as number of saved files.
748 if (download_) 748 if (download_)
749 download_->UpdateProgress(completed_count(), CurrentSpeed()); 749 download_->UpdateProgress(completed_count(), CurrentSpeed(), "");
750 750
751 if (save_type_ == SAVE_AS_ONLY_HTML || 751 if (save_type_ == SAVE_AS_ONLY_HTML ||
752 save_item->save_source() == SaveFileCreateInfo::SAVE_FILE_FROM_DOM) { 752 save_item->save_source() == SaveFileCreateInfo::SAVE_FILE_FROM_DOM) {
753 // We got error when saving page. Treat it as disk error. 753 // We got error when saving page. Treat it as disk error.
754 Cancel(true); 754 Cancel(true);
755 } 755 }
756 756
757 if (canceled()) { 757 if (canceled()) {
758 DCHECK(finished_); 758 DCHECK(finished_);
759 return; 759 return;
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 StopObservation(); 1285 StopObservation();
1286 } 1286 }
1287 1287
1288 void SavePackage::FinalizeDownloadEntry() { 1288 void SavePackage::FinalizeDownloadEntry() {
1289 DCHECK(download_); 1289 DCHECK(download_);
1290 DCHECK(download_manager_); 1290 DCHECK(download_manager_);
1291 1291
1292 download_manager_->SavePageDownloadFinished(download_); 1292 download_manager_->SavePageDownloadFinished(download_);
1293 StopObservation(); 1293 StopObservation();
1294 } 1294 }
OLDNEW
« no previous file with comments | « content/browser/download/save_file_manager.cc ('k') | content/browser/renderer_host/resource_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698