Chromium Code Reviews| Index: net/filter/filter.cc |
| diff --git a/net/filter/filter.cc b/net/filter/filter.cc |
| index 244abaea10eead6e52ac95e5b52af3862c6f64ff..8e497db24057093324568ef4c3df5f63220e928a 100644 |
| --- a/net/filter/filter.cc |
| +++ b/net/filter/filter.cc |
| @@ -8,6 +8,7 @@ |
| #include "base/strings/string_util.h" |
| #include "net/base/io_buffer.h" |
| #include "net/base/mime_util.h" |
| +#include "net/base/net_util.h" |
| #include "net/filter/gzip_filter.h" |
| #include "net/filter/sdch_filter.h" |
| @@ -170,11 +171,15 @@ void Filter::FixupEncodingTypes( |
| encoding_types->clear(); |
| GURL url; |
| + std::string disposition; |
| success = filter_context.GetURL(&url); |
| DCHECK(success); |
| - base::FilePath filename = |
| - base::FilePath().AppendASCII(url.ExtractFileName()); |
| - base::FilePath::StringType extension = filename.Extension(); |
| + filter_context.GetContentDisposition(&disposition); |
| + // Don't supply a MIME type here, since that may cause disk IO. |
| + base::string16 filename = |
| + net::GetSuggestedFilename(url, disposition, "UTF-8", "", "", ""); |
|
asanka
2014/03/21 18:23:14
Nit: already in net namespace.
Also use GenerateF
|
| + base::FilePath filepath = base::FilePath::FromUTF16Unsafe(filename); |
| + base::FilePath::StringType extension = filepath.Extension(); |
| if (filter_context.IsDownload()) { |
| // We don't want to decompress gzipped files when the user explicitly |