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