| 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 "base/feature_list.h" | 7 #include "base/feature_list.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "chrome/browser/android/chrome_feature_list.h" | 9 #include "chrome/browser/android/chrome_feature_list.h" |
| 10 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" | 10 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 namespace chrome { | 47 namespace chrome { |
| 48 | 48 |
| 49 // static | 49 // static |
| 50 bool InterceptDownloadResourceThrottle::IsDownloadInterceptionEnabled() { | 50 bool InterceptDownloadResourceThrottle::IsDownloadInterceptionEnabled() { |
| 51 return base::FeatureList::IsEnabled(chrome::android::kSystemDownloadManager); | 51 return base::FeatureList::IsEnabled(chrome::android::kSystemDownloadManager); |
| 52 } | 52 } |
| 53 | 53 |
| 54 InterceptDownloadResourceThrottle::InterceptDownloadResourceThrottle( | 54 InterceptDownloadResourceThrottle::InterceptDownloadResourceThrottle( |
| 55 net::URLRequest* request, | 55 net::URLRequest* request, |
| 56 int render_process_id, | 56 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, |
| 57 int render_view_id, | |
| 58 bool must_download) | 57 bool must_download) |
| 59 : request_(request), | 58 : request_(request), |
| 60 render_process_id_(render_process_id), | 59 wc_getter_(wc_getter), |
| 61 render_view_id_(render_view_id), | |
| 62 must_download_(must_download), | 60 must_download_(must_download), |
| 63 weak_factory_(this) { | 61 weak_factory_(this) { |
| 64 } | 62 } |
| 65 | 63 |
| 66 InterceptDownloadResourceThrottle::~InterceptDownloadResourceThrottle() { | 64 InterceptDownloadResourceThrottle::~InterceptDownloadResourceThrottle() { |
| 67 } | 65 } |
| 68 | 66 |
| 69 void InterceptDownloadResourceThrottle::WillProcessResponse(bool* defer) { | 67 void InterceptDownloadResourceThrottle::WillProcessResponse(bool* defer) { |
| 70 ProcessDownloadRequest(defer); | 68 ProcessDownloadRequest(defer); |
| 71 } | 69 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 if (!cookie.empty()) { | 147 if (!cookie.empty()) { |
| 150 info.cookie = cookie; | 148 info.cookie = cookie; |
| 151 } | 149 } |
| 152 } | 150 } |
| 153 StartDownload(info); | 151 StartDownload(info); |
| 154 } | 152 } |
| 155 | 153 |
| 156 void InterceptDownloadResourceThrottle::StartDownload( | 154 void InterceptDownloadResourceThrottle::StartDownload( |
| 157 const DownloadInfo& info) { | 155 const DownloadInfo& info) { |
| 158 DownloadControllerBase::Get()->CreateGETDownload( | 156 DownloadControllerBase::Get()->CreateGETDownload( |
| 159 render_process_id_, render_view_id_, must_download_, info); | 157 wc_getter_, must_download_, info); |
| 160 controller()->Cancel(); | 158 controller()->Cancel(); |
| 161 RecordInterceptFailureReasons(NO_FAILURE); | 159 RecordInterceptFailureReasons(NO_FAILURE); |
| 162 } | 160 } |
| 163 | 161 |
| 164 } // namespace chrome | 162 } // namespace chrome |
| OLD | NEW |