OLD | NEW |
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 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 // Check current state. | 1064 // Check current state. |
1065 if (wait_state_ != HTML_DATA) | 1065 if (wait_state_ != HTML_DATA) |
1066 return; | 1066 return; |
1067 | 1067 |
1068 int id = contents_id(); | 1068 int id = contents_id(); |
1069 // If the all frames are finished saving, we need to close the | 1069 // If the all frames are finished saving, we need to close the |
1070 // remaining SaveItems. | 1070 // remaining SaveItems. |
1071 if (flag == WebPageSerializerClient::AllFramesAreFinished) { | 1071 if (flag == WebPageSerializerClient::AllFramesAreFinished) { |
1072 for (SaveUrlItemMap::iterator it = in_progress_items_.begin(); | 1072 for (SaveUrlItemMap::iterator it = in_progress_items_.begin(); |
1073 it != in_progress_items_.end(); ++it) { | 1073 it != in_progress_items_.end(); ++it) { |
1074 VLOG(20) << " " << __FUNCTION__ << "()" | 1074 DVLOG(20) << " " << __FUNCTION__ << "()" |
1075 << " save_id = " << it->second->save_id() | 1075 << " save_id = " << it->second->save_id() |
1076 << " url = \"" << it->second->url().spec() << "\""; | 1076 << " url = \"" << it->second->url().spec() << "\""; |
1077 BrowserThread::PostTask( | 1077 BrowserThread::PostTask( |
1078 BrowserThread::FILE, FROM_HERE, | 1078 BrowserThread::FILE, FROM_HERE, |
1079 base::Bind(&SaveFileManager::SaveFinished, | 1079 base::Bind(&SaveFileManager::SaveFinished, |
1080 file_manager_, | 1080 file_manager_, |
1081 it->second->save_id(), | 1081 it->second->save_id(), |
1082 it->second->url(), | 1082 it->second->url(), |
1083 id, | 1083 id, |
1084 true)); | 1084 true)); |
1085 } | 1085 } |
1086 return; | 1086 return; |
(...skipping 29 matching lines...) Expand all Loading... |
1116 BrowserThread::FILE, FROM_HERE, | 1116 BrowserThread::FILE, FROM_HERE, |
1117 base::Bind(&SaveFileManager::UpdateSaveProgress, | 1117 base::Bind(&SaveFileManager::UpdateSaveProgress, |
1118 file_manager_, | 1118 file_manager_, |
1119 save_item->save_id(), | 1119 save_item->save_id(), |
1120 new_data, | 1120 new_data, |
1121 static_cast<int>(data.size()))); | 1121 static_cast<int>(data.size()))); |
1122 } | 1122 } |
1123 | 1123 |
1124 // Current frame is completed saving, call finish in file thread. | 1124 // Current frame is completed saving, call finish in file thread. |
1125 if (flag == WebPageSerializerClient::CurrentFrameIsFinished) { | 1125 if (flag == WebPageSerializerClient::CurrentFrameIsFinished) { |
1126 VLOG(20) << " " << __FUNCTION__ << "()" | 1126 DVLOG(20) << " " << __FUNCTION__ << "()" |
1127 << " save_id = " << save_item->save_id() | 1127 << " save_id = " << save_item->save_id() |
1128 << " url = \"" << save_item->url().spec() << "\""; | 1128 << " url = \"" << save_item->url().spec() << "\""; |
1129 BrowserThread::PostTask( | 1129 BrowserThread::PostTask( |
1130 BrowserThread::FILE, FROM_HERE, | 1130 BrowserThread::FILE, FROM_HERE, |
1131 base::Bind(&SaveFileManager::SaveFinished, | 1131 base::Bind(&SaveFileManager::SaveFinished, |
1132 file_manager_, | 1132 file_manager_, |
1133 save_item->save_id(), | 1133 save_item->save_id(), |
1134 save_item->url(), | 1134 save_item->url(), |
1135 id, | 1135 id, |
1136 true)); | 1136 true)); |
1137 } | 1137 } |
1138 } | 1138 } |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 | 1434 |
1435 void SavePackage::FinalizeDownloadEntry() { | 1435 void SavePackage::FinalizeDownloadEntry() { |
1436 DCHECK(download_); | 1436 DCHECK(download_); |
1437 DCHECK(download_manager_); | 1437 DCHECK(download_manager_); |
1438 | 1438 |
1439 download_manager_->OnSavePackageSuccessfullyFinished(download_); | 1439 download_manager_->OnSavePackageSuccessfullyFinished(download_); |
1440 StopObservation(); | 1440 StopObservation(); |
1441 } | 1441 } |
1442 | 1442 |
1443 } // namespace content | 1443 } // namespace content |
OLD | NEW |