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

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: 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 30 matching lines...) Expand all
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 "extensions/common/constants.h" 43 #include "extensions/common/constants.h"
44 #include "net/base/host_port_pair.h" 44 #include "net/base/host_port_pair.h"
45 #include "net/base/net_errors.h" 45 #include "net/base/net_errors.h"
46 #include "net/base/net_log.h" 46 #include "net/base/net_log.h"
47 #include "net/cookies/canonical_cookie.h" 47 #include "net/cookies/canonical_cookie.h"
48 #include "net/cookies/cookie_options.h" 48 #include "net/cookies/cookie_options.h"
49 #include "net/http/http_request_headers.h" 49 #include "net/http/http_request_headers.h"
50 #include "net/http/http_response_headers.h" 50 #include "net/http/http_response_headers.h"
51 #include "net/proxy/proxy_info.h"
52 #include "net/proxy/proxy_server.h"
51 #include "net/socket_stream/socket_stream.h" 53 #include "net/socket_stream/socket_stream.h"
52 #include "net/url_request/url_request.h" 54 #include "net/url_request/url_request.h"
53 #include "net/url_request/url_request_context.h" 55 #include "net/url_request/url_request_context.h"
54 56
55 #if defined(OS_ANDROID) 57 #if defined(OS_ANDROID)
56 #include "chrome/browser/io_thread.h" 58 #include "chrome/browser/io_thread.h"
57 #include "components/precache/content/precache_manager.h" 59 #include "components/precache/content/precache_manager.h"
58 #include "components/precache/content/precache_manager_factory.h" 60 #include "components/precache/content/precache_manager_factory.h"
59 #endif 61 #endif
60 62
61 #if defined(OS_CHROMEOS) 63 #if defined(OS_CHROMEOS)
62 #include "base/command_line.h" 64 #include "base/command_line.h"
63 #include "base/sys_info.h" 65 #include "base/sys_info.h"
64 #include "chrome/common/chrome_switches.h" 66 #include "chrome/common/chrome_switches.h"
65 #endif 67 #endif
66 68
67 #if defined(ENABLE_CONFIGURATION_POLICY) 69 #if defined(ENABLE_CONFIGURATION_POLICY)
68 #include "components/policy/core/browser/url_blacklist_manager.h" 70 #include "components/policy/core/browser/url_blacklist_manager.h"
69 #endif 71 #endif
70 72
73 #if defined(OS_ANDROID)
mef 2014/06/24 17:41:56 Why is this included on Android only?
bengr 2014/06/24 19:01:50 Uggh. Rebase automerge. Done.
74 #include "chrome/browser/io_thread.h"
75 #include "components/precache/content/precache_manager.h"
76 #include "components/precache/content/precache_manager_factory.h"
77 #endif
78
71 using content::BrowserThread; 79 using content::BrowserThread;
72 using content::RenderViewHost; 80 using content::RenderViewHost;
73 using content::ResourceRequestInfo; 81 using content::ResourceRequestInfo;
74 82
75 // By default we don't allow access to all file:// urls on ChromeOS and 83 // By default we don't allow access to all file:// urls on ChromeOS and
76 // Android. 84 // Android.
77 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) 85 #if defined(OS_CHROMEOS) || defined(OS_ANDROID)
78 bool ChromeNetworkDelegate::g_allow_file_access_ = false; 86 bool ChromeNetworkDelegate::g_allow_file_access_ = false;
79 #else 87 #else
80 bool ChromeNetworkDelegate::g_allow_file_access_ = true; 88 bool ChromeNetworkDelegate::g_allow_file_access_ = true;
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 } 477 }
470 478
471 int ChromeNetworkDelegate::OnBeforeSendHeaders( 479 int ChromeNetworkDelegate::OnBeforeSendHeaders(
472 net::URLRequest* request, 480 net::URLRequest* request,
473 const net::CompletionCallback& callback, 481 const net::CompletionCallback& callback,
474 net::HttpRequestHeaders* headers) { 482 net::HttpRequestHeaders* headers) {
475 TRACE_EVENT_ASYNC_STEP_PAST0("net", "URLRequest", request, "SendRequest"); 483 TRACE_EVENT_ASYNC_STEP_PAST0("net", "URLRequest", request, "SendRequest");
476 return extensions_delegate_->OnBeforeSendHeaders(request, callback, headers); 484 return extensions_delegate_->OnBeforeSendHeaders(request, callback, headers);
477 } 485 }
478 486
487 int ChromeNetworkDelegate::OnBeforeSendProxyHeaders(
488 net::URLRequest* request,
489 const net::ProxyInfo* proxy_info,
490 net::HttpRequestHeaders* headers) {
491 DCHECK(proxy_info);
492 if (data_reduction_proxy_auth_request_handler_) {
493 data_reduction_proxy_auth_request_handler_->MaybeAddRequestHeader(
mef 2014/06/24 17:41:56 Should there be some meaningful return here?
bengr 2014/06/24 19:01:50 I guess there could be. I wasn't sure about the re
bengr 2014/06/25 16:12:35 Changed to a void return.
494 request, proxy_info->proxy_server(), headers);
495 }
496 return net::OK;
497 }
498
479 void ChromeNetworkDelegate::OnSendHeaders( 499 void ChromeNetworkDelegate::OnSendHeaders(
480 net::URLRequest* request, 500 net::URLRequest* request,
481 const net::HttpRequestHeaders& headers) { 501 const net::HttpRequestHeaders& headers) {
482 extensions_delegate_->OnSendHeaders(request, headers); 502 extensions_delegate_->OnSendHeaders(request, headers);
483 } 503 }
484 504
485 int ChromeNetworkDelegate::OnHeadersReceived( 505 int ChromeNetworkDelegate::OnHeadersReceived(
486 net::URLRequest* request, 506 net::URLRequest* request,
487 const net::CompletionCallback& callback, 507 const net::CompletionCallback& callback,
488 const net::HttpResponseHeaders* original_response_headers, 508 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) { 825 data_reduction_proxy::DataReductionProxyRequestType request_type) {
806 DCHECK_GE(received_content_length, 0); 826 DCHECK_GE(received_content_length, 0);
807 DCHECK_GE(original_content_length, 0); 827 DCHECK_GE(original_content_length, 0);
808 StoreAccumulatedContentLength(received_content_length, 828 StoreAccumulatedContentLength(received_content_length,
809 original_content_length, 829 original_content_length,
810 request_type, 830 request_type,
811 reinterpret_cast<Profile*>(profile_)); 831 reinterpret_cast<Profile*>(profile_));
812 received_content_length_ += received_content_length; 832 received_content_length_ += received_content_length;
813 original_content_length_ += original_content_length; 833 original_content_length_ += original_content_length;
814 } 834 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698