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 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 auto it = frame_tree_node_id_to_contained_save_items_.find( | 1078 auto it = frame_tree_node_id_to_contained_save_items_.find( |
1079 target_frame_tree_node_id); | 1079 target_frame_tree_node_id); |
1080 if (it != frame_tree_node_id_to_contained_save_items_.end()) { | 1080 if (it != frame_tree_node_id_to_contained_save_items_.end()) { |
1081 for (SaveItem* save_item : it->second) { | 1081 for (SaveItem* save_item : it->second) { |
1082 DCHECK(save_item->has_final_name()); | 1082 DCHECK(save_item->has_final_name()); |
1083 saved_links.push_back(save_item->url()); | 1083 saved_links.push_back(save_item->url()); |
1084 saved_file_paths.push_back(save_item->file_name()); | 1084 saved_file_paths.push_back(save_item->file_name()); |
1085 } | 1085 } |
1086 } | 1086 } |
1087 | 1087 |
| 1088 base::FilePath directory = target_tree_node->IsMainFrame() |
| 1089 ? saved_main_directory_path_.BaseName() |
| 1090 : base::FilePath(); |
| 1091 |
1088 // Ask target frame to serialize itself. | 1092 // Ask target frame to serialize itself. |
1089 RenderFrameHostImpl* target = target_tree_node->current_frame_host(); | 1093 RenderFrameHostImpl* target = target_tree_node->current_frame_host(); |
1090 target->Send(new FrameMsg_GetSerializedHtmlWithLocalLinks( | 1094 target->Send(new FrameMsg_GetSerializedHtmlWithLocalLinks( |
1091 target->GetRoutingID(), saved_links, saved_file_paths, | 1095 target->GetRoutingID(), saved_links, saved_file_paths, directory)); |
1092 saved_main_directory_path_.BaseName())); | |
1093 } | 1096 } |
1094 | 1097 |
1095 // Process the serialized HTML content data of a specified frame | 1098 // Process the serialized HTML content data of a specified frame |
1096 // retrieved from the renderer process. | 1099 // retrieved from the renderer process. |
1097 void SavePackage::OnSerializedHtmlWithLocalLinksResponse( | 1100 void SavePackage::OnSerializedHtmlWithLocalLinksResponse( |
1098 RenderFrameHostImpl* sender, | 1101 RenderFrameHostImpl* sender, |
1099 const std::string& data, | 1102 const std::string& data, |
1100 bool end_of_data) { | 1103 bool end_of_data) { |
1101 // Check current state. | 1104 // Check current state. |
1102 if (wait_state_ != HTML_DATA) | 1105 if (wait_state_ != HTML_DATA) |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 | 1572 |
1570 void SavePackage::FinalizeDownloadEntry() { | 1573 void SavePackage::FinalizeDownloadEntry() { |
1571 DCHECK(download_); | 1574 DCHECK(download_); |
1572 DCHECK(download_manager_); | 1575 DCHECK(download_manager_); |
1573 | 1576 |
1574 download_manager_->OnSavePackageSuccessfullyFinished(download_); | 1577 download_manager_->OnSavePackageSuccessfullyFinished(download_); |
1575 StopObservation(); | 1578 StopObservation(); |
1576 } | 1579 } |
1577 | 1580 |
1578 } // namespace content | 1581 } // namespace content |
OLD | NEW |