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

Unified Diff: chrome/browser/character_encoding.cc

Issue 2254273003: Remove text encoding UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
Index: chrome/browser/character_encoding.cc
diff --git a/chrome/browser/character_encoding.cc b/chrome/browser/character_encoding.cc
index b7c9f6fdd38818eb27dc2d3dadb4d8af12d18bc5..873547ad4c5401c105e3a95848a3de1ae855ae68 100644
--- a/chrome/browser/character_encoding.cc
+++ b/chrome/browser/character_encoding.cc
@@ -341,35 +341,6 @@ base::string16 CharacterEncoding::GetCanonicalEncodingDisplayNameByCommandId(
}
// Static.
-// Return count number of all supported canonical encoding.
-int CharacterEncoding::GetSupportCanonicalEncodingCount() {
- return kCanonicalEncodingNamesLength;
-}
-
-// Static.
-std::string CharacterEncoding::GetCanonicalEncodingNameByIndex(int index) {
- if (index < kCanonicalEncodingNamesLength)
- return kCanonicalEncodingNames[index].name;
- return std::string();
-}
-
-// Static.
-base::string16 CharacterEncoding::GetCanonicalEncodingDisplayNameByIndex(
- int index) {
- if (index < kCanonicalEncodingNamesLength)
- return GetEncodingDisplayName(kCanonicalEncodingNames[index].name,
- kCanonicalEncodingNames[index].category_string_id);
- return base::string16();
-}
-
-// Static.
-int CharacterEncoding::GetEncodingCommandIdByIndex(int index) {
- if (index < kCanonicalEncodingNamesLength)
- return kCanonicalEncodingNames[index].resource_id;
- return 0;
-}
-
-// Static.
std::string CharacterEncoding::GetCanonicalEncodingNameByAliasName(
const std::string& alias_name) {
// If the input alias_name is already canonical encoding name, just return it.
@@ -484,48 +455,3 @@ const std::vector<CharacterEncoding::EncodingInfo>*
DCHECK(!encoding_list->empty());
return encoding_list;
}
-
-// Static
-bool CharacterEncoding::UpdateRecentlySelectedEncoding(
- const std::string& original_selected_encodings,
- int new_selected_encoding_id,
- std::string* selected_encodings) {
- // Get encoding name.
- std::string encoding_name =
- GetCanonicalEncodingNameByCommandId(new_selected_encoding_id);
- DCHECK(!encoding_name.empty());
- // Check whether the new encoding is in local dependent encodings or original
- // recently selected encodings. If yes, do not add it.
- std::vector<int>* locale_dependent_encoding_list =
- CanonicalEncodingMapSingleton()->locale_dependent_encoding_ids();
- DCHECK(locale_dependent_encoding_list);
- std::vector<int> selected_encoding_list;
- ParseEncodingListSeparatedWithComma(original_selected_encodings,
- &selected_encoding_list,
- kUserSelectedEncodingsMaxLength);
- // Put 'cached encodings' (dynamic encoding list) after 'local dependent
- // encoding list' for check.
- std::vector<int> top_encoding_list(*locale_dependent_encoding_list);
- // UTF8 is always in our optimized encoding list.
- top_encoding_list.insert(top_encoding_list.begin(), IDC_ENCODING_UTF8);
- top_encoding_list.insert(top_encoding_list.end(),
- selected_encoding_list.begin(),
- selected_encoding_list.end());
- for (std::vector<int>::const_iterator it = top_encoding_list.begin();
- it != top_encoding_list.end(); ++it)
- if (*it == new_selected_encoding_id)
- return false;
- // Need to add the encoding id to recently selected encoding list.
- // Remove the last encoding in original list.
- if (selected_encoding_list.size() == kUserSelectedEncodingsMaxLength)
- selected_encoding_list.pop_back();
- // Insert new encoding to head of selected encoding list.
- *selected_encodings = encoding_name;
- // Generate the string for rest selected encoding list.
- for (std::vector<int>::const_iterator it = selected_encoding_list.begin();
- it != selected_encoding_list.end(); ++it) {
- selected_encodings->append(1, L',');
- selected_encodings->append(GetCanonicalEncodingNameByCommandId(*it));
- }
- return true;
-}

Powered by Google App Engine
This is Rietveld 408576698