| 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 "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/core/browser/data_reduction_proxy_auth
_request_handler.h" | |
| 10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prot
ocol.h" | |
| 11 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | |
| 12 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 13 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
| 14 #include "net/proxy/proxy_info.h" | 11 #include "net/proxy/proxy_info.h" |
| 15 #include "net/proxy/proxy_server.h" | 12 #include "net/proxy/proxy_server.h" |
| 16 #include "net/url_request/url_request.h" | 13 #include "net/url_request/url_request.h" |
| 17 | 14 |
| 18 namespace android_webview { | 15 namespace android_webview { |
| 19 | 16 |
| 20 AwNetworkDelegate::AwNetworkDelegate() | 17 AwNetworkDelegate::AwNetworkDelegate() { |
| 21 : data_reduction_proxy_params_(NULL), | |
| 22 data_reduction_proxy_auth_request_handler_(NULL) { | |
| 23 } | 18 } |
| 24 | 19 |
| 25 AwNetworkDelegate::~AwNetworkDelegate() { | 20 AwNetworkDelegate::~AwNetworkDelegate() { |
| 26 } | 21 } |
| 27 | 22 |
| 28 int AwNetworkDelegate::OnBeforeURLRequest( | 23 int AwNetworkDelegate::OnBeforeURLRequest( |
| 29 net::URLRequest* request, | 24 net::URLRequest* request, |
| 30 const net::CompletionCallback& callback, | 25 const net::CompletionCallback& callback, |
| 31 GURL* new_url) { | 26 GURL* new_url) { |
| 32 return net::OK; | 27 return net::OK; |
| 33 } | 28 } |
| 34 | 29 |
| 35 int AwNetworkDelegate::OnBeforeSendHeaders( | 30 int AwNetworkDelegate::OnBeforeSendHeaders( |
| 36 net::URLRequest* request, | 31 net::URLRequest* request, |
| 37 const net::CompletionCallback& callback, | 32 const net::CompletionCallback& callback, |
| 38 net::HttpRequestHeaders* headers) { | 33 net::HttpRequestHeaders* headers) { |
| 39 | 34 |
| 40 DCHECK(headers); | 35 DCHECK(headers); |
| 41 headers->SetHeaderIfMissing( | 36 headers->SetHeaderIfMissing( |
| 42 "X-Requested-With", | 37 "X-Requested-With", |
| 43 base::android::BuildInfo::GetInstance()->package_name()); | 38 base::android::BuildInfo::GetInstance()->package_name()); |
| 44 return net::OK; | 39 return net::OK; |
| 45 } | 40 } |
| 46 | 41 |
| 47 void AwNetworkDelegate::OnBeforeSendProxyHeaders( | |
| 48 net::URLRequest* request, | |
| 49 const net::ProxyInfo& proxy_info, | |
| 50 net::HttpRequestHeaders* headers) { | |
| 51 if (data_reduction_proxy_auth_request_handler_) { | |
| 52 data_reduction_proxy_auth_request_handler_->MaybeAddRequestHeader( | |
| 53 request, proxy_info.proxy_server(), headers); | |
| 54 } | |
| 55 } | |
| 56 | |
| 57 void AwNetworkDelegate::OnSendHeaders(net::URLRequest* request, | 42 void AwNetworkDelegate::OnSendHeaders(net::URLRequest* request, |
| 58 const net::HttpRequestHeaders& headers) { | 43 const net::HttpRequestHeaders& headers) { |
| 59 } | 44 } |
| 60 | 45 |
| 61 int AwNetworkDelegate::OnHeadersReceived( | 46 int AwNetworkDelegate::OnHeadersReceived( |
| 62 net::URLRequest* request, | 47 net::URLRequest* request, |
| 63 const net::CompletionCallback& callback, | 48 const net::CompletionCallback& callback, |
| 64 const net::HttpResponseHeaders* original_response_headers, | 49 const net::HttpResponseHeaders* original_response_headers, |
| 65 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, | 50 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, |
| 66 GURL* allowed_unsafe_redirect_url) { | 51 GURL* allowed_unsafe_redirect_url) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 const base::FilePath& path) const { | 99 const base::FilePath& path) const { |
| 115 return true; | 100 return true; |
| 116 } | 101 } |
| 117 | 102 |
| 118 bool AwNetworkDelegate::OnCanThrottleRequest( | 103 bool AwNetworkDelegate::OnCanThrottleRequest( |
| 119 const net::URLRequest& request) const { | 104 const net::URLRequest& request) const { |
| 120 return false; | 105 return false; |
| 121 } | 106 } |
| 122 | 107 |
| 123 } // namespace android_webview | 108 } // namespace android_webview |
| OLD | NEW |