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

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: Updated comment. 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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 // Let SaveItem set end state. 696 // Let SaveItem set end state.
697 save_item->Finish(size, is_success); 697 save_item->Finish(size, is_success);
698 // Remove the associated save id and SavePackage. 698 // Remove the associated save id and SavePackage.
699 file_manager_->RemoveSaveFile(save_id, save_item->url(), this); 699 file_manager_->RemoveSaveFile(save_id, save_item->url(), this);
700 700
701 PutInProgressItemToSavedMap(save_item); 701 PutInProgressItemToSavedMap(save_item);
702 702
703 // Inform the DownloadItem to update UI. 703 // Inform the DownloadItem to update UI.
704 // We use the received bytes as number of saved files. 704 // We use the received bytes as number of saved files.
705 if (download_) 705 if (download_)
706 download_->UpdateProgress(completed_count(), CurrentSpeed()); 706 download_->UpdateProgress(completed_count(), CurrentSpeed(), "");
707 707
708 if (save_item->save_source() == SaveFileCreateInfo::SAVE_FILE_FROM_DOM && 708 if (save_item->save_source() == SaveFileCreateInfo::SAVE_FILE_FROM_DOM &&
709 save_item->url() == page_url_ && !save_item->received_bytes()) { 709 save_item->url() == page_url_ && !save_item->received_bytes()) {
710 // If size of main HTML page is 0, treat it as disk error. 710 // If size of main HTML page is 0, treat it as disk error.
711 Cancel(false); 711 Cancel(false);
712 return; 712 return;
713 } 713 }
714 714
715 if (canceled()) { 715 if (canceled()) {
716 DCHECK(finished_); 716 DCHECK(finished_);
(...skipping 21 matching lines...) Expand all
738 } 738 }
739 SaveItem* save_item = it->second; 739 SaveItem* save_item = it->second;
740 740
741 save_item->Finish(0, false); 741 save_item->Finish(0, false);
742 742
743 PutInProgressItemToSavedMap(save_item); 743 PutInProgressItemToSavedMap(save_item);
744 744
745 // Inform the DownloadItem to update UI. 745 // Inform the DownloadItem to update UI.
746 // We use the received bytes as number of saved files. 746 // We use the received bytes as number of saved files.
747 if (download_) 747 if (download_)
748 download_->UpdateProgress(completed_count(), CurrentSpeed()); 748 download_->UpdateProgress(completed_count(), CurrentSpeed(), "");
749 749
750 if (save_type_ == SAVE_AS_ONLY_HTML || 750 if (save_type_ == SAVE_AS_ONLY_HTML ||
751 save_item->save_source() == SaveFileCreateInfo::SAVE_FILE_FROM_DOM) { 751 save_item->save_source() == SaveFileCreateInfo::SAVE_FILE_FROM_DOM) {
752 // We got error when saving page. Treat it as disk error. 752 // We got error when saving page. Treat it as disk error.
753 Cancel(true); 753 Cancel(true);
754 } 754 }
755 755
756 if (canceled()) { 756 if (canceled()) {
757 DCHECK(finished_); 757 DCHECK(finished_);
758 return; 758 return;
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 StopObservation(); 1284 StopObservation();
1285 } 1285 }
1286 1286
1287 void SavePackage::FinalizeDownloadEntry() { 1287 void SavePackage::FinalizeDownloadEntry() {
1288 DCHECK(download_); 1288 DCHECK(download_);
1289 DCHECK(download_manager_); 1289 DCHECK(download_manager_);
1290 1290
1291 download_manager_->SavePageDownloadFinished(download_); 1291 download_manager_->SavePageDownloadFinished(download_);
1292 StopObservation(); 1292 StopObservation();
1293 } 1293 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698