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

Side by Side Diff: net/url_request/url_request_job.cc

Issue 1098983003: Switch SchemeIsSecure to SchemeIsCryptographic for referrer-related code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « net/base/sdch_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 "net/url_request/url_request_job.h" 5 #include "net/url_request/url_request_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/power_monitor/power_monitor.h" 10 #include "base/power_monitor/power_monitor.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 void URLRequestJob::NotifyURLRequestDestroyed() { 273 void URLRequestJob::NotifyURLRequestDestroyed() {
274 } 274 }
275 275
276 // static 276 // static
277 GURL URLRequestJob::ComputeReferrerForRedirect( 277 GURL URLRequestJob::ComputeReferrerForRedirect(
278 URLRequest::ReferrerPolicy policy, 278 URLRequest::ReferrerPolicy policy,
279 const std::string& referrer, 279 const std::string& referrer,
280 const GURL& redirect_destination) { 280 const GURL& redirect_destination) {
281 GURL original_referrer(referrer); 281 GURL original_referrer(referrer);
282 bool secure_referrer_but_insecure_destination = 282 bool secure_referrer_but_insecure_destination =
283 original_referrer.SchemeIsSecure() && 283 original_referrer.SchemeIsCryptographic() &&
284 !redirect_destination.SchemeIsSecure(); 284 !redirect_destination.SchemeIsCryptographic();
285 bool same_origin = 285 bool same_origin =
286 original_referrer.GetOrigin() == redirect_destination.GetOrigin(); 286 original_referrer.GetOrigin() == redirect_destination.GetOrigin();
287 switch (policy) { 287 switch (policy) {
288 case URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE: 288 case URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE:
289 return secure_referrer_but_insecure_destination ? GURL() 289 return secure_referrer_but_insecure_destination ? GURL()
290 : original_referrer; 290 : original_referrer;
291 291
292 case URLRequest::REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN: 292 case URLRequest::REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN:
293 if (same_origin) { 293 if (same_origin) {
294 return original_referrer; 294 return original_referrer;
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 // Alter the referrer if redirecting cross-origin (especially HTTP->HTTPS). 861 // Alter the referrer if redirecting cross-origin (especially HTTP->HTTPS).
862 redirect_info.new_referrer = 862 redirect_info.new_referrer =
863 ComputeReferrerForRedirect(request_->referrer_policy(), 863 ComputeReferrerForRedirect(request_->referrer_policy(),
864 request_->referrer(), 864 request_->referrer(),
865 redirect_info.new_url).spec(); 865 redirect_info.new_url).spec();
866 866
867 return redirect_info; 867 return redirect_info;
868 } 868 }
869 869
870 } // namespace net 870 } // namespace net
OLDNEW
« no previous file with comments | « net/base/sdch_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698