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 24 matching lines...) Expand all Loading... |
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 request_->response_info().did_use_http_auth) |
39 return; | 39 return; |
40 | 40 |
41 if (request_->url_chain().empty()) | 41 if (request_->url_chain().empty()) |
42 return; | 42 return; |
43 | 43 |
44 GURL url = request_->url_chain().back(); | 44 GURL url = request_->url_chain().back(); |
45 if (!url.SchemeIs("http") && !url.SchemeIs("https")) | 45 if (!url.SchemeIsHTTPOrHTTPS()) |
46 return; | 46 return; |
47 | 47 |
48 content::DownloadControllerAndroid::Get()->CreateGETDownload( | 48 content::DownloadControllerAndroid::Get()->CreateGETDownload( |
49 render_process_id_, render_view_id_, request_id_); | 49 render_process_id_, render_view_id_, request_id_); |
50 controller()->Cancel(); | 50 controller()->Cancel(); |
51 } | 51 } |
52 | 52 |
53 } // namespace | 53 } // namespace |
OLD | NEW |