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

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

Issue 1829893003: Fix how Save-Page-As responds to web requests blocked by extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 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
« no previous file with comments | « content/browser/download/save_file_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 // Collect all saved success items. 999 // Collect all saved success items.
1000 // SECURITY NOTE: We don't send *all* urls / local paths, but only 1000 // SECURITY NOTE: We don't send *all* urls / local paths, but only
1001 // those that the given frame had access to already (because it contained 1001 // those that the given frame had access to already (because it contained
1002 // the savable resources / subframes associated with save items). 1002 // the savable resources / subframes associated with save items).
1003 std::map<GURL, base::FilePath> url_to_local_path; 1003 std::map<GURL, base::FilePath> url_to_local_path;
1004 std::map<int, base::FilePath> routing_id_to_local_path; 1004 std::map<int, base::FilePath> routing_id_to_local_path;
1005 auto it = frame_tree_node_id_to_contained_save_items_.find( 1005 auto it = frame_tree_node_id_to_contained_save_items_.find(
1006 target_frame_tree_node_id); 1006 target_frame_tree_node_id);
1007 if (it != frame_tree_node_id_to_contained_save_items_.end()) { 1007 if (it != frame_tree_node_id_to_contained_save_items_.end()) {
1008 for (SaveItem* save_item : it->second) { 1008 for (SaveItem* save_item : it->second) {
1009 // Calculate the local link to use for this |save_item|. 1009 // Skip items that failed to save.
1010 DCHECK(save_item->has_final_name()); 1010 if (!save_item->has_final_name()) {
1011 DCHECK_EQ(SaveItem::SaveState::COMPLETE, save_item->state());
1012 DCHECK(!save_item->success());
1013 continue;
1014 }
1015
1016 // Calculate the relative path for referring to the |save_item|.
1011 base::FilePath local_path(base::FilePath::kCurrentDirectory); 1017 base::FilePath local_path(base::FilePath::kCurrentDirectory);
1012 if (target_tree_node->IsMainFrame()) { 1018 if (target_tree_node->IsMainFrame()) {
1013 local_path = local_path.Append(saved_main_directory_path_.BaseName()); 1019 local_path = local_path.Append(saved_main_directory_path_.BaseName());
1014 } 1020 }
1015 local_path = local_path.Append(save_item->file_name()); 1021 local_path = local_path.Append(save_item->file_name());
1016 1022
1017 // Insert the link into |url_to_local_path| or |routing_id_to_local_path|. 1023 // Insert the link into |url_to_local_path| or |routing_id_to_local_path|.
1018 if (save_item->save_source() != SaveFileCreateInfo::SAVE_FILE_FROM_DOM) { 1024 if (save_item->save_source() != SaveFileCreateInfo::SAVE_FILE_FROM_DOM) {
1019 DCHECK_EQ(FrameTreeNode::kFrameTreeNodeInvalidId, 1025 DCHECK_EQ(FrameTreeNode::kFrameTreeNodeInvalidId,
1020 save_item->frame_tree_node_id()); 1026 save_item->frame_tree_node_id());
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 1518
1513 void SavePackage::FinalizeDownloadEntry() { 1519 void SavePackage::FinalizeDownloadEntry() {
1514 DCHECK(download_); 1520 DCHECK(download_);
1515 DCHECK(download_manager_); 1521 DCHECK(download_manager_);
1516 1522
1517 download_manager_->OnSavePackageSuccessfullyFinished(download_); 1523 download_manager_->OnSavePackageSuccessfullyFinished(download_);
1518 StopObservation(); 1524 StopObservation();
1519 } 1525 }
1520 1526
1521 } // namespace content 1527 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/save_file_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698