Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 839 | 839 |
| 840 // Update the first-party URL if appropriate. | 840 // Update the first-party URL if appropriate. |
| 841 if (request_->first_party_url_policy() == | 841 if (request_->first_party_url_policy() == |
| 842 URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT) { | 842 URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT) { |
| 843 redirect_info.new_first_party_for_cookies = redirect_info.new_url; | 843 redirect_info.new_first_party_for_cookies = redirect_info.new_url; |
| 844 } else { | 844 } else { |
| 845 redirect_info.new_first_party_for_cookies = | 845 redirect_info.new_first_party_for_cookies = |
| 846 request_->first_party_for_cookies(); | 846 request_->first_party_for_cookies(); |
| 847 } | 847 } |
| 848 | 848 |
| 849 // Suppress the referrer if we're redirecting out of https. | 849 // Alter the referrer if we're redirecting out of https or cross-origin. |
| 850 if (request_->referrer_policy() == | 850 switch (request_->referrer_policy()) { |
| 851 URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE && | 851 case URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE: |
|
mmenke
2014/11/12 15:11:12
optional: Suggest using braces on all blocks, for
| |
| 852 GURL(request_->referrer()).SchemeIsSecure() && | 852 if (GURL(request_->referrer()).SchemeIsSecure() && |
| 853 !redirect_info.new_url.SchemeIsSecure()) { | 853 !redirect_info.new_url.SchemeIsSecure()) |
| 854 redirect_info.new_referrer.clear(); | 854 redirect_info.new_referrer.clear(); |
|
mmenke
2014/11/12 15:11:12
nit: Use brace when conditional of an if takes up
| |
| 855 } else { | 855 break; |
|
Ryan Sleevi
2014/11/13 20:00:33
BUG?: In the old code, this was unified as a singl
mmenke
2014/11/13 20:06:37
The fact that no test caught that is rather concer
mmenke
2014/11/13 20:06:37
The fact that no test caught that is very concerni
| |
| 856 | |
| 857 case URLRequest::REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN: { | |
| 858 GURL original_referrer(request_->referrer()); | |
|
mmenke
2014/11/12 15:11:12
No need for a copy here - can just use const GURL&
| |
| 859 if (original_referrer.SchemeIsSecure() && | |
| 860 !redirect_info.new_url.SchemeIsSecure()) { | |
| 861 redirect_info.new_referrer.clear(); | |
| 862 } else if (original_referrer.GetOrigin() != | |
| 863 redirect_info.new_url.GetOrigin()) { | |
| 864 redirect_info.new_referrer = original_referrer.GetOrigin().spec(); | |
| 865 } | |
| 866 break; | |
| 867 } | |
| 868 | |
| 869 case URLRequest::NEVER_CLEAR_REFERRER: | |
| 856 redirect_info.new_referrer = request_->referrer(); | 870 redirect_info.new_referrer = request_->referrer(); |
| 871 break; | |
|
mmenke
2014/11/12 15:11:12
fix indent
| |
| 857 } | 872 } |
| 858 | 873 |
| 859 return redirect_info; | 874 return redirect_info; |
| 860 } | 875 } |
| 861 | 876 |
| 862 } // namespace net | 877 } // namespace net |
| OLD | NEW |