diff options
author | qinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-10 03:46:34 +0000 |
---|---|---|
committer | qinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-10 03:46:34 +0000 |
commit | 4b5703f9a0fa8b23f5b0d404d7824d1a23ca4dbc (patch) | |
tree | 85013332ad90e862666a7fa9fe00d019a88900e2 /chrome/browser/android/intercept_download_resource_throttle.cc | |
parent | a97fa5566e9853f5e46f63d00ea85fa5059ac390 (diff) | |
download | chromium_src-4b5703f9a0fa8b23f5b0d404d7824d1a23ca4dbc.zip chromium_src-4b5703f9a0fa8b23f5b0d404d7824d1a23ca4dbc.tar.gz chromium_src-4b5703f9a0fa8b23f5b0d404d7824d1a23ca4dbc.tar.bz2 |
Fix an issue that android Download Manager doesn't handle OMA files correctly
For OMA files, it looks like that android download manager cannot correctly download it.
Some of the files cannot be downloaded, and some of the files downloaded has different binary content as the ones downloaed on chrome desktop.
Bypass android download manager for OMA mime types.
BUG=382698
Review URL: https://codereview.chromium.org/331143010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282243 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/android/intercept_download_resource_throttle.cc')
-rw-r--r-- | chrome/browser/android/intercept_download_resource_throttle.cc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/chrome/browser/android/intercept_download_resource_throttle.cc b/chrome/browser/android/intercept_download_resource_throttle.cc index ba1f34d..d956744 100644 --- a/chrome/browser/android/intercept_download_resource_throttle.cc +++ b/chrome/browser/android/intercept_download_resource_throttle.cc @@ -13,6 +13,9 @@ namespace chrome { +static const char kOmaDrmContentMime[] = "application/vnd.oma.drm.content"; +static const char kOmaDrmMessageMime[] = "application/vnd.oma.drm.message"; + InterceptDownloadResourceThrottle::InterceptDownloadResourceThrottle( net::URLRequest* request, int render_process_id, @@ -40,6 +43,13 @@ const char* InterceptDownloadResourceThrottle::GetNameForLogging() const { } void InterceptDownloadResourceThrottle::ProcessDownloadRequest() { + if (request_->url_chain().empty()) + return; + + GURL url = request_->url_chain().back(); + if (!url.SchemeIsHTTPOrHTTPS()) + return; + if (request_->method() != net::HttpRequestHeaders::kGetMethod) return; @@ -62,11 +72,11 @@ void InterceptDownloadResourceThrottle::ProcessDownloadRequest() { #endif } - if (request_->url_chain().empty()) - return; - - GURL url = request_->url_chain().back(); - if (!url.SchemeIsHTTPOrHTTPS()) + // 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); + if (!mime.compare(kOmaDrmContentMime) || !mime.compare(kOmaDrmMessageMime)) return; content::DownloadControllerAndroid::Get()->CreateGETDownload( |