Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: chrome/browser/android/intercept_download_resource_throttle.cc

Issue 1854523002: If a download is initiated by download attribute, don't use stream viewer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 // static 46 // static
47 bool InterceptDownloadResourceThrottle::IsDownloadInterceptionEnabled() { 47 bool InterceptDownloadResourceThrottle::IsDownloadInterceptionEnabled() {
48 return base::FeatureList::IsEnabled(chrome::android::kSystemDownloadManager); 48 return base::FeatureList::IsEnabled(chrome::android::kSystemDownloadManager);
49 } 49 }
50 50
51 InterceptDownloadResourceThrottle::InterceptDownloadResourceThrottle( 51 InterceptDownloadResourceThrottle::InterceptDownloadResourceThrottle(
52 net::URLRequest* request, 52 net::URLRequest* request,
53 int render_process_id, 53 int render_process_id,
54 int render_view_id, 54 int render_view_id,
55 int request_id) 55 int request_id,
56 bool must_download)
56 : request_(request), 57 : request_(request),
57 render_process_id_(render_process_id), 58 render_process_id_(render_process_id),
58 render_view_id_(render_view_id), 59 render_view_id_(render_view_id),
59 request_id_(request_id) { 60 request_id_(request_id),
61 must_download_(must_download) {
60 } 62 }
61 63
62 InterceptDownloadResourceThrottle::~InterceptDownloadResourceThrottle() { 64 InterceptDownloadResourceThrottle::~InterceptDownloadResourceThrottle() {
63 } 65 }
64 66
65 void InterceptDownloadResourceThrottle::WillProcessResponse(bool* defer) { 67 void InterceptDownloadResourceThrottle::WillProcessResponse(bool* defer) {
66 ProcessDownloadRequest(); 68 ProcessDownloadRequest();
67 } 69 }
68 70
69 const char* InterceptDownloadResourceThrottle::GetNameForLogging() const { 71 const char* InterceptDownloadResourceThrottle::GetNameForLogging() const {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 114
113 // If the cookie is possibly channel-bound, don't pass it to android download 115 // If the cookie is possibly channel-bound, don't pass it to android download
114 // manager. 116 // manager.
115 // TODO(qinmin): add a test for this. http://crbug.com/430541. 117 // TODO(qinmin): add a test for this. http://crbug.com/430541.
116 if (request_->ssl_info().channel_id_sent) { 118 if (request_->ssl_info().channel_id_sent) {
117 RecordInterceptFailureReasons(USE_CHANNEL_BOUND_COOKIES); 119 RecordInterceptFailureReasons(USE_CHANNEL_BOUND_COOKIES);
118 return; 120 return;
119 } 121 }
120 122
121 content::DownloadControllerAndroid::Get()->CreateGETDownload( 123 content::DownloadControllerAndroid::Get()->CreateGETDownload(
122 render_process_id_, render_view_id_, request_id_); 124 render_process_id_, render_view_id_, request_id_, must_download_);
123 controller()->Cancel(); 125 controller()->Cancel();
124 RecordInterceptFailureReasons(NO_FAILURE); 126 RecordInterceptFailureReasons(NO_FAILURE);
125 } 127 }
126 128
127 } // namespace chrome 129 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698