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

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

Issue 1812693002: Fix how Save-Page-As responds to web requests blocked by extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed new test (to help with merges into Beta and Stable branches). 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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 // Collect all saved success items. 1006 // Collect all saved success items.
1007 // SECURITY NOTE: We don't send *all* urls / local paths, but only 1007 // SECURITY NOTE: We don't send *all* urls / local paths, but only
1008 // those that the given frame had access to already (because it contained 1008 // those that the given frame had access to already (because it contained
1009 // the savable resources / subframes associated with save items). 1009 // the savable resources / subframes associated with save items).
1010 std::map<GURL, base::FilePath> url_to_local_path; 1010 std::map<GURL, base::FilePath> url_to_local_path;
1011 std::map<int, base::FilePath> routing_id_to_local_path; 1011 std::map<int, base::FilePath> routing_id_to_local_path;
1012 auto it = frame_tree_node_id_to_contained_save_items_.find( 1012 auto it = frame_tree_node_id_to_contained_save_items_.find(
1013 target_frame_tree_node_id); 1013 target_frame_tree_node_id);
1014 if (it != frame_tree_node_id_to_contained_save_items_.end()) { 1014 if (it != frame_tree_node_id_to_contained_save_items_.end()) {
1015 for (SaveItem* save_item : it->second) { 1015 for (SaveItem* save_item : it->second) {
1016 // Calculate the local link to use for this |save_item|. 1016 // Skip items that failed to save.
1017 DCHECK(save_item->has_final_name()); 1017 if (!save_item->has_final_name()) {
1018 DCHECK_EQ(SaveItem::SaveState::COMPLETE, save_item->state());
1019 DCHECK(!save_item->success());
1020 continue;
1021 }
1022
1023 // Calculate the relative path for referring to the |save_item|.
1018 base::FilePath local_path(base::FilePath::kCurrentDirectory); 1024 base::FilePath local_path(base::FilePath::kCurrentDirectory);
1019 if (target_tree_node->IsMainFrame()) { 1025 if (target_tree_node->IsMainFrame()) {
1020 local_path = local_path.Append(saved_main_directory_path_.BaseName()); 1026 local_path = local_path.Append(saved_main_directory_path_.BaseName());
1021 } 1027 }
1022 local_path = local_path.Append(save_item->file_name()); 1028 local_path = local_path.Append(save_item->file_name());
1023 1029
1024 // Insert the link into |url_to_local_path| or |routing_id_to_local_path|. 1030 // Insert the link into |url_to_local_path| or |routing_id_to_local_path|.
1025 if (save_item->save_source() != SaveFileCreateInfo::SAVE_FILE_FROM_DOM) { 1031 if (save_item->save_source() != SaveFileCreateInfo::SAVE_FILE_FROM_DOM) {
1026 DCHECK_EQ(FrameTreeNode::kFrameTreeNodeInvalidId, 1032 DCHECK_EQ(FrameTreeNode::kFrameTreeNodeInvalidId,
1027 save_item->frame_tree_node_id()); 1033 save_item->frame_tree_node_id());
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 1525
1520 void SavePackage::FinalizeDownloadEntry() { 1526 void SavePackage::FinalizeDownloadEntry() {
1521 DCHECK(download_); 1527 DCHECK(download_);
1522 DCHECK(download_manager_); 1528 DCHECK(download_manager_);
1523 1529
1524 download_manager_->OnSavePackageSuccessfullyFinished(download_); 1530 download_manager_->OnSavePackageSuccessfullyFinished(download_);
1525 StopObservation(); 1531 StopObservation();
1526 } 1532 }
1527 1533
1528 } // namespace content 1534 } // 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