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

Side by Side Diff: chrome/browser/character_encoding.h

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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHARACTER_ENCODING_H_ 5 #ifndef CHROME_BROWSER_CHARACTER_ENCODING_H_
6 #define CHROME_BROWSER_CHARACTER_ENCODING_H_ 6 #define CHROME_BROWSER_CHARACTER_ENCODING_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 26 matching lines...) Expand all
37 // Return canonical encoding name according to the command ID. 37 // Return canonical encoding name according to the command ID.
38 // THIS FUNCTION IS NOT THREADSAFE. You must run this function 38 // THIS FUNCTION IS NOT THREADSAFE. You must run this function
39 // only in UI thread. 39 // only in UI thread.
40 static std::string GetCanonicalEncodingNameByCommandId(int id); 40 static std::string GetCanonicalEncodingNameByCommandId(int id);
41 41
42 // Return display name of canonical encoding according to the command 42 // Return display name of canonical encoding according to the command
43 // ID. THIS FUNCTION IS NOT THREADSAFE. You must run this function 43 // ID. THIS FUNCTION IS NOT THREADSAFE. You must run this function
44 // only in UI thread. 44 // only in UI thread.
45 static base::string16 GetCanonicalEncodingDisplayNameByCommandId(int id); 45 static base::string16 GetCanonicalEncodingDisplayNameByCommandId(int id);
46 46
47 // Return count number of all supported canonical encoding.
48 static int GetSupportCanonicalEncodingCount();
49
50 // Return canonical encoding name according to the index, which starts
51 // from zero to GetSupportCanonicalEncodingCount() - 1. THIS FUNCTION
52 // IS NOT THREADSAFE. You must run this function only in UI thread.
53 static std::string GetCanonicalEncodingNameByIndex(int index);
54
55 // Return display name of canonical encoding according to the index,
56 // which starts from zero to GetSupportCanonicalEncodingCount() - 1.
57 // THIS FUNCTION IS NOT THREADSAFE. You must run this function
58 // only in UI thread.
59 static base::string16 GetCanonicalEncodingDisplayNameByIndex(int index);
60
61 // Return encoding command id according to the index, which starts from
62 // zero to GetSupportCanonicalEncodingCount() - 1. Otherwise returns 0.
63 static int GetEncodingCommandIdByIndex(int index);
64
65 // Return canonical encoding name according to the encoding alias name. THIS 47 // Return canonical encoding name according to the encoding alias name. THIS
66 // FUNCTION IS NOT THREADSAFE. You must run this function only in UI thread. 48 // FUNCTION IS NOT THREADSAFE. You must run this function only in UI thread.
msw 2016/08/23 18:06:27 q: Is this no longer relevant?
Jinsuk Kim 2016/08/23 22:46:13 That was necessary because |CanonicalEncodingMap|
67 static std::string GetCanonicalEncodingNameByAliasName( 49 static std::string GetCanonicalEncodingNameByAliasName(
68 const std::string& alias_name); 50 const std::string& alias_name);
69 51
70 // Returns the pointer of a vector of EncodingInfos corresponding to 52 // Returns the pointer of a vector of EncodingInfos corresponding to
71 // encodings to display in the encoding menu. The locale-dependent static 53 // encodings to display in the encoding menu. The locale-dependent static
72 // encodings come at the top of the list and recently selected encodings 54 // encodings come at the top of the list and recently selected encodings
73 // come next. Finally, the rest of encodings are listed. 55 // come next. Finally, the rest of encodings are listed.
74 // The vector will be created and destroyed by CharacterEncoding. 56 // The vector will be created and destroyed by CharacterEncoding.
75 // The returned std::vector is maintained by this class. The parameter 57 // The returned std::vector is maintained by this class. The parameter
76 // |locale| points to the current application (UI) locale. The parameter 58 // |locale| points to the current application (UI) locale. The parameter
77 // |locale_encodings| is string of static encodings list which is from the 59 // |locale_encodings| is string of static encodings list which is from the
78 // corresponding string resource that is stored in the resource bundle. 60 // corresponding string resource that is stored in the resource bundle.
79 // The parameter |recently_select_encodings| is string of encoding list which 61 // The parameter |recently_select_encodings| is string of encoding list which
80 // is from user recently selected. THIS FUNCTION IS NOT THREADSAFE. You must 62 // is from user recently selected. THIS FUNCTION IS NOT THREADSAFE. You must
81 // run this function only in UI thread. 63 // run this function only in UI thread.
82 static const std::vector<EncodingInfo>* GetCurrentDisplayEncodings( 64 static const std::vector<EncodingInfo>* GetCurrentDisplayEncodings(
83 const std::string& locale, 65 const std::string& locale,
84 const std::string& locale_encodings, 66 const std::string& locale_encodings,
85 const std::string& recently_select_encodings); 67 const std::string& recently_select_encodings);
86 68
87 // This function is for updating |original_selected_encoding_list| with a
88 // |new_selected_encoding_id|. If the encoding is already in the original
89 // list, then returns false. Otherwise |selected_encoding_list| will return a
90 // new string for user selected encoding short list and function returns true.
91 static bool UpdateRecentlySelectedEncoding(
92 const std::string& original_selected_encodings,
93 int new_selected_encoding_id,
94 std::string* selected_encodings);
95
96 // Get encoding command id according to input encoding name. If the name is 69 // Get encoding command id according to input encoding name. If the name is
97 // valid, return corresponding encoding command id. Otherwise return 0; 70 // valid, return corresponding encoding command id. Otherwise return 0;
98 static int GetCommandIdByCanonicalEncodingName( 71 static int GetCommandIdByCanonicalEncodingName(
99 const std::string& encoding_name); 72 const std::string& encoding_name);
100 73
101 private: 74 private:
102 // Disallow instantiating it since this class only contains static methods. 75 // Disallow instantiating it since this class only contains static methods.
103 DISALLOW_IMPLICIT_CONSTRUCTORS(CharacterEncoding); 76 DISALLOW_IMPLICIT_CONSTRUCTORS(CharacterEncoding);
104 }; 77 };
105 78
106 #endif // CHROME_BROWSER_CHARACTER_ENCODING_H_ 79 #endif // CHROME_BROWSER_CHARACTER_ENCODING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698