Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(584)

Side by Side Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 333113002: Move data reduction proxy to Chrome-Proxy header for authentication (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@flywheel-refactor-net-fake-a-redirect-response-headers-chrome-proxy-auth
Patch Set: Added auth support to Android Webview Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 int ChromeNetworkDelegate::OnBeforeSendProxyHeaders(
483 net::URLRequest* request,
484 const net::ProxyInfo* proxy_info,
485 net::HttpRequestHeaders* headers) {
486 DCHECK(proxy_info);
marq (ping after 24h) 2014/06/25 16:39:26 Method body is indented two spaces too far.
bengr 2014/06/25 17:15:18 Done.
487 if (data_reduction_proxy_auth_request_handler_) {
488 data_reduction_proxy_auth_request_handler_->MaybeAddRequestHeader(
489 request, proxy_info->proxy_server(), headers);
490 }
491 return net::OK;
492 }
493
479 void ChromeNetworkDelegate::OnSendHeaders( 494 void ChromeNetworkDelegate::OnSendHeaders(
480 net::URLRequest* request, 495 net::URLRequest* request,
481 const net::HttpRequestHeaders& headers) { 496 const net::HttpRequestHeaders& headers) {
482 extensions_delegate_->OnSendHeaders(request, headers); 497 extensions_delegate_->OnSendHeaders(request, headers);
483 } 498 }
484 499
485 int ChromeNetworkDelegate::OnHeadersReceived( 500 int ChromeNetworkDelegate::OnHeadersReceived(
486 net::URLRequest* request, 501 net::URLRequest* request,
487 const net::CompletionCallback& callback, 502 const net::CompletionCallback& callback,
488 const net::HttpResponseHeaders* original_response_headers, 503 const net::HttpResponseHeaders* original_response_headers,
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 data_reduction_proxy::DataReductionProxyRequestType request_type) { 820 data_reduction_proxy::DataReductionProxyRequestType request_type) {
806 DCHECK_GE(received_content_length, 0); 821 DCHECK_GE(received_content_length, 0);
807 DCHECK_GE(original_content_length, 0); 822 DCHECK_GE(original_content_length, 0);
808 StoreAccumulatedContentLength(received_content_length, 823 StoreAccumulatedContentLength(received_content_length,
809 original_content_length, 824 original_content_length,
810 request_type, 825 request_type,
811 reinterpret_cast<Profile*>(profile_)); 826 reinterpret_cast<Profile*>(profile_));
812 received_content_length_ += received_content_length; 827 received_content_length_ += received_content_length;
813 original_content_length_ += original_content_length; 828 original_content_length_ += original_content_length;
814 } 829 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698