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

Unified Diff: chrome/browser/character_encoding.h

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 | « no previous file | chrome/browser/character_encoding.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/character_encoding.h
===================================================================
--- chrome/browser/character_encoding.h (revision 10076)
+++ chrome/browser/character_encoding.h (working copy)
@@ -17,6 +17,23 @@
// currently support. This is defined outside of Browser
// to avoid cyclical dependencies.
+ // Structure to save encoding information.
+ struct EncodingInfo {
+ explicit EncodingInfo(int id);
+ // Gets string key of EncodingInfo. With this method, we can use
+ // l10n_util::SortVectorWithStringKey to sort the encoding menu items
+ // by current locale character sequence. We need to keep the order within
+ // encoding category name, that's why we use category name as key.
+ const std::wstring& GetStringKey() const { return encoding_category_name; }
+
+ // Encoding command id.
+ int encoding_id;
+ // Encoding display name.
+ std::wstring encoding_display_name;
+ // Encoding category name.
+ std::wstring encoding_category_name;
+ };
+
// Return canonical encoding name according to the command ID.
// THIS FUNCTION IS NOT THREADSAFE. You must run this function
// only in UI thread.
@@ -46,18 +63,20 @@
static std::wstring GetCanonicalEncodingNameByAliasName(
const std::wstring& alias_name);
- // Returns the pointer of a vector of command ids corresponding to
- // encodings to display in the encoding menu. The list begins with
- // the locale-dependent static encodings and recently selected
- // encodings is followed by the rest of encodings belonging to neither.
+ // Returns the pointer of a vector of EncodingInfos corresponding to
+ // encodings to display in the encoding menu. The locale-dependent static
+ // encodings come at the top of the list and recently selected encodings
+ // come next. Finally, the rest of encodings are listed.
// The vector will be created and destroyed by CharacterEncoding.
// The returned std::vector is maintained by this class. The parameter
+ // |locale| points to the current application (UI) locale. The parameter
// |locale_encodings| is string of static encodings list which is from the
// corresponding string resource that is stored in the resource bundle.
// The parameter |recently_select_encodings| is string of encoding list which
// is from user recently selected. THIS FUNCTION IS NOT THREADSAFE. You must
// run this function only in UI thread.
- static const std::vector<int>* GetCurrentDisplayEncodings(
+ static const std::vector<EncodingInfo>* GetCurrentDisplayEncodings(
+ const std::wstring& locale,
const std::wstring& locale_encodings,
const std::wstring& recently_select_encodings);
« no previous file with comments | « no previous file | chrome/browser/character_encoding.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698