Chromium Code Reviews| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc |
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc |
| index 16467f14922df1455ebfe814c82a3054976a0dad..e8522c822886f9ad2993f315c93210410c9a5628 100644 |
| --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc |
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc |
| @@ -6,23 +6,25 @@ |
| #include <utility> |
| #include "base/metrics/histogram_macros.h" |
| #include "base/strings/string_number_conversions.h" |
| #include "base/time/time.h" |
| #include "base/values.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.h" |
| +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h" |
| #include "components/data_reduction_proxy/core/common/lofi_decider.h" |
| +#include "content/browser/frame_host/navigation_user_data.h" |
| #include "net/base/load_flags.h" |
| #include "net/http/http_request_headers.h" |
| #include "net/http/http_response_headers.h" |
| #include "net/proxy/proxy_info.h" |
| #include "net/proxy/proxy_server.h" |
| #include "net/proxy/proxy_service.h" |
| #include "net/url_request/url_request.h" |
| #include "net/url_request/url_request_context.h" |
| #include "net/url_request/url_request_status.h" |
| @@ -152,20 +154,28 @@ DataReductionProxyNetworkDelegate::SessionNetworkStatsInfoToValue() const { |
| base::Int64ToString(total_original_received_bytes_)); |
| return dict; |
| } |
| void DataReductionProxyNetworkDelegate::OnBeforeSendProxyHeadersInternal( |
| net::URLRequest* request, |
| const net::ProxyInfo& proxy_info, |
| net::HttpRequestHeaders* headers) { |
| DCHECK(data_reduction_proxy_config_); |
| + content::NavigationUserData* navigation_user_data = |
|
RyanSturm
2016/04/27 23:27:46
Check if this is a DRP proxy and not some other pr
|
| + static_cast<content::NavigationUserData*>( |
| + request->GetUserData(content::kNavigationUserDataKey)); |
| + if (navigation_user_data) { |
| + navigation_user_data->get_navigation_supports_user_data()->SetUserData( |
| + kDataReductionProxyUserDataKey, new DataReductionProxyData(true)); |
| + } |
| + |
| if (proxy_info.is_empty()) |
| return; |
| if (data_reduction_proxy_io_data_ && |
| data_reduction_proxy_io_data_->lofi_decider() && request) { |
| LoFiDecider* lofi_decider = data_reduction_proxy_io_data_->lofi_decider(); |
| bool is_using_lofi_mode = lofi_decider->MaybeAddLoFiDirectiveToHeaders( |
| *request, headers, proxy_info.proxy_server(), |
| data_reduction_proxy_config_); |