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

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

Issue 2811293004: Fix an issue that we didn't clean url request properly. (Closed)
Patch Set: Fixed compiling for unit tests. Created 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 BrowserThread::FILE, FROM_HERE, 703 BrowserThread::FILE, FROM_HERE,
704 base::Bind(&SaveFileManager::RemoveSavedFileFromFileMap, file_manager_, 704 base::Bind(&SaveFileManager::RemoveSavedFileFromFileMap, file_manager_,
705 list_of_failed_save_item_ids)); 705 list_of_failed_save_item_ids));
706 706
707 if (download_) { 707 if (download_) {
708 // Hack to avoid touching |download_| after user cancel. 708 // Hack to avoid touching |download_| after user cancel.
709 // TODO(rdsmith/benjhayden): Integrate canceling on DownloadItem 709 // TODO(rdsmith/benjhayden): Integrate canceling on DownloadItem
710 // with SavePackage flow. 710 // with SavePackage flow.
711 if (download_->GetState() == DownloadItem::IN_PROGRESS) { 711 if (download_->GetState() == DownloadItem::IN_PROGRESS) {
712 if (save_type_ != SAVE_PAGE_TYPE_AS_MHTML) { 712 if (save_type_ != SAVE_PAGE_TYPE_AS_MHTML) {
713 download_->DestinationUpdate( 713 download_->DestinationUpdate(all_save_items_count_, CurrentSpeed(),
714 all_save_items_count_, CurrentSpeed(), 714 std::vector<DownloadItem::ReceivedSlice>(),
715 std::vector<DownloadItem::ReceivedSlice>()); 715 std::unordered_set<int64_t>());
716 download_->OnAllDataSaved(all_save_items_count_, 716 download_->OnAllDataSaved(all_save_items_count_,
717 std::unique_ptr<crypto::SecureHash>()); 717 std::unique_ptr<crypto::SecureHash>());
718 } 718 }
719 download_->MarkAsComplete(); 719 download_->MarkAsComplete();
720 } 720 }
721 FinalizeDownloadEntry(); 721 FinalizeDownloadEntry();
722 } 722 }
723 } 723 }
724 724
725 void SavePackage::SaveFinished(SaveItemId save_item_id, 725 void SavePackage::SaveFinished(SaveItemId save_item_id,
(...skipping 12 matching lines...) Expand all
738 file_manager_->RemoveSaveFile(save_item->id(), this); 738 file_manager_->RemoveSaveFile(save_item->id(), this);
739 739
740 PutInProgressItemToSavedMap(save_item); 740 PutInProgressItemToSavedMap(save_item);
741 741
742 // Inform the DownloadItem to update UI. 742 // Inform the DownloadItem to update UI.
743 // We use the received bytes as number of saved files. 743 // We use the received bytes as number of saved files.
744 // Hack to avoid touching download_ after user cancel. 744 // Hack to avoid touching download_ after user cancel.
745 // TODO(rdsmith/benjhayden): Integrate canceling on DownloadItem 745 // TODO(rdsmith/benjhayden): Integrate canceling on DownloadItem
746 // with SavePackage flow. 746 // with SavePackage flow.
747 if (download_ && (download_->GetState() == DownloadItem::IN_PROGRESS)) { 747 if (download_ && (download_->GetState() == DownloadItem::IN_PROGRESS)) {
748 download_->DestinationUpdate( 748 download_->DestinationUpdate(completed_count(), CurrentSpeed(),
749 completed_count(), CurrentSpeed(), 749 std::vector<DownloadItem::ReceivedSlice>(),
750 std::vector<DownloadItem::ReceivedSlice>()); 750 std::unordered_set<int64_t>());
751 } 751 }
752 752
753 if (save_item->save_source() == SaveFileCreateInfo::SAVE_FILE_FROM_DOM && 753 if (save_item->save_source() == SaveFileCreateInfo::SAVE_FILE_FROM_DOM &&
754 save_item->url() == page_url_ && !save_item->received_bytes()) { 754 save_item->url() == page_url_ && !save_item->received_bytes()) {
755 // If size of main HTML page is 0, treat it as disk error. 755 // If size of main HTML page is 0, treat it as disk error.
756 Cancel(false); 756 Cancel(false);
757 return; 757 return;
758 } 758 }
759 759
760 if (canceled()) { 760 if (canceled()) {
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 } 1485 }
1486 1486
1487 void SavePackage::FinalizeDownloadEntry() { 1487 void SavePackage::FinalizeDownloadEntry() {
1488 DCHECK(download_); 1488 DCHECK(download_);
1489 1489
1490 download_manager_->OnSavePackageSuccessfullyFinished(download_); 1490 download_manager_->OnSavePackageSuccessfullyFinished(download_);
1491 RemoveObservers(); 1491 RemoveObservers();
1492 } 1492 }
1493 1493
1494 } // namespace content 1494 } // namespace content
OLDNEW
« content/browser/download/download_job.h ('K') | « content/browser/download/parallel_download_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698