Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_UI_WEBUI_CHROMEOS_LOGIN_L10N_UTIL_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_L10N_UTIL_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_L10N_UTIL_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_L10N_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/strings/string16.h" | |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 15 class DictionaryValue; | 16 class DictionaryValue; |
| 16 class ListValue; | 17 class ListValue; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace chromeos { | 20 namespace chromeos { |
| 20 | 21 |
| 21 // GetUILanguageList() returns a concatenated list of the most relevant | 22 // GetUILanguageList() returns a concatenated list of the most relevant |
| 22 // languages followed by all others. An entry with its "code" attribute set to | 23 // languages followed by all others. An entry with its "code" attribute set to |
| 23 // this value is inserted in between. | 24 // this value is inserted in between. |
| 24 extern const char kMostRelevantLanguagesDivider[]; | 25 extern const char kMostRelevantLanguagesDivider[]; |
| 25 | 26 |
| 26 // Utility methods for retrieving lists of supported locales and input methods / | 27 // Utility methods for retrieving lists of supported locales and input methods / |
| 27 // keyboard layouts during OOBE and on the login screen. | 28 // keyboard layouts during OOBE and on the login screen. |
| 28 | 29 |
| 30 // Returns a single language entry (a helper function for GetUILanguageList). | |
| 31 base::DictionaryValue* CreateLanguageEntry( | |
| 32 const std::string& language_code, | |
| 33 const base::string16& language_display_name, | |
| 34 const std::string& language_directionality, | |
|
dzhioev (left Google)
2014/10/01 15:08:08
You can calculate directionality inside of this fu
Alexander Alekseev
2014/10/02 13:12:07
Done.
| |
| 35 const base::string16& language_native_display_name); | |
| 36 | |
| 37 // Helper function for GetUILanguageList. | |
| 38 // Requires |language_display_name| after | |
| 39 // base::i18n::UnadjustStringForLocaleDirection. | |
| 40 const std::string GetLanguageDirectionality( | |
| 41 const base::string16& language_display_name); | |
| 42 | |
| 29 // Return a list of languages in which the UI can be shown. Each list entry is a | 43 // Return a list of languages in which the UI can be shown. Each list entry is a |
| 30 // dictionary that contains data such as the language's locale code and a | 44 // dictionary that contains data such as the language's locale code and a |
| 31 // display name. The list will consist of the |most_relevant_language_codes|, | 45 // display name. The list will consist of the |most_relevant_language_codes|, |
| 32 // followed by a divider and all other supported languages after that. If | 46 // followed by a divider and all other supported languages after that. If |
| 33 // |most_relevant_language_codes| is NULL, the most relevant languages are read | 47 // |most_relevant_language_codes| is NULL, the most relevant languages are read |
| 34 // from initial_locale in VPD. If |selected| matches the locale code of any | 48 // from initial_locale in VPD. If |selected| matches the locale code of any |
| 35 // entry in the resulting list, that entry will be marked as selected. | 49 // entry in the resulting list, that entry will be marked as selected. |
| 36 scoped_ptr<base::ListValue> GetUILanguageList( | 50 scoped_ptr<base::ListValue> GetUILanguageList( |
| 37 const std::vector<std::string>* most_relevant_language_codes, | 51 const std::vector<std::string>* most_relevant_language_codes, |
| 38 const std::string& selected); | 52 const std::string& selected); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 const GetKeyboardLayoutsForLocaleCallback& callback, | 91 const GetKeyboardLayoutsForLocaleCallback& callback, |
| 78 const std::string& locale); | 92 const std::string& locale); |
| 79 | 93 |
| 80 // Returns the current keyboard layout, expressed as a dictionary that contains | 94 // Returns the current keyboard layout, expressed as a dictionary that contains |
| 81 // data such as an ID and a display name. | 95 // data such as an ID and a display name. |
| 82 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout(); | 96 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout(); |
| 83 | 97 |
| 84 } // namespace chromeos | 98 } // namespace chromeos |
| 85 | 99 |
| 86 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_L10N_UTIL_H_ | 100 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_L10N_UTIL_H_ |
| OLD | NEW |