| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 redirect_info.new_first_party_for_cookies = | 946 redirect_info.new_first_party_for_cookies = |
| 947 request_->first_party_for_cookies(); | 947 request_->first_party_for_cookies(); |
| 948 } | 948 } |
| 949 | 949 |
| 950 // Alter the referrer if redirecting cross-origin (especially HTTP->HTTPS). | 950 // Alter the referrer if redirecting cross-origin (especially HTTP->HTTPS). |
| 951 redirect_info.new_referrer = | 951 redirect_info.new_referrer = |
| 952 ComputeReferrerForRedirect(request_->referrer_policy(), | 952 ComputeReferrerForRedirect(request_->referrer_policy(), |
| 953 request_->referrer(), | 953 request_->referrer(), |
| 954 redirect_info.new_url).spec(); | 954 redirect_info.new_url).spec(); |
| 955 | 955 |
| 956 std::string include_referer; |
| 957 request_->GetResponseHeaderByName("include-referer-token-binding-id", |
| 958 &include_referer); |
| 959 if (include_referer == "true" && |
| 960 request_->ssl_info().token_binding_negotiated) { |
| 961 redirect_info.referred_token_binding_host = url.host(); |
| 962 } |
| 963 |
| 956 return redirect_info; | 964 return redirect_info; |
| 957 } | 965 } |
| 958 | 966 |
| 959 void URLRequestJob::MaybeNotifyNetworkBytes() { | 967 void URLRequestJob::MaybeNotifyNetworkBytes() { |
| 960 if (!network_delegate_) | 968 if (!network_delegate_) |
| 961 return; | 969 return; |
| 962 | 970 |
| 963 // Report any new received bytes. | 971 // Report any new received bytes. |
| 964 int64_t total_received_bytes = GetTotalReceivedBytes(); | 972 int64_t total_received_bytes = GetTotalReceivedBytes(); |
| 965 DCHECK_GE(total_received_bytes, last_notified_total_received_bytes_); | 973 DCHECK_GE(total_received_bytes, last_notified_total_received_bytes_); |
| 966 if (total_received_bytes > last_notified_total_received_bytes_) { | 974 if (total_received_bytes > last_notified_total_received_bytes_) { |
| 967 network_delegate_->NotifyNetworkBytesReceived( | 975 network_delegate_->NotifyNetworkBytesReceived( |
| 968 request_, total_received_bytes - last_notified_total_received_bytes_); | 976 request_, total_received_bytes - last_notified_total_received_bytes_); |
| 969 } | 977 } |
| 970 last_notified_total_received_bytes_ = total_received_bytes; | 978 last_notified_total_received_bytes_ = total_received_bytes; |
| 971 | 979 |
| 972 // Report any new sent bytes. | 980 // Report any new sent bytes. |
| 973 int64_t total_sent_bytes = GetTotalSentBytes(); | 981 int64_t total_sent_bytes = GetTotalSentBytes(); |
| 974 DCHECK_GE(total_sent_bytes, last_notified_total_sent_bytes_); | 982 DCHECK_GE(total_sent_bytes, last_notified_total_sent_bytes_); |
| 975 if (total_sent_bytes > last_notified_total_sent_bytes_) { | 983 if (total_sent_bytes > last_notified_total_sent_bytes_) { |
| 976 network_delegate_->NotifyNetworkBytesSent( | 984 network_delegate_->NotifyNetworkBytesSent( |
| 977 request_, total_sent_bytes - last_notified_total_sent_bytes_); | 985 request_, total_sent_bytes - last_notified_total_sent_bytes_); |
| 978 } | 986 } |
| 979 last_notified_total_sent_bytes_ = total_sent_bytes; | 987 last_notified_total_sent_bytes_ = total_sent_bytes; |
| 980 } | 988 } |
| 981 | 989 |
| 982 } // namespace net | 990 } // namespace net |
| OLD | NEW |