Chromium Code Reviews| Index: content/browser/android/download_controller_android_impl.cc |
| diff --git a/content/browser/android/download_controller_android_impl.cc b/content/browser/android/download_controller_android_impl.cc |
| index f3a274a3ef4a7e043597cf53ab9cc59d81bdc4cb..16864ab4ab38455e3daed4a30eebed30cf02aac5 100644 |
| --- a/content/browser/android/download_controller_android_impl.cc |
| +++ b/content/browser/android/download_controller_android_impl.cc |
| @@ -27,6 +27,7 @@ |
| #include "jni/DownloadController_jni.h" |
| #include "net/cookies/cookie_options.h" |
| #include "net/cookies/cookie_store.h" |
| +#include "net/http/http_content_disposition.h" |
| #include "net/http/http_request_headers.h" |
| #include "net/http/http_response_headers.h" |
| #include "net/url_request/url_request.h" |
| @@ -221,10 +222,16 @@ void DownloadControllerAndroidImpl::StartAndroidDownload( |
| ScopedJavaLocalRef<jstring> jreferer = |
| ConvertUTF8ToJavaString(env, info.referer); |
| + // Try parsing the content disposition header to get a |
| + // explicitly specified filename if available. |
| + net::HttpContentDisposition header(info.content_disposition, ""); |
|
boliu
2014/02/07 18:11:47
Hmm...
If we use the full blown GetSuggestedFilen
shashi
2014/02/07 18:59:12
I agree with Bo, that should be the best way and e
Jinsuk Kim
2014/02/08 02:49:28
I'd like to upstream the filename decision logic e
Jinsuk Kim
2014/02/08 02:49:28
I was not aware of GetSuggestedFilename and it is
boliu
2014/02/08 02:51:23
sgtm, yaron already gave lgtm, which is all you ne
|
| + ScopedJavaLocalRef<jstring> jfilename = |
| + ConvertUTF8ToJavaString(env, header.filename()); |
| + |
| Java_DownloadController_newHttpGetDownload( |
| env, GetJavaObject()->Controller(env).obj(), view.obj(), jurl.obj(), |
| juser_agent.obj(), jcontent_disposition.obj(), jmime_type.obj(), |
| - jcookie.obj(), jreferer.obj(), info.total_bytes); |
| + jcookie.obj(), jreferer.obj(), jfilename.obj(), info.total_bytes); |
| } |
| void DownloadControllerAndroidImpl::OnDownloadStarted( |