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

Unified Diff: chrome/browser/encoding_menu_controller_delegate.cc

Issue 21414: We will sort the encoding menu items according to current used UI language ex... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 | « chrome/browser/character_encoding.cc ('k') | chrome/browser/spellchecker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/encoding_menu_controller_delegate.cc
===================================================================
--- chrome/browser/encoding_menu_controller_delegate.cc (revision 10076)
+++ chrome/browser/encoding_menu_controller_delegate.cc (working copy)
@@ -108,30 +108,30 @@
encoding_menu->AppendSeparator();
// Create current display encoding list.
std::wstring cur_locale = g_browser_process->GetApplicationLocale();
- const std::vector<int>* encoding_ids;
+ const std::vector<CharacterEncoding::EncodingInfo>* encodings;
// Build the list of encoding ids : It is made of the
// locale-dependent short list, the cache of recently selected
// encodings and other encodings.
- encoding_ids = CharacterEncoding::GetCurrentDisplayEncodings(
+ encodings = CharacterEncoding::GetCurrentDisplayEncodings(
+ cur_locale,
profile->GetPrefs()->GetString(prefs::kStaticEncodings),
profile->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding));
- DCHECK(encoding_ids);
- DCHECK(!encoding_ids->empty());
- unsigned len = static_cast<unsigned>(encoding_ids->size());
+ DCHECK(encodings);
+ DCHECK(!encodings->empty());
+ unsigned len = static_cast<unsigned>(encodings->size());
// Add encoding menus.
- std::vector<int>::const_iterator it;
- for (it = encoding_ids->begin(); it != encoding_ids->end(); ++it) {
- if (*it) {
- std::wstring encoding =
- CharacterEncoding::GetCanonicalEncodingDisplayNameByCommandId(*it);
+ std::vector<CharacterEncoding::EncodingInfo>::const_iterator it;
+ for (it = encodings->begin(); it != encodings->end(); ++it) {
+ if (it->encoding_id) {
+ std::wstring encoding = it->encoding_display_name;
std::wstring bidi_safe_encoding;
if (l10n_util::AdjustStringForLocaleDirection(encoding,
&bidi_safe_encoding))
encoding.swap(bidi_safe_encoding);
- encoding_menu->AppendMenuItem(*it, encoding, Menu::RADIO);
+ encoding_menu->AppendMenuItem(it->encoding_id, encoding, Menu::RADIO);
+ } else {
+ encoding_menu->AppendSeparator();
}
- else
- encoding_menu->AppendSeparator();
}
}
« no previous file with comments | « chrome/browser/character_encoding.cc ('k') | chrome/browser/spellchecker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698