OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H _ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H _ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H _ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H _ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "chrome/browser/ui/webui/options/language_options_handler.h" | 9 #include "chrome/browser/ui/webui/options/language_options_handler.h" |
10 #include "chromeos/ime/component_extension_ime_manager.h" | 10 #include "chromeos/ime/component_extension_ime_manager.h" |
(...skipping 28 matching lines...) Expand all Loading... | |
39 // Note that true in languageCodeSet does not mean anything. We just use | 39 // Note that true in languageCodeSet does not mean anything. We just use |
40 // the dictionary as a set. | 40 // the dictionary as a set. |
41 static base::ListValue* GetInputMethodList( | 41 static base::ListValue* GetInputMethodList( |
42 const input_method::InputMethodDescriptors& descriptors); | 42 const input_method::InputMethodDescriptors& descriptors); |
43 | 43 |
44 // Gets the list of accept languages with the given input descriptors. | 44 // Gets the list of accept languages with the given input descriptors. |
45 // Listed languages will be used as Accept-Language header. | 45 // Listed languages will be used as Accept-Language header. |
46 // The return value will look like: | 46 // The return value will look like: |
47 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, | 47 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, |
48 // ...] | 48 // ...] |
49 // "most relevant" languages, as set in initial_locale in VPD, will be first | |
50 // in the list. | |
49 static base::ListValue* GetAcceptLanguageList( | 51 static base::ListValue* GetAcceptLanguageList( |
50 const input_method::InputMethodDescriptors& descriptors); | 52 const input_method::InputMethodDescriptors& descriptors); |
51 | 53 |
52 // Gets the list of UI languages with the given input descriptors. | 54 // Gets the list of UI languages with the given input descriptors. |
53 // The return value will look like: | 55 // The return value will look like: |
54 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, | 56 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, |
55 // ...] | 57 // ...] |
58 // "most relevant" languages, as set in initial_locale in VPD, will be first | |
59 // in the list. | |
60 // An entry with empty "code" is used as a divider to separate "most | |
Nikita (slow)
2014/01/30 13:23:28
nit: Update comment to reflect that divider consta
Alexander Alekseev
2014/01/31 12:46:54
Done.
| |
61 // relevant" languages against other. | |
56 static base::ListValue* GetUILanguageList( | 62 static base::ListValue* GetUILanguageList( |
57 const input_method::InputMethodDescriptors& descriptors); | 63 const input_method::InputMethodDescriptors& descriptors); |
58 | 64 |
59 // Converts input method descriptors to the list of input methods. | 65 // Converts input method descriptors to the list of input methods. |
60 // The return value will look like: | 66 // The return value will look like: |
61 // [{'id': '_ext_ime_nejguenhnsnjnwychcnsdsdjketest', | 67 // [{'id': '_ext_ime_nejguenhnsnjnwychcnsdsdjketest', |
62 // 'displayName': 'Sample IME'}, ...] | 68 // 'displayName': 'Sample IME'}, ...] |
63 static base::ListValue* ConvertInputMethodDescriptosToIMEList( | 69 static base::ListValue* ConvertInputMethodDescriptosToIMEList( |
64 const input_method::InputMethodDescriptors& descriptors); | 70 const input_method::InputMethodDescriptors& descriptors); |
65 | 71 |
(...skipping 15 matching lines...) Expand all Loading... | |
81 | 87 |
82 // Called when the input method options page is opened. | 88 // Called when the input method options page is opened. |
83 // |args| will contain the input method ID as string (ex. "mozc"). | 89 // |args| will contain the input method ID as string (ex. "mozc"). |
84 void InputMethodOptionsOpenCallback(const base::ListValue* args); | 90 void InputMethodOptionsOpenCallback(const base::ListValue* args); |
85 | 91 |
86 // ComponentExtensionIMEManager::Observer override. | 92 // ComponentExtensionIMEManager::Observer override. |
87 virtual void OnInitialized() OVERRIDE; | 93 virtual void OnInitialized() OVERRIDE; |
88 | 94 |
89 // Gets the list of languages with |descriptors| based on | 95 // Gets the list of languages with |descriptors| based on |
90 // |base_language_codes|. | 96 // |base_language_codes|. |
97 // |insert_divider| means to insert empty string between "most relevant" | |
98 // languages and other. | |
91 static base::ListValue* GetLanguageListInternal( | 99 static base::ListValue* GetLanguageListInternal( |
92 const input_method::InputMethodDescriptors& descriptors, | 100 const input_method::InputMethodDescriptors& descriptors, |
93 const std::vector<std::string>& base_language_codes); | 101 const std::vector<std::string>& base_language_codes, |
102 bool insert_divider); | |
94 | 103 |
95 // OptionsPageUIHandler implementation. | 104 // OptionsPageUIHandler implementation. |
96 virtual void InitializePage() OVERRIDE; | 105 virtual void InitializePage() OVERRIDE; |
97 | 106 |
98 // True if the component extension list was appended into input method list. | 107 // True if the component extension list was appended into input method list. |
99 bool composition_extension_appended_; | 108 bool composition_extension_appended_; |
100 | 109 |
101 // True if this page was initialized. | 110 // True if this page was initialized. |
102 bool is_page_initialized_; | 111 bool is_page_initialized_; |
103 | 112 |
104 DISALLOW_COPY_AND_ASSIGN(CrosLanguageOptionsHandler); | 113 DISALLOW_COPY_AND_ASSIGN(CrosLanguageOptionsHandler); |
105 }; | 114 }; |
106 | 115 |
107 } // namespace options | 116 } // namespace options |
108 } // namespace chromeos | 117 } // namespace chromeos |
109 | 118 |
110 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLE R_H_ | 119 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLE R_H_ |
OLD | NEW |