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

Unified Diff: chrome/browser/android/intercept_download_resource_throttle.cc

Issue 394993002: Bypass android download manager if response is not yet received (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/intercept_download_resource_throttle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/intercept_download_resource_throttle.cc
diff --git a/chrome/browser/android/intercept_download_resource_throttle.cc b/chrome/browser/android/intercept_download_resource_throttle.cc
index d95674418f381ac815c41fb6184ab1543aa83641..1101b1e9ebe211f02312e6dee8bb98c658552f65 100644
--- a/chrome/browser/android/intercept_download_resource_throttle.cc
+++ b/chrome/browser/android/intercept_download_resource_throttle.cc
@@ -30,10 +30,6 @@ InterceptDownloadResourceThrottle::InterceptDownloadResourceThrottle(
InterceptDownloadResourceThrottle::~InterceptDownloadResourceThrottle() {
}
-void InterceptDownloadResourceThrottle::WillStartRequest(bool* defer) {
- ProcessDownloadRequest();
-}
-
void InterceptDownloadResourceThrottle::WillProcessResponse(bool* defer) {
ProcessDownloadRequest();
}
@@ -53,14 +49,16 @@ void InterceptDownloadResourceThrottle::ProcessDownloadRequest() {
if (request_->method() != net::HttpRequestHeaders::kGetMethod)
return;
+ net::HttpRequestHeaders headers;
+ if (!request_->GetFullRequestHeaders(&headers))
+ return;
+
// In general, if the request uses HTTP authorization, either with the origin
// or a proxy, then the network stack should handle the download. The one
// exception is a request that is fetched via the Chrome Proxy and does not
// authenticate with the origin.
if (request_->response_info().did_use_http_auth) {
#if defined(SPDY_PROXY_AUTH_ORIGIN)
- net::HttpRequestHeaders headers;
- request_->GetFullRequestHeaders(&headers);
if (headers.HasHeader(net::HttpRequestHeaders::kAuthorization) ||
!(request_->response_info().headers &&
data_reduction_proxy::HasDataReductionProxyViaHeader(
@@ -75,7 +73,7 @@ void InterceptDownloadResourceThrottle::ProcessDownloadRequest() {
// For OMA DRM downloads, Android Download Manager doesn't handle them
// correctly. Use chromium network stack instead. http://crbug.com/382698.
std::string mime;
- const_cast<net::URLRequest*>(request_)->GetMimeType(&mime);
+ request_->GetMimeType(&mime);
if (!mime.compare(kOmaDrmContentMime) || !mime.compare(kOmaDrmMessageMime))
return;
« no previous file with comments | « chrome/browser/android/intercept_download_resource_throttle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698