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 |
(...skipping 19 matching lines...) Expand all Loading... |
30 // dictionary that contains data such as the language's locale code and a | 30 // 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|, | 31 // 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 | 32 // 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 | 33 // |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 | 34 // 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. | 35 // entry in the resulting list, that entry will be marked as selected. |
36 scoped_ptr<base::ListValue> GetUILanguageList( | 36 scoped_ptr<base::ListValue> GetUILanguageList( |
37 const std::vector<std::string>* most_relevant_language_codes, | 37 const std::vector<std::string>* most_relevant_language_codes, |
38 const std::string& selected); | 38 const std::string& selected); |
39 | 39 |
| 40 // Returns the most first entry of |most_relevant_language_codes| that is |
| 41 // actually available (present in |available_locales|). If none of the entries |
| 42 // are present in |available_locales|, returns the |fallback_locale|. |
| 43 std::string FindMostRelevantLocale( |
| 44 const std::vector<std::string>& most_relevant_language_codes, |
| 45 const base::ListValue& available_locales, |
| 46 const std::string& fallback_locale); |
| 47 |
40 // Return a list of supported accept languages. The listed languages can be used | 48 // Return a list of supported accept languages. The listed languages can be used |
41 // in the Accept-Language header. The return value will look like: | 49 // in the Accept-Language header. The return value will look like: |
42 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, ...] | 50 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, ...] |
43 // The most relevant languages, read from initial_locale in VPD, will be first | 51 // The most relevant languages, read from initial_locale in VPD, will be first |
44 // in the list. | 52 // in the list. |
45 scoped_ptr<base::ListValue> GetAcceptLanguageList(); | 53 scoped_ptr<base::ListValue> GetAcceptLanguageList(); |
46 | 54 |
47 // Return a list of keyboard layouts that can be used for |locale| on the login | 55 // Return a list of keyboard layouts that can be used for |locale| on the login |
48 // screen. Each list entry is a dictionary that contains data such as an ID and | 56 // screen. Each list entry is a dictionary that contains data such as an ID and |
49 // a display name. The list will consist of the device's hardware layouts, | 57 // a display name. The list will consist of the device's hardware layouts, |
(...skipping 19 matching lines...) Expand all Loading... |
69 const GetKeyboardLayoutsForLocaleCallback& callback, | 77 const GetKeyboardLayoutsForLocaleCallback& callback, |
70 const std::string& locale); | 78 const std::string& locale); |
71 | 79 |
72 // Returns the current keyboard layout, expressed as a dictionary that contains | 80 // Returns the current keyboard layout, expressed as a dictionary that contains |
73 // data such as an ID and a display name. | 81 // data such as an ID and a display name. |
74 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout(); | 82 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout(); |
75 | 83 |
76 } // namespace chromeos | 84 } // namespace chromeos |
77 | 85 |
78 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_L10N_UTIL_H_ | 86 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_L10N_UTIL_H_ |
OLD | NEW |