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

Side by Side Diff: chrome/browser/chromeos/login/language_list.h

Issue 105193002: Replace string16 with base::string16. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/login/helper.cc ('k') | chrome/browser/chromeos/login/language_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_CHROMEOS_LOGIN_LANGUAGE_LIST_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LANGUAGE_LIST_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LANGUAGE_LIST_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LANGUAGE_LIST_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 14
15 namespace chromeos { 15 namespace chromeos {
16 16
17 // LanguageList is used to enumerate native names corresponding to the 17 // LanguageList is used to enumerate native names corresponding to the
18 // language code (e.g. English (United States) for en-US). 18 // language code (e.g. English (United States) for en-US).
19 class LanguageList { 19 class LanguageList {
20 public: 20 public:
21 LanguageList(); 21 LanguageList();
22 ~LanguageList(); 22 ~LanguageList();
23 23
24 // Returns the number of locale names. 24 // Returns the number of locale names.
25 int languages_count() const { return static_cast<int>(locale_names_.size()); } 25 int languages_count() const { return static_cast<int>(locale_names_.size()); }
26 26
27 // Returns the language for the given |index|. 27 // Returns the language for the given |index|.
28 string16 GetLanguageNameAt(int index) const; 28 base::string16 GetLanguageNameAt(int index) const;
29 29
30 // Return the locale for the given |index|. E.g., may return pt-BR. 30 // Return the locale for the given |index|. E.g., may return pt-BR.
31 std::string GetLocaleFromIndex(int index) const; 31 std::string GetLocaleFromIndex(int index) const;
32 32
33 // Returns the index for the given |locale|. Returns -1 if it's not found. 33 // Returns the index for the given |locale|. Returns -1 if it's not found.
34 int GetIndexFromLocale(const std::string& locale) const; 34 int GetIndexFromLocale(const std::string& locale) const;
35 35
36 // Duplicates specified languages at the beginning of the list for easier 36 // Duplicates specified languages at the beginning of the list for easier
37 // access. 37 // access.
38 void CopySpecifiedLanguagesUp(const std::string& locale_codes); 38 void CopySpecifiedLanguagesUp(const std::string& locale_codes);
39 39
40 private: 40 private:
41 struct LocaleData { 41 struct LocaleData {
42 LocaleData() {} 42 LocaleData() {}
43 LocaleData(const string16& name, const std::string& code) 43 LocaleData(const base::string16& name, const std::string& code)
44 : native_name(name), locale_code(code) {} 44 : native_name(name), locale_code(code) {}
45 45
46 string16 native_name; 46 base::string16 native_name;
47 std::string locale_code; // E.g., en-us. 47 std::string locale_code; // E.g., en-us.
48 }; 48 };
49 49
50 typedef std::map<string16, LocaleData> LocaleDataMap; 50 typedef std::map<string16, LocaleData> LocaleDataMap;
51 51
52 void InitNativeNames(const std::vector<std::string>& locale_codes); 52 void InitNativeNames(const std::vector<std::string>& locale_codes);
53 53
54 // The names of all the locales in the current application locale. 54 // The names of all the locales in the current application locale.
55 std::vector<string16> locale_names_; 55 std::vector<string16> locale_names_;
56 56
57 // A map of some extra data (LocaleData) keyed off the name of the locale. 57 // A map of some extra data (LocaleData) keyed off the name of the locale.
58 LocaleDataMap native_names_; 58 LocaleDataMap native_names_;
59 59
60 DISALLOW_COPY_AND_ASSIGN(LanguageList); 60 DISALLOW_COPY_AND_ASSIGN(LanguageList);
61 }; 61 };
62 62
63 } // namespace chromeos 63 } // namespace chromeos
64 64
65 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LANGUAGE_LIST_H_ 65 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LANGUAGE_LIST_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/helper.cc ('k') | chrome/browser/chromeos/login/language_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698