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

Side by Side Diff: android_webview/browser/net/aw_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: Callback returns void 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 "android_webview/browser/net/aw_network_delegate.h" 5 #include "android_webview/browser/net/aw_network_delegate.h"
6 6
7 #include "android_webview/browser/aw_cookie_access_policy.h" 7 #include "android_webview/browser/aw_cookie_access_policy.h"
8 #include "base/android/build_info.h" 8 #include "base/android/build_info.h"
9 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h"
10 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
9 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" 11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h"
10 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
11 #include "net/base/completion_callback.h" 13 #include "net/base/completion_callback.h"
14 #include "net/proxy/proxy_info.h"
15 #include "net/proxy/proxy_server.h"
12 #include "net/url_request/url_request.h" 16 #include "net/url_request/url_request.h"
13 17
14 namespace android_webview { 18 namespace android_webview {
15 19
16 AwNetworkDelegate::AwNetworkDelegate() : data_reduction_proxy_params_(NULL) { 20 AwNetworkDelegate::AwNetworkDelegate()
21 : data_reduction_proxy_params_(NULL),
22 data_reduction_proxy_auth_request_handler_(NULL) {
17 } 23 }
18 24
19 AwNetworkDelegate::~AwNetworkDelegate() { 25 AwNetworkDelegate::~AwNetworkDelegate() {
20 } 26 }
21 27
22 int AwNetworkDelegate::OnBeforeURLRequest( 28 int AwNetworkDelegate::OnBeforeURLRequest(
23 net::URLRequest* request, 29 net::URLRequest* request,
24 const net::CompletionCallback& callback, 30 const net::CompletionCallback& callback,
25 GURL* new_url) { 31 GURL* new_url) {
26 return net::OK; 32 return net::OK;
27 } 33 }
28 34
29 int AwNetworkDelegate::OnBeforeSendHeaders( 35 int AwNetworkDelegate::OnBeforeSendHeaders(
30 net::URLRequest* request, 36 net::URLRequest* request,
31 const net::CompletionCallback& callback, 37 const net::CompletionCallback& callback,
32 net::HttpRequestHeaders* headers) { 38 net::HttpRequestHeaders* headers) {
33 39
34 DCHECK(headers); 40 DCHECK(headers);
35 headers->SetHeaderIfMissing( 41 headers->SetHeaderIfMissing(
36 "X-Requested-With", 42 "X-Requested-With",
37 base::android::BuildInfo::GetInstance()->package_name()); 43 base::android::BuildInfo::GetInstance()->package_name());
38 return net::OK; 44 return net::OK;
39 } 45 }
40 46
47 void AwNetworkDelegate::OnBeforeSendProxyHeaders(
48 net::URLRequest* request,
49 const net::ProxyInfo* proxy_info,
50 net::HttpRequestHeaders* headers) {
51 DCHECK(proxy_info);
52 if (data_reduction_proxy_auth_request_handler_) {
53 data_reduction_proxy_auth_request_handler_->MaybeAddRequestHeader(
54 request, proxy_info->proxy_server(), headers);
55 }
56 }
57
41 void AwNetworkDelegate::OnSendHeaders(net::URLRequest* request, 58 void AwNetworkDelegate::OnSendHeaders(net::URLRequest* request,
42 const net::HttpRequestHeaders& headers) { 59 const net::HttpRequestHeaders& headers) {
43 } 60 }
44 61
45 int AwNetworkDelegate::OnHeadersReceived( 62 int AwNetworkDelegate::OnHeadersReceived(
46 net::URLRequest* request, 63 net::URLRequest* request,
47 const net::CompletionCallback& callback, 64 const net::CompletionCallback& callback,
48 const net::HttpResponseHeaders* original_response_headers, 65 const net::HttpResponseHeaders* original_response_headers,
49 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, 66 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
50 GURL* allowed_unsafe_redirect_url) { 67 GURL* allowed_unsafe_redirect_url) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return false; 128 return false;
112 } 129 }
113 130
114 int AwNetworkDelegate::OnBeforeSocketStreamConnect( 131 int AwNetworkDelegate::OnBeforeSocketStreamConnect(
115 net::SocketStream* stream, 132 net::SocketStream* stream,
116 const net::CompletionCallback& callback) { 133 const net::CompletionCallback& callback) {
117 return net::OK; 134 return net::OK;
118 } 135 }
119 136
120 } // namespace android_webview 137 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698