Commit 7c43b096 authored by qinmin's avatar qinmin Committed by Commit bot

Pass browser user agent to android DownloadManager if no override UA is present.

user-agent may not present in URlRequest->extra_request_headers() if the field is not overriden.
In this case, we should pass browser's UA to the android download manager.
We have done something similar in MediaPlayerBridge too.

BUG=488444

Review URL: https://codereview.chromium.org/1145303004

Cr-Commit-Position: refs/heads/master@{#330861}
parent 16e072db
......@@ -24,6 +24,7 @@
#include "content/public/browser/download_url_parameters.h"
#include "content/public/browser/global_request_id.h"
#include "content/public/browser/resource_request_info.h"
#include "content/public/common/content_client.h"
#include "content/public/common/referrer.h"
#include "jni/DownloadController_jni.h"
#include "net/cookies/cookie_options.h"
......@@ -435,6 +436,8 @@ DownloadControllerAndroidImpl::DownloadInfoAndroid::DownloadInfoAndroid(
request->extra_request_headers().GetHeader(
net::HttpRequestHeaders::kUserAgent, &user_agent);
if (user_agent.empty())
user_agent = GetContentClient()->GetUserAgent();
GURL referer_url(request->referrer());
if (referer_url.is_valid())
referer = referer_url.spec();
......
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