OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_LANGUAGE_COMBOBOX_MODEL_H_ | 5 #ifndef CHROME_BROWSER_LANGUAGE_COMBOBOX_MODEL_H_ |
6 #define CHROME_BROWSER_LANGUAGE_COMBOBOX_MODEL_H_ | 6 #define CHROME_BROWSER_LANGUAGE_COMBOBOX_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "app/combobox_model.h" | 13 #include "app/combobox_model.h" |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/string16.h" |
15 | 16 |
16 class Profile; | 17 class Profile; |
17 | 18 |
18 /////////////////////////////////////////////////////////////////////////////// | 19 /////////////////////////////////////////////////////////////////////////////// |
19 // LanguageList | 20 // LanguageList |
20 // Provides code to enumerate locale names for language selection lists. | 21 // Provides code to enumerate locale names for language selection lists. |
21 // To be used by combobox, menu or other models. | 22 // To be used by combobox, menu or other models. |
22 class LanguageList { | 23 class LanguageList { |
23 public: | 24 public: |
24 struct LocaleData { | 25 struct LocaleData { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 class LanguageComboboxModel : public LanguageList, public ComboboxModel { | 71 class LanguageComboboxModel : public LanguageList, public ComboboxModel { |
71 public: | 72 public: |
72 LanguageComboboxModel(); | 73 LanguageComboboxModel(); |
73 | 74 |
74 // Temporary compatibility constructor. | 75 // Temporary compatibility constructor. |
75 LanguageComboboxModel(Profile* profile, | 76 LanguageComboboxModel(Profile* profile, |
76 const std::vector<std::string>& locale_codes); | 77 const std::vector<std::string>& locale_codes); |
77 | 78 |
78 virtual ~LanguageComboboxModel() {} | 79 virtual ~LanguageComboboxModel() {} |
79 | 80 |
80 virtual int GetItemCount() { return get_languages_count(); } | 81 virtual int GetItemCount(); |
81 | 82 virtual string16 GetItemAt(int index); |
82 virtual std::wstring GetItemAt(int index) { return GetLanguageNameAt(index); } | |
83 | 83 |
84 // Returns the index of the language currently specified in the user's | 84 // Returns the index of the language currently specified in the user's |
85 // preference file. Note that it's possible for language A to be picked | 85 // preference file. Note that it's possible for language A to be picked |
86 // while chrome is currently in language B if the user specified language B | 86 // while chrome is currently in language B if the user specified language B |
87 // via --lang. Since --lang is not a persistent setting, it seems that it | 87 // via --lang. Since --lang is not a persistent setting, it seems that it |
88 // shouldn't be reflected in this combo box. We return -1 if the value in | 88 // shouldn't be reflected in this combo box. We return -1 if the value in |
89 // the pref doesn't map to a know language (possible if the user edited the | 89 // the pref doesn't map to a know language (possible if the user edited the |
90 // prefs file manually). | 90 // prefs file manually). |
91 int GetSelectedLanguageIndex(const std::string& prefs); | 91 int GetSelectedLanguageIndex(const std::string& prefs); |
92 | 92 |
93 private: | 93 private: |
94 // Profile. | 94 // Profile. |
95 Profile* profile_; | 95 Profile* profile_; |
96 | 96 |
97 DISALLOW_COPY_AND_ASSIGN(LanguageComboboxModel); | 97 DISALLOW_COPY_AND_ASSIGN(LanguageComboboxModel); |
98 }; | 98 }; |
99 | 99 |
100 #endif // CHROME_BROWSER_LANGUAGE_COMBOBOX_MODEL_H_ | 100 #endif // CHROME_BROWSER_LANGUAGE_COMBOBOX_MODEL_H_ |
OLD | NEW |