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

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

Issue 10387090: Pass the referrer policy with the referrer for the save package code path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 7 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 | Annotate | Revision Log
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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "content/browser/download/save_file_manager.h" 7 #include "content/browser/download/save_file_manager.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 109 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
110 SavePackageMap::iterator it = packages_.find(save_id); 110 SavePackageMap::iterator it = packages_.find(save_id);
111 if (it != packages_.end()) 111 if (it != packages_.end())
112 return it->second; 112 return it->second;
113 return NULL; 113 return NULL;
114 } 114 }
115 115
116 // Call from SavePackage for starting a saving job 116 // Call from SavePackage for starting a saving job
117 void SaveFileManager::SaveURL( 117 void SaveFileManager::SaveURL(
118 const GURL& url, 118 const GURL& url,
119 const GURL& referrer, 119 const content::Referrer& referrer,
120 int render_process_host_id, 120 int render_process_host_id,
121 int render_view_id, 121 int render_view_id,
122 SaveFileCreateInfo::SaveFileSource save_source, 122 SaveFileCreateInfo::SaveFileSource save_source,
123 const FilePath& file_full_path, 123 const FilePath& file_full_path,
124 content::ResourceContext* context, 124 content::ResourceContext* context,
125 SavePackage* save_package) { 125 SavePackage* save_package) {
126 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 126 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
127 127
128 // Register a saving job. 128 // Register a saving job.
129 RegisterStartingRequest(url, save_package); 129 RegisterStartingRequest(url, save_package);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 348 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
349 SavePackage* save_package = UnregisterStartingRequest(save_url, contents_id); 349 SavePackage* save_package = UnregisterStartingRequest(save_url, contents_id);
350 if (save_package) 350 if (save_package)
351 save_package->SaveFailed(save_url); 351 save_package->SaveFailed(save_url);
352 } 352 }
353 353
354 // Notifications sent from the UI thread and run on the IO thread. 354 // Notifications sent from the UI thread and run on the IO thread.
355 355
356 void SaveFileManager::OnSaveURL( 356 void SaveFileManager::OnSaveURL(
357 const GURL& url, 357 const GURL& url,
358 const GURL& referrer, 358 const content::Referrer& referrer,
359 int render_process_host_id, 359 int render_process_host_id,
360 int render_view_id, 360 int render_view_id,
361 content::ResourceContext* context) { 361 content::ResourceContext* context) {
362 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 362 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
363 ResourceDispatcherHostImpl::Get()->BeginSaveFile(url, 363 ResourceDispatcherHostImpl::Get()->BeginSaveFile(url,
364 referrer, 364 referrer,
365 render_process_host_id, 365 render_process_host_id,
366 render_view_id, 366 render_view_id,
367 context); 367 context);
368 } 368 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 SaveFileMap::iterator it = save_file_map_.find(*i); 517 SaveFileMap::iterator it = save_file_map_.find(*i);
518 if (it != save_file_map_.end()) { 518 if (it != save_file_map_.end()) {
519 SaveFile* save_file = it->second; 519 SaveFile* save_file = it->second;
520 DCHECK(!save_file->InProgress()); 520 DCHECK(!save_file->InProgress());
521 file_util::Delete(save_file->FullPath(), false); 521 file_util::Delete(save_file->FullPath(), false);
522 delete save_file; 522 delete save_file;
523 save_file_map_.erase(it); 523 save_file_map_.erase(it);
524 } 524 }
525 } 525 }
526 } 526 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698