OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_STATUS_INPUT_METHOD_MENU_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ |
6 #define CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // Returns a string for the indicator on top right corner of the Chrome | 90 // Returns a string for the indicator on top right corner of the Chrome |
91 // window. The method is public for unit tests. | 91 // window. The method is public for unit tests. |
92 static std::wstring GetTextForIndicator( | 92 static std::wstring GetTextForIndicator( |
93 const InputMethodDescriptor& input_method); | 93 const InputMethodDescriptor& input_method); |
94 | 94 |
95 // Returns a string for the drop-down menu and the tooltip for the indicator. | 95 // Returns a string for the drop-down menu and the tooltip for the indicator. |
96 // The method is public for unit tests. | 96 // The method is public for unit tests. |
97 static std::wstring GetTextForMenu(const InputMethodDescriptor& input_method); | 97 static std::wstring GetTextForMenu(const InputMethodDescriptor& input_method); |
98 | 98 |
99 protected: | 99 protected: |
100 // Parses |input_method| and then calls UpdateUI(). | |
101 void UpdateUIFromInputMethod(const InputMethodDescriptor& input_method, | |
102 size_t num_active_input_methods); | |
103 | |
104 // Rebuilds model and menu2 objects in preparetion to open the menu. | 100 // Rebuilds model and menu2 objects in preparetion to open the menu. |
105 void PrepareForMenuOpen(); | 101 void PrepareForMenuOpen(); |
106 | 102 |
107 // Returns menu2 object for language menu. | 103 // Returns menu2 object for language menu. |
108 views::Menu2& input_method_menu() { | 104 views::Menu2& input_method_menu() { |
109 return input_method_menu_; | 105 return input_method_menu_; |
110 } | 106 } |
111 | 107 |
112 private: | 108 private: |
113 // Updates UI of a container of the menu (e.g. the "US" menu button in the | 109 // Updates UI of a container of the menu (e.g. the "US" menu button in the |
114 // status area). Sub classes have to implement the interface for their own UI. | 110 // status area). Sub classes have to implement the interface for their own UI. |
115 virtual void UpdateUI(const std::string& input_method_id, // e.g. "mozc" | 111 virtual void UpdateUI(const std::string& input_method_id, // e.g. "mozc" |
116 const std::wstring& name, // e.g. "US", "INTL" | 112 const std::wstring& name, // e.g. "US", "INTL" |
117 const std::wstring& tooltip, | 113 const std::wstring& tooltip, |
118 size_t num_active_input_methods) = 0; | 114 size_t num_active_input_methods) = 0; |
119 | 115 |
120 // Sub classes have to implement the interface. This interface should return | 116 // Sub classes have to implement the interface. This interface should return |
121 // true if the dropdown menu should show an item like "Customize languages | 117 // true if the dropdown menu should show an item like "Customize languages |
122 // and input..." DOMUI. | 118 // and input..." DOMUI. |
123 virtual bool ShouldSupportConfigUI() = 0; | 119 virtual bool ShouldSupportConfigUI() = 0; |
124 | 120 |
125 // Sub classes have to implement the interface which opens an UI for | 121 // Sub classes have to implement the interface which opens an UI for |
126 // customizing languages and input. | 122 // customizing languages and input. |
127 virtual void OpenConfigUI() = 0; | 123 virtual void OpenConfigUI() = 0; |
128 | 124 |
| 125 // Parses |input_method| and then calls UpdateUI(). |
| 126 void UpdateUIFromInputMethod(const InputMethodDescriptor& input_method, |
| 127 size_t num_active_input_methods); |
| 128 |
129 // Rebuilds |model_|. This function should be called whenever | 129 // Rebuilds |model_|. This function should be called whenever |
130 // |input_method_descriptors_| is updated, or ImePropertiesChanged() is | 130 // |input_method_descriptors_| is updated, or ImePropertiesChanged() is |
131 // called. | 131 // called. |
132 void RebuildModel(); | 132 void RebuildModel(); |
133 | 133 |
134 // Returns true if the zero-origin |index| points to one of the input methods. | 134 // Returns true if the zero-origin |index| points to one of the input methods. |
135 bool IndexIsInInputMethodList(int index) const; | 135 bool IndexIsInInputMethodList(int index) const; |
136 | 136 |
137 // Returns true if the zero-origin |index| points to one of the IME | 137 // Returns true if the zero-origin |index| points to one of the IME |
138 // properties. When returning true, |property_index| is updated so that | 138 // properties. When returning true, |property_index| is updated so that |
(...skipping 28 matching lines...) Expand all Loading... |
167 // true if the menu is for a dialog in OOBE screen. In the dialog, we don't | 167 // true if the menu is for a dialog in OOBE screen. In the dialog, we don't |
168 // use radio buttons. | 168 // use radio buttons. |
169 const bool for_out_of_box_experience_dialog_; | 169 const bool for_out_of_box_experience_dialog_; |
170 | 170 |
171 DISALLOW_COPY_AND_ASSIGN(InputMethodMenu); | 171 DISALLOW_COPY_AND_ASSIGN(InputMethodMenu); |
172 }; | 172 }; |
173 | 173 |
174 } // namespace chromeos | 174 } // namespace chromeos |
175 | 175 |
176 #endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ | 176 #endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ |
OLD | NEW |