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 "app/menus/simple_menu_model.h" | 9 #include "app/menus/simple_menu_model.h" |
10 #include "chrome/browser/chromeos/cros/input_method_library.h" | 10 #include "chrome/browser/chromeos/cros/input_method_library.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 virtual void HighlightChangedTo(int index); | 56 virtual void HighlightChangedTo(int index); |
57 virtual void ActivatedAt(int index); | 57 virtual void ActivatedAt(int index); |
58 virtual void MenuWillShow(); | 58 virtual void MenuWillShow(); |
59 | 59 |
60 // views::ViewMenuDelegate implementation. Sub classes can override the method | 60 // views::ViewMenuDelegate implementation. Sub classes can override the method |
61 // to adjust the position of the menu. | 61 // to adjust the position of the menu. |
62 virtual void RunMenu(views::View* unused_source, | 62 virtual void RunMenu(views::View* unused_source, |
63 const gfx::Point& pt); | 63 const gfx::Point& pt); |
64 | 64 |
65 // InputMethodLibrary::Observer implementation. | 65 // InputMethodLibrary::Observer implementation. |
66 virtual void InputMethodChanged(InputMethodLibrary* obj); | 66 virtual void InputMethodChanged( |
67 virtual void ImePropertiesChanged(InputMethodLibrary* obj); | 67 InputMethodLibrary* obj, |
68 virtual void ActiveInputMethodsChanged(InputMethodLibrary* obj); | 68 const InputMethodDescriptor& previous_input_method, |
| 69 const InputMethodDescriptor& current_input_method, |
| 70 size_t num_active_input_methods); |
| 71 virtual void ActiveInputMethodsChanged( |
| 72 InputMethodLibrary* obj, |
| 73 const InputMethodDescriptor& current_input_method, |
| 74 size_t num_active_input_methods); |
| 75 virtual void PreferenceUpdateNeeded( |
| 76 InputMethodLibrary* obj, |
| 77 const InputMethodDescriptor& previous_input_method, |
| 78 const InputMethodDescriptor& current_input_method); |
69 | 79 |
70 // NotificationObserver implementation. | 80 // NotificationObserver implementation. |
71 virtual void Observe(NotificationType type, | 81 virtual void Observe(NotificationType type, |
72 const NotificationSource& source, | 82 const NotificationSource& source, |
73 const NotificationDetails& details); | 83 const NotificationDetails& details); |
74 | 84 |
75 // Sets the minimum width of the dropdown menu. | 85 // Sets the minimum width of the dropdown menu. |
76 void SetMinimumWidth(int width); | 86 void SetMinimumWidth(int width); |
77 | 87 |
78 // Registers input method preferences for the login screen. | 88 // Registers input method preferences for the login screen. |
79 static void RegisterPrefs(PrefService* local_state); | 89 static void RegisterPrefs(PrefService* local_state); |
80 | 90 |
81 // Returns a string for the indicator on top right corner of the Chrome | 91 // Returns a string for the indicator on top right corner of the Chrome |
82 // window. The method is public for unit tests. | 92 // window. The method is public for unit tests. |
83 static std::wstring GetTextForIndicator( | 93 static std::wstring GetTextForIndicator( |
84 const InputMethodDescriptor& input_method); | 94 const InputMethodDescriptor& input_method); |
85 | 95 |
86 // Returns a string for the drop-down menu and the tooltip for the indicator. | 96 // Returns a string for the drop-down menu and the tooltip for the indicator. |
87 // The method is public for unit tests. | 97 // The method is public for unit tests. |
88 static std::wstring GetTextForMenu(const InputMethodDescriptor& input_method); | 98 static std::wstring GetTextForMenu(const InputMethodDescriptor& input_method); |
89 | 99 |
90 protected: | 100 protected: |
91 // Parses |input_method| and then calls UpdateUI(). | 101 // Parses |input_method| and then calls UpdateUI(). |
92 void UpdateUIFromInputMethod(const InputMethodDescriptor& input_method); | 102 void UpdateUIFromInputMethod(const InputMethodDescriptor& input_method, |
| 103 size_t num_active_input_methods); |
93 | 104 |
94 // Rebuilds model and menu2 objects in preparetion to open the menu. | 105 // Rebuilds model and menu2 objects in preparetion to open the menu. |
95 void PrepareForMenuOpen(); | 106 void PrepareForMenuOpen(); |
96 | 107 |
97 // Returns menu2 object for language menu. | 108 // Returns menu2 object for language menu. |
98 views::Menu2& input_method_menu() { | 109 views::Menu2& input_method_menu() { |
99 return input_method_menu_; | 110 return input_method_menu_; |
100 } | 111 } |
101 | 112 |
102 private: | 113 private: |
103 // Updates UI of a container of the menu (e.g. the "US" menu button in the | 114 // Updates UI of a container of the menu (e.g. the "US" menu button in the |
104 // status area). Sub classes have to implement the interface for their own UI. | 115 // status area). Sub classes have to implement the interface for their own UI. |
105 virtual void UpdateUI( | 116 virtual void UpdateUI(const std::string& input_method_id, // e.g. "mozc" |
106 const std::wstring& name, const std::wstring& tooltip) = 0; | 117 const std::wstring& name, // e.g. "US", "INTL" |
| 118 const std::wstring& tooltip, |
| 119 size_t num_active_input_methods) = 0; |
107 | 120 |
108 // Sub classes have to implement the interface. This interface should return | 121 // Sub classes have to implement the interface. This interface should return |
109 // true if the dropdown menu should show an item like "Customize languages | 122 // true if the dropdown menu should show an item like "Customize languages |
110 // and input..." DOMUI. | 123 // and input..." DOMUI. |
111 virtual bool ShouldSupportConfigUI() = 0; | 124 virtual bool ShouldSupportConfigUI() = 0; |
112 | 125 |
113 // Sub classes have to implement the interface which opens an UI for | 126 // Sub classes have to implement the interface which opens an UI for |
114 // customizing languages and input. | 127 // customizing languages and input. |
115 virtual void OpenConfigUI() = 0; | 128 virtual void OpenConfigUI() = 0; |
116 | 129 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 const bool is_browser_mode_; | 166 const bool is_browser_mode_; |
154 const bool is_screen_locker_mode_; | 167 const bool is_screen_locker_mode_; |
155 const bool is_out_of_box_experience_mode_; | 168 const bool is_out_of_box_experience_mode_; |
156 | 169 |
157 DISALLOW_COPY_AND_ASSIGN(InputMethodMenu); | 170 DISALLOW_COPY_AND_ASSIGN(InputMethodMenu); |
158 }; | 171 }; |
159 | 172 |
160 } // namespace chromeos | 173 } // namespace chromeos |
161 | 174 |
162 #endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ | 175 #endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ |
OLD | NEW |