Commit 4b5703f9 authored by qinmin@chromium.org's avatar qinmin@chromium.org

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
parent a97fa556
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
namespace chrome { namespace chrome {
static const char kOmaDrmContentMime[] = "application/vnd.oma.drm.content";
static const char kOmaDrmMessageMime[] = "application/vnd.oma.drm.message";
InterceptDownloadResourceThrottle::InterceptDownloadResourceThrottle( InterceptDownloadResourceThrottle::InterceptDownloadResourceThrottle(
net::URLRequest* request, net::URLRequest* request,
int render_process_id, int render_process_id,
...@@ -40,6 +43,13 @@ const char* InterceptDownloadResourceThrottle::GetNameForLogging() const { ...@@ -40,6 +43,13 @@ const char* InterceptDownloadResourceThrottle::GetNameForLogging() const {
} }
void InterceptDownloadResourceThrottle::ProcessDownloadRequest() { 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) if (request_->method() != net::HttpRequestHeaders::kGetMethod)
return; return;
...@@ -62,11 +72,11 @@ void InterceptDownloadResourceThrottle::ProcessDownloadRequest() { ...@@ -62,11 +72,11 @@ void InterceptDownloadResourceThrottle::ProcessDownloadRequest() {
#endif #endif
} }
if (request_->url_chain().empty()) // For OMA DRM downloads, Android Download Manager doesn't handle them
return; // correctly. Use chromium network stack instead. http://crbug.com/382698.
std::string mime;
GURL url = request_->url_chain().back(); const_cast<net::URLRequest*>(request_)->GetMimeType(&mime);
if (!url.SchemeIsHTTPOrHTTPS()) if (!mime.compare(kOmaDrmContentMime) || !mime.compare(kOmaDrmMessageMime))
return; return;
content::DownloadControllerAndroid::Get()->CreateGETDownload( content::DownloadControllerAndroid::Get()->CreateGETDownload(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment