| 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 "content/public/browser/android/download_controller_android.h" | 7 #include "content/public/browser/android/download_controller_android.h" |
| 8 #include "content/public/browser/resource_controller.h" | 8 #include "content/public/browser/resource_controller.h" |
| 9 #include "net/http/http_request_headers.h" | 9 #include "net/http/http_request_headers.h" |
| 10 #include "net/url_request/url_request.h" | 10 #include "net/url_request/url_request.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 void InterceptDownloadResourceThrottle::WillStartRequest(bool* defer) { | 28 void InterceptDownloadResourceThrottle::WillStartRequest(bool* defer) { |
| 29 ProcessDownloadRequest(); | 29 ProcessDownloadRequest(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void InterceptDownloadResourceThrottle::WillProcessResponse(bool* defer) { | 32 void InterceptDownloadResourceThrottle::WillProcessResponse(bool* defer) { |
| 33 ProcessDownloadRequest(); | 33 ProcessDownloadRequest(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void InterceptDownloadResourceThrottle::ProcessDownloadRequest() { | 36 void InterceptDownloadResourceThrottle::ProcessDownloadRequest() { |
| 37 if (request_->method() != net::HttpRequestHeaders::kGetMethod) | 37 if (request_->method() != net::HttpRequestHeaders::kGetMethod || |
| 38 request_->response_info().did_use_http_auth) |
| 38 return; | 39 return; |
| 39 | 40 |
| 40 content::DownloadControllerAndroid::Get()->CreateGETDownload( | 41 content::DownloadControllerAndroid::Get()->CreateGETDownload( |
| 41 render_process_id_, render_view_id_, request_id_); | 42 render_process_id_, render_view_id_, request_id_); |
| 42 controller()->Cancel(); | 43 controller()->Cancel(); |
| 43 } | 44 } |
| 44 | 45 |
| 45 } // namespace | 46 } // namespace |
| OLD | NEW |