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/android/intercept_download_resource_throttle.h" | 5 #include "chrome/browser/android/intercept_download_resource_throttle.h" |
6 | 6 |
7 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" | 7 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" |
8 #include "content/public/browser/android/download_controller_android.h" | 8 #include "content/public/browser/android/download_controller_android.h" |
9 #include "content/public/browser/resource_controller.h" | 9 #include "content/public/browser/resource_controller.h" |
10 #include "net/http/http_request_headers.h" | 10 #include "net/http/http_request_headers.h" |
(...skipping 30 matching lines...) Expand all Loading... | |
41 | 41 |
42 void InterceptDownloadResourceThrottle::ProcessDownloadRequest() { | 42 void InterceptDownloadResourceThrottle::ProcessDownloadRequest() { |
43 if (request_->method() != net::HttpRequestHeaders::kGetMethod) | 43 if (request_->method() != net::HttpRequestHeaders::kGetMethod) |
44 return; | 44 return; |
45 | 45 |
46 // In general, if the request uses HTTP authorization, either with the origin | 46 // In general, if the request uses HTTP authorization, either with the origin |
47 // or a proxy, then the network stack should handle the download. The one | 47 // or a proxy, then the network stack should handle the download. The one |
48 // exception is a request that is fetched via the Chrome Proxy and does not | 48 // exception is a request that is fetched via the Chrome Proxy and does not |
49 // authenticate with the origin. | 49 // authenticate with the origin. |
50 if (request_->response_info().did_use_http_auth) { | 50 if (request_->response_info().did_use_http_auth) { |
51 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
bengr
2014/07/11 20:42:53
Currently, Android apps built from solely the chro
Not at Google. Contact bengr
2014/07/16 22:41:33
Discussed in person. Let's do the configuration re
| |
52 net::HttpRequestHeaders headers; | 51 net::HttpRequestHeaders headers; |
53 request_->GetFullRequestHeaders(&headers); | 52 request_->GetFullRequestHeaders(&headers); |
54 if (headers.HasHeader(net::HttpRequestHeaders::kAuthorization) || | 53 if (headers.HasHeader(net::HttpRequestHeaders::kAuthorization) || |
55 !(request_->response_info().headers && | 54 !(request_->response_info().headers && |
56 data_reduction_proxy::HasDataReductionProxyViaHeader( | 55 data_reduction_proxy::HasDataReductionProxyViaHeader( |
57 request_->response_info().headers))) { | 56 request_->response_info().headers))) { |
58 return; | 57 return; |
59 } | 58 } |
60 #else | 59 |
61 return; | |
62 #endif | |
63 } | 60 } |
64 | 61 |
65 if (request_->url_chain().empty()) | 62 if (request_->url_chain().empty()) |
66 return; | 63 return; |
67 | 64 |
68 GURL url = request_->url_chain().back(); | 65 GURL url = request_->url_chain().back(); |
69 if (!url.SchemeIsHTTPOrHTTPS()) | 66 if (!url.SchemeIsHTTPOrHTTPS()) |
70 return; | 67 return; |
71 | 68 |
72 content::DownloadControllerAndroid::Get()->CreateGETDownload( | 69 content::DownloadControllerAndroid::Get()->CreateGETDownload( |
73 render_process_id_, render_view_id_, request_id_); | 70 render_process_id_, render_view_id_, request_id_); |
74 controller()->Cancel(); | 71 controller()->Cancel(); |
75 } | 72 } |
76 | 73 |
77 } // namespace chrome | 74 } // namespace chrome |
OLD | NEW |