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

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

Issue 1425013004: Single referrer for all savable resources from a given frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 5 years, 1 month 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_package.h ('k') | content/common/frame_messages.h » ('j') | 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 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 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 1175
1176 void SavePackage::GetSavableResourceLinksForFrame(RenderFrameHost* target) { 1176 void SavePackage::GetSavableResourceLinksForFrame(RenderFrameHost* target) {
1177 number_of_frames_pending_response_++; 1177 number_of_frames_pending_response_++;
1178 target->Send(new FrameMsg_GetSavableResourceLinks(target->GetRoutingID())); 1178 target->Send(new FrameMsg_GetSavableResourceLinks(target->GetRoutingID()));
1179 } 1179 }
1180 1180
1181 void SavePackage::OnSavableResourceLinksResponse( 1181 void SavePackage::OnSavableResourceLinksResponse(
1182 RenderFrameHost* sender, 1182 RenderFrameHost* sender,
1183 const GURL& frame_url, 1183 const GURL& frame_url,
1184 const std::vector<GURL>& resources_list, 1184 const std::vector<GURL>& resources_list,
1185 const std::vector<Referrer>& referrers_list) { 1185 const Referrer& referrer) {
1186 if (wait_state_ != RESOURCES_LIST) 1186 if (wait_state_ != RESOURCES_LIST)
1187 return; 1187 return;
1188 1188
1189 if (resources_list.size() != referrers_list.size())
1190 return;
1191
1192 // Add all sub-resources to wait list. 1189 // Add all sub-resources to wait list.
1193 for (int i = 0; i < static_cast<int>(resources_list.size()); ++i) { 1190 for (const GURL& u : resources_list) {
1194 const GURL& u = resources_list[i];
1195 if (!u.is_valid()) 1191 if (!u.is_valid())
1196 continue; 1192 continue;
1197 if (unique_urls_to_save_.count(u)) 1193 if (unique_urls_to_save_.count(u))
1198 continue; 1194 continue;
1199 unique_urls_to_save_.insert(u); 1195 unique_urls_to_save_.insert(u);
1200 1196
1201 SaveFileCreateInfo::SaveFileSource save_source = 1197 SaveFileCreateInfo::SaveFileSource save_source =
1202 u.SchemeIsFile() ? SaveFileCreateInfo::SAVE_FILE_FROM_FILE 1198 u.SchemeIsFile() ? SaveFileCreateInfo::SAVE_FILE_FROM_FILE
1203 : SaveFileCreateInfo::SAVE_FILE_FROM_NET; 1199 : SaveFileCreateInfo::SAVE_FILE_FROM_NET;
1204 SaveItem* save_item = new SaveItem(u, referrers_list[i], this, save_source); 1200 SaveItem* save_item = new SaveItem(u, referrer, this, save_source);
1205 waiting_item_queue_.push(save_item); 1201 waiting_item_queue_.push(save_item);
1206 } 1202 }
1207 1203
1208 // Store savable frame_url for later processing. 1204 // Store savable frame_url for later processing.
1209 if (frame_url.is_valid()) 1205 if (frame_url.is_valid())
1210 frame_urls_to_save_.push_back(frame_url); 1206 frame_urls_to_save_.push_back(frame_url);
1211 1207
1212 CompleteSavableResourceLinksResponse(); 1208 CompleteSavableResourceLinksResponse();
1213 } 1209 }
1214 1210
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 1489
1494 void SavePackage::FinalizeDownloadEntry() { 1490 void SavePackage::FinalizeDownloadEntry() {
1495 DCHECK(download_); 1491 DCHECK(download_);
1496 DCHECK(download_manager_); 1492 DCHECK(download_manager_);
1497 1493
1498 download_manager_->OnSavePackageSuccessfullyFinished(download_); 1494 download_manager_->OnSavePackageSuccessfullyFinished(download_);
1499 StopObservation(); 1495 StopObservation();
1500 } 1496 }
1501 1497
1502 } // namespace content 1498 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/save_package.h ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698