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 13 matching lines...) Expand all Loading... | |
| 24 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 24 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 25 #include "chrome/browser/net/chrome_extensions_network_delegate.h" | 25 #include "chrome/browser/net/chrome_extensions_network_delegate.h" |
| 26 #include "chrome/browser/net/client_hints.h" | 26 #include "chrome/browser/net/client_hints.h" |
| 27 #include "chrome/browser/net/connect_interceptor.h" | 27 #include "chrome/browser/net/connect_interceptor.h" |
| 28 #include "chrome/browser/performance_monitor/performance_monitor.h" | 28 #include "chrome/browser/performance_monitor/performance_monitor.h" |
| 29 #include "chrome/browser/prerender/prerender_tracker.h" | 29 #include "chrome/browser/prerender/prerender_tracker.h" |
| 30 #include "chrome/browser/profiles/profile_manager.h" | 30 #include "chrome/browser/profiles/profile_manager.h" |
| 31 #include "chrome/browser/task_manager/task_manager.h" | 31 #include "chrome/browser/task_manager/task_manager.h" |
| 32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 33 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
| 34 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h" | |
| 34 #include "components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h " | 35 #include "components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h " |
| 35 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | 36 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
| 36 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" | 37 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" |
| 37 #include "components/domain_reliability/monitor.h" | 38 #include "components/domain_reliability/monitor.h" |
| 38 #include "components/google/core/browser/google_util.h" | 39 #include "components/google/core/browser/google_util.h" |
| 39 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
| 40 #include "content/public/browser/render_frame_host.h" | 41 #include "content/public/browser/render_frame_host.h" |
| 41 #include "content/public/browser/render_view_host.h" | 42 #include "content/public/browser/render_view_host.h" |
| 42 #include "content/public/browser/resource_request_info.h" | 43 #include "content/public/browser/resource_request_info.h" |
| 43 #include "extensions/common/constants.h" | 44 #include "extensions/common/constants.h" |
| 44 #include "net/base/host_port_pair.h" | 45 #include "net/base/host_port_pair.h" |
| 45 #include "net/base/net_errors.h" | 46 #include "net/base/net_errors.h" |
| 46 #include "net/base/net_log.h" | 47 #include "net/base/net_log.h" |
| 47 #include "net/cookies/canonical_cookie.h" | 48 #include "net/cookies/canonical_cookie.h" |
| 48 #include "net/cookies/cookie_options.h" | 49 #include "net/cookies/cookie_options.h" |
| 49 #include "net/http/http_request_headers.h" | 50 #include "net/http/http_request_headers.h" |
| 50 #include "net/http/http_response_headers.h" | 51 #include "net/http/http_response_headers.h" |
| 52 #include "net/proxy/proxy_info.h" | |
| 53 #include "net/proxy/proxy_server.h" | |
| 51 #include "net/socket_stream/socket_stream.h" | 54 #include "net/socket_stream/socket_stream.h" |
| 52 #include "net/url_request/url_request.h" | 55 #include "net/url_request/url_request.h" |
| 53 #include "net/url_request/url_request_context.h" | 56 #include "net/url_request/url_request_context.h" |
| 54 | 57 |
| 55 #if defined(OS_ANDROID) | 58 #if defined(OS_ANDROID) |
| 56 #include "chrome/browser/io_thread.h" | 59 #include "chrome/browser/io_thread.h" |
| 57 #include "components/precache/content/precache_manager.h" | 60 #include "components/precache/content/precache_manager.h" |
| 58 #include "components/precache/content/precache_manager_factory.h" | 61 #include "components/precache/content/precache_manager_factory.h" |
| 59 #endif | 62 #endif |
| 60 | 63 |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 469 } | 472 } |
| 470 | 473 |
| 471 int ChromeNetworkDelegate::OnBeforeSendHeaders( | 474 int ChromeNetworkDelegate::OnBeforeSendHeaders( |
| 472 net::URLRequest* request, | 475 net::URLRequest* request, |
| 473 const net::CompletionCallback& callback, | 476 const net::CompletionCallback& callback, |
| 474 net::HttpRequestHeaders* headers) { | 477 net::HttpRequestHeaders* headers) { |
| 475 TRACE_EVENT_ASYNC_STEP_PAST0("net", "URLRequest", request, "SendRequest"); | 478 TRACE_EVENT_ASYNC_STEP_PAST0("net", "URLRequest", request, "SendRequest"); |
| 476 return extensions_delegate_->OnBeforeSendHeaders(request, callback, headers); | 479 return extensions_delegate_->OnBeforeSendHeaders(request, callback, headers); |
| 477 } | 480 } |
| 478 | 481 |
| 482 void ChromeNetworkDelegate::OnBeforeSendProxyHeaders( | |
| 483 net::URLRequest* request, | |
| 484 const net::ProxyInfo* proxy_info, | |
| 485 net::HttpRequestHeaders* headers) { | |
| 486 DCHECK(proxy_info); | |
| 487 if (data_reduction_proxy_auth_request_handler_) { | |
|
mef
2014/06/25 17:21:33
BUG? Is this initialized in constructor?
bengr
2014/06/25 19:25:22
Done.
| |
| 488 data_reduction_proxy_auth_request_handler_->MaybeAddRequestHeader( | |
| 489 request, proxy_info->proxy_server(), headers); | |
| 490 } | |
| 491 } | |
| 492 | |
| 479 void ChromeNetworkDelegate::OnSendHeaders( | 493 void ChromeNetworkDelegate::OnSendHeaders( |
| 480 net::URLRequest* request, | 494 net::URLRequest* request, |
| 481 const net::HttpRequestHeaders& headers) { | 495 const net::HttpRequestHeaders& headers) { |
| 482 extensions_delegate_->OnSendHeaders(request, headers); | 496 extensions_delegate_->OnSendHeaders(request, headers); |
| 483 } | 497 } |
| 484 | 498 |
| 485 int ChromeNetworkDelegate::OnHeadersReceived( | 499 int ChromeNetworkDelegate::OnHeadersReceived( |
| 486 net::URLRequest* request, | 500 net::URLRequest* request, |
| 487 const net::CompletionCallback& callback, | 501 const net::CompletionCallback& callback, |
| 488 const net::HttpResponseHeaders* original_response_headers, | 502 const net::HttpResponseHeaders* original_response_headers, |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 805 data_reduction_proxy::DataReductionProxyRequestType request_type) { | 819 data_reduction_proxy::DataReductionProxyRequestType request_type) { |
| 806 DCHECK_GE(received_content_length, 0); | 820 DCHECK_GE(received_content_length, 0); |
| 807 DCHECK_GE(original_content_length, 0); | 821 DCHECK_GE(original_content_length, 0); |
| 808 StoreAccumulatedContentLength(received_content_length, | 822 StoreAccumulatedContentLength(received_content_length, |
| 809 original_content_length, | 823 original_content_length, |
| 810 request_type, | 824 request_type, |
| 811 reinterpret_cast<Profile*>(profile_)); | 825 reinterpret_cast<Profile*>(profile_)); |
| 812 received_content_length_ += received_content_length; | 826 received_content_length_ += received_content_length; |
| 813 original_content_length_ += original_content_length; | 827 original_content_length_ += original_content_length; |
| 814 } | 828 } |
| OLD | NEW |