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_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 const std::string& layout) override; | 106 const std::string& layout) override; |
107 bool CanCycleInputMethod() override; | 107 bool CanCycleInputMethod() override; |
108 void SwitchToNextInputMethod() override; | 108 void SwitchToNextInputMethod() override; |
109 void SwitchToPreviousInputMethod() override; | 109 void SwitchToPreviousInputMethod() override; |
110 bool CanSwitchInputMethod(const ui::Accelerator& accelerator) override; | 110 bool CanSwitchInputMethod(const ui::Accelerator& accelerator) override; |
111 void SwitchInputMethod(const ui::Accelerator& accelerator) override; | 111 void SwitchInputMethod(const ui::Accelerator& accelerator) override; |
112 InputMethodDescriptor GetCurrentInputMethod() const override; | 112 InputMethodDescriptor GetCurrentInputMethod() const override; |
113 bool ReplaceEnabledInputMethods( | 113 bool ReplaceEnabledInputMethods( |
114 const std::vector<std::string>& new_active_input_method_ids) override; | 114 const std::vector<std::string>& new_active_input_method_ids) override; |
115 | 115 |
| 116 bool SetAllowedInputMethods( |
| 117 const std::vector<std::string>& new_allowed_input_method_ids) override; |
| 118 const std::vector<std::string>& GetAllowedInputMethods() override; |
| 119 |
116 // ------------------------- Data members. | 120 // ------------------------- Data members. |
117 Profile* const profile; | 121 Profile* const profile; |
118 | 122 |
119 // The input method which was/is selected. | 123 // The input method which was/is selected. |
120 InputMethodDescriptor previous_input_method; | 124 InputMethodDescriptor previous_input_method; |
121 InputMethodDescriptor current_input_method; | 125 InputMethodDescriptor current_input_method; |
122 | 126 |
123 // The active input method ids cache. | 127 // The active input method ids cache. |
124 std::vector<std::string> active_input_method_ids; | 128 std::vector<std::string> active_input_method_ids; |
125 | 129 |
| 130 // The allowed keyboard layout input methods (e.g. by policy). |
| 131 std::vector<std::string> allowed_keyboard_layout_input_method_ids; |
| 132 |
126 // The pending input method id for delayed 3rd party IME enabling. | 133 // The pending input method id for delayed 3rd party IME enabling. |
127 std::string pending_input_method_id; | 134 std::string pending_input_method_id; |
128 | 135 |
129 // The list of enabled extension IMEs. | 136 // The list of enabled extension IMEs. |
130 std::vector<std::string> enabled_extension_imes; | 137 std::vector<std::string> enabled_extension_imes; |
131 | 138 |
132 // Extra input methods that have been explicitly added to the menu, such as | 139 // Extra input methods that have been explicitly added to the menu, such as |
133 // those created by extension. | 140 // those created by extension. |
134 std::map<std::string, InputMethodDescriptor> extra_input_methods; | 141 std::map<std::string, InputMethodDescriptor> extra_input_methods; |
135 | 142 |
136 InputMethodManagerImpl* const manager_; | 143 InputMethodManagerImpl* const manager_; |
137 | 144 |
138 // True if the opt-in IME menu is activated. | 145 // True if the opt-in IME menu is activated. |
139 bool menu_activated; | 146 bool menu_activated; |
140 | 147 |
141 protected: | 148 protected: |
142 friend base::RefCounted<chromeos::input_method::InputMethodManager::State>; | 149 friend base::RefCounted<chromeos::input_method::InputMethodManager::State>; |
143 ~StateImpl() override; | 150 ~StateImpl() override; |
| 151 |
| 152 private: |
| 153 // Retruns true if the passed input method is allowed. By default, all input |
| 154 // methods are allowed. After SetAllowedKeyboardLayoutInputMethods was |
| 155 // called, the passed keyboard layout input methods are allowed and all |
| 156 // non-keyboard input methods remain to be allowed. |
| 157 bool IsInputMethodAllowed(const std::string& input_method_id) const; |
144 }; | 158 }; |
145 | 159 |
146 // Constructs an InputMethodManager instance. The client is responsible for | 160 // Constructs an InputMethodManager instance. The client is responsible for |
147 // calling |SetUISessionState| in response to relevant changes in browser | 161 // calling |SetUISessionState| in response to relevant changes in browser |
148 // state. | 162 // state. |
149 InputMethodManagerImpl(std::unique_ptr<InputMethodDelegate> delegate, | 163 InputMethodManagerImpl(std::unique_ptr<InputMethodDelegate> delegate, |
150 bool enable_extension_loading); | 164 bool enable_extension_loading); |
151 ~InputMethodManagerImpl() override; | 165 ~InputMethodManagerImpl() override; |
152 | 166 |
153 // Receives notification of an InputMethodManager::UISessionState transition. | 167 // Receives notification of an InputMethodManager::UISessionState transition. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 typedef std::map<Profile*, EngineMap, ProfileCompare> ProfileEngineMap; | 311 typedef std::map<Profile*, EngineMap, ProfileCompare> ProfileEngineMap; |
298 ProfileEngineMap engine_map_; | 312 ProfileEngineMap engine_map_; |
299 | 313 |
300 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); | 314 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); |
301 }; | 315 }; |
302 | 316 |
303 } // namespace input_method | 317 } // namespace input_method |
304 } // namespace chromeos | 318 } // namespace chromeos |
305 | 319 |
306 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ | 320 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ |
OLD | NEW |