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 "chrome/browser/net/chrome_network_delegate.h" | 5 #include "chrome/browser/net/chrome_network_delegate.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 #include "content/public/browser/render_frame_host.h" | 40 #include "content/public/browser/render_frame_host.h" |
| 41 #include "content/public/browser/render_view_host.h" | 41 #include "content/public/browser/render_view_host.h" |
| 42 #include "content/public/browser/resource_request_info.h" | 42 #include "content/public/browser/resource_request_info.h" |
| 43 #include "net/base/host_port_pair.h" | 43 #include "net/base/host_port_pair.h" |
| 44 #include "net/base/net_errors.h" | 44 #include "net/base/net_errors.h" |
| 45 #include "net/base/net_log.h" | 45 #include "net/base/net_log.h" |
| 46 #include "net/cookies/canonical_cookie.h" | 46 #include "net/cookies/canonical_cookie.h" |
| 47 #include "net/cookies/cookie_options.h" | 47 #include "net/cookies/cookie_options.h" |
| 48 #include "net/http/http_request_headers.h" | 48 #include "net/http/http_request_headers.h" |
| 49 #include "net/http/http_response_headers.h" | 49 #include "net/http/http_response_headers.h" |
| 50 #include "net/proxy/proxy_config.h" | |
| 50 #include "net/proxy/proxy_info.h" | 51 #include "net/proxy/proxy_info.h" |
| 52 #include "net/proxy/proxy_retry_info.h" | |
| 51 #include "net/proxy/proxy_server.h" | 53 #include "net/proxy/proxy_server.h" |
| 52 #include "net/socket_stream/socket_stream.h" | 54 #include "net/socket_stream/socket_stream.h" |
| 53 #include "net/url_request/url_request.h" | 55 #include "net/url_request/url_request.h" |
| 54 #include "net/url_request/url_request_context.h" | 56 #include "net/url_request/url_request_context.h" |
| 55 | 57 |
| 56 #if defined(OS_ANDROID) | 58 #if defined(OS_ANDROID) |
| 57 #include "chrome/browser/io_thread.h" | 59 #include "chrome/browser/io_thread.h" |
| 58 #include "components/precache/content/precache_manager.h" | 60 #include "components/precache/content/precache_manager.h" |
| 59 #include "components/precache/content/precache_manager_factory.h" | 61 #include "components/precache/content/precache_manager_factory.h" |
| 60 #endif | 62 #endif |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 420 if (force_safe_search && rv == net::OK && new_url->is_empty()) | 422 if (force_safe_search && rv == net::OK && new_url->is_empty()) |
| 421 safe_search_util::ForceGoogleSafeSearch(request, new_url); | 423 safe_search_util::ForceGoogleSafeSearch(request, new_url); |
| 422 | 424 |
| 423 if (connect_interceptor_) | 425 if (connect_interceptor_) |
| 424 connect_interceptor_->WitnessURLRequest(request); | 426 connect_interceptor_->WitnessURLRequest(request); |
| 425 | 427 |
| 426 return rv; | 428 return rv; |
| 427 } | 429 } |
| 428 | 430 |
| 429 void ChromeNetworkDelegate::OnResolveProxy( | 431 void ChromeNetworkDelegate::OnResolveProxy( |
| 430 const GURL& url, int load_flags, net::ProxyInfo* result) { | 432 const GURL& url, |
| 431 if (!on_resolve_proxy_handler_.is_null()) { | 433 int load_flags, |
| 434 const net::ProxyService* proxy_service, | |
| 435 net::ProxyInfo* result) { | |
| 436 if (!on_resolve_proxy_handler_.is_null() && | |
| 437 !proxy_config_getter_.is_null()) { | |
| 438 net::ProxyConfig data_reduction_proxy_config; | |
| 439 proxy_config_getter_.Run(&data_reduction_proxy_config); | |
| 432 on_resolve_proxy_handler_.Run(url, load_flags, | 440 on_resolve_proxy_handler_.Run(url, load_flags, |
| 441 data_reduction_proxy_config, | |
| 442 proxy_service->proxy_retry_info(), | |
|
mef
2014/08/11 19:44:40
If proxy_service is never NULL, should it be a con
bengr
2014/08/11 23:03:19
Done.
| |
| 433 data_reduction_proxy_params_, result); | 443 data_reduction_proxy_params_, result); |
| 434 } | 444 } |
| 435 } | 445 } |
| 436 | 446 |
| 437 void ChromeNetworkDelegate::OnProxyFallback(const net::ProxyServer& bad_proxy, | 447 void ChromeNetworkDelegate::OnProxyFallback(const net::ProxyServer& bad_proxy, |
| 438 int net_error, | 448 int net_error, |
| 439 bool did_fallback) { | 449 bool did_fallback) { |
| 440 if (data_reduction_proxy_usage_stats_) { | 450 if (data_reduction_proxy_usage_stats_) { |
| 441 data_reduction_proxy_usage_stats_->RecordBypassEventHistograms( | 451 data_reduction_proxy_usage_stats_->RecordBypassEventHistograms( |
| 442 bad_proxy, net_error, did_fallback); | 452 bad_proxy, net_error, did_fallback); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 810 data_reduction_proxy::DataReductionProxyRequestType request_type) { | 820 data_reduction_proxy::DataReductionProxyRequestType request_type) { |
| 811 DCHECK_GE(received_content_length, 0); | 821 DCHECK_GE(received_content_length, 0); |
| 812 DCHECK_GE(original_content_length, 0); | 822 DCHECK_GE(original_content_length, 0); |
| 813 StoreAccumulatedContentLength(received_content_length, | 823 StoreAccumulatedContentLength(received_content_length, |
| 814 original_content_length, | 824 original_content_length, |
| 815 request_type, | 825 request_type, |
| 816 reinterpret_cast<Profile*>(profile_)); | 826 reinterpret_cast<Profile*>(profile_)); |
| 817 received_content_length_ += received_content_length; | 827 received_content_length_ += received_content_length; |
| 818 original_content_length_ += original_content_length; | 828 original_content_length_ += original_content_length; |
| 819 } | 829 } |
| OLD | NEW |