Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Unified Diff: net/base/net_util.cc

Issue 9317018: referrer_charset is a lie. It's really the user's default_charset. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/net_util.h ('k') | net/base/net_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util.cc
===================================================================
--- net/base/net_util.cc (revision 119865)
+++ net/base/net_util.cc (working copy)
@@ -239,7 +239,7 @@
}
bool DecodeWord(const std::string& encoded_word,
- const std::string& referrer_charset,
+ const std::string& default_charset,
bool* is_rfc2047,
std::string* output) {
*is_rfc2047 = false;
@@ -248,13 +248,13 @@
return true;
if (!IsStringASCII(encoded_word)) {
- // Try UTF-8, referrer_charset and the native OS default charset in turn.
+ // Try UTF-8, default_charset and the native OS default charset in turn.
if (IsStringUTF8(encoded_word)) {
*output = encoded_word;
} else {
string16 utf16_output;
- if (!referrer_charset.empty() &&
- base::CodepageToUTF16(encoded_word, referrer_charset.c_str(),
+ if (!default_charset.empty() &&
+ base::CodepageToUTF16(encoded_word, default_charset.c_str(),
base::OnStringConversionError::FAIL,
&utf16_output)) {
*output = UTF16ToUTF8(utf16_output);
@@ -926,7 +926,7 @@
// |should_overwrite_extension| will be set to true, in which case a better
// extension should be determined based on the content type.
std::string GetFileNameFromURL(const GURL& url,
- const std::string& referrer_charset,
+ const std::string& default_charset,
bool* should_overwrite_extension) {
// about: and data: URLs don't have file names, but esp. data: URLs may
// contain parts that look like ones (i.e., contain a slash). Therefore we
@@ -944,7 +944,7 @@
bool ignore;
// TODO(jshin): this is probably not robust enough. To be sure, we need
// encoding detection.
- DecodeWord(unescaped_url_filename, referrer_charset, &ignore,
+ DecodeWord(unescaped_url_filename, default_charset, &ignore,
&decoded_filename);
}
// If the URL contains a (possibly empty) query, assume it is a generator, and
@@ -1187,7 +1187,7 @@
}
bool DecodeFilenameValue(const std::string& input,
- const std::string& referrer_charset,
+ const std::string& default_charset,
std::string* output) {
std::string tmp;
// Tokenize with whitespace characters.
@@ -1209,7 +1209,7 @@
// in a single encoded-word. Firefox/Thunderbird do not support
// it, either.
std::string decoded;
- if (!DecodeWord(t.token(), referrer_charset, &is_previous_token_rfc2047,
+ if (!DecodeWord(t.token(), default_charset, &is_previous_token_rfc2047,
&decoded))
return false;
tmp.append(decoded);
@@ -1401,7 +1401,7 @@
string16 GetSuggestedFilename(const GURL& url,
const std::string& content_disposition,
- const std::string& referrer_charset,
+ const std::string& default_charset,
const std::string& suggested_name,
const std::string& mime_type,
const std::string& default_name) {
@@ -1416,7 +1416,7 @@
// Try to extract a filename from content-disposition first.
if (!content_disposition.empty()) {
- HttpContentDisposition header(content_disposition, referrer_charset);
+ HttpContentDisposition header(content_disposition, default_charset);
filename = header.filename();
}
@@ -1428,7 +1428,7 @@
// looks at the last component of the URL and doesn't return the hostname as a
// failover.
if (filename.empty())
- filename = GetFileNameFromURL(url, referrer_charset, &overwrite_extension);
+ filename = GetFileNameFromURL(url, default_charset, &overwrite_extension);
// Finally try the URL hostname, but only if there's no default specified in
// |default_name|. Some schemes (e.g.: file:, about:, data:) do not have a
@@ -1480,13 +1480,13 @@
FilePath GenerateFileName(const GURL& url,
const std::string& content_disposition,
- const std::string& referrer_charset,
+ const std::string& default_charset,
const std::string& suggested_name,
const std::string& mime_type,
const std::string& default_file_name) {
string16 file_name = GetSuggestedFilename(url,
content_disposition,
- referrer_charset,
+ default_charset,
suggested_name,
mime_type,
default_file_name);
« no previous file with comments | « net/base/net_util.h ('k') | net/base/net_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698