OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_ | 5 #ifndef CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_ |
6 #define CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_ | 6 #define CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 #include "base/memory/scoped_ptr.h" | 12 |
12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
13 #include "ui/base/ime/chromeos/input_method_descriptor.h" | 14 #include "ui/base/ime/chromeos/input_method_descriptor.h" |
14 #include "ui/base/ime/composition_text.h" | 15 #include "ui/base/ime/composition_text.h" |
15 #include "ui/base/ime/ime_engine_handler_interface.h" | 16 #include "ui/base/ime/ime_engine_handler_interface.h" |
16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
17 | 18 |
18 class Profile; | 19 class Profile; |
19 | 20 |
20 namespace ui { | 21 namespace ui { |
21 struct CompositionText; | 22 struct CompositionText; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // Called when a menu item for this IME is interacted with. | 119 // Called when a menu item for this IME is interacted with. |
119 virtual void OnMenuItemActivated(const std::string& component_id, | 120 virtual void OnMenuItemActivated(const std::string& component_id, |
120 const std::string& menu_id) = 0; | 121 const std::string& menu_id) = 0; |
121 #endif // defined(OS_CHROMEOS) | 122 #endif // defined(OS_CHROMEOS) |
122 }; | 123 }; |
123 | 124 |
124 InputMethodEngineBase(); | 125 InputMethodEngineBase(); |
125 | 126 |
126 ~InputMethodEngineBase() override; | 127 ~InputMethodEngineBase() override; |
127 | 128 |
128 void Initialize(scoped_ptr<InputMethodEngineBase::Observer> observer, | 129 void Initialize(std::unique_ptr<InputMethodEngineBase::Observer> observer, |
129 const char* extension_id, | 130 const char* extension_id, |
130 Profile* profile); | 131 Profile* profile); |
131 | 132 |
132 // IMEEngineHandlerInterface overrides. | 133 // IMEEngineHandlerInterface overrides. |
133 void FocusIn(const ui::IMEEngineHandlerInterface::InputContext& input_context) | 134 void FocusIn(const ui::IMEEngineHandlerInterface::InputContext& input_context) |
134 override; | 135 override; |
135 void FocusOut() override; | 136 void FocusOut() override; |
136 void Enable(const std::string& component_id) override; | 137 void Enable(const std::string& component_id) override; |
137 void Disable() override; | 138 void Disable() override; |
138 void Reset() override; | 139 void Reset() override; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // Next id that will be assigned to a context. | 200 // Next id that will be assigned to a context. |
200 int next_context_id_; | 201 int next_context_id_; |
201 | 202 |
202 // The input_component ID in IME extension's manifest. | 203 // The input_component ID in IME extension's manifest. |
203 std::string active_component_id_; | 204 std::string active_component_id_; |
204 | 205 |
205 // The IME extension ID. | 206 // The IME extension ID. |
206 std::string extension_id_; | 207 std::string extension_id_; |
207 | 208 |
208 // The observer object recieving events for this IME. | 209 // The observer object recieving events for this IME. |
209 scoped_ptr<InputMethodEngineBase::Observer> observer_; | 210 std::unique_ptr<InputMethodEngineBase::Observer> observer_; |
210 | 211 |
211 // The current preedit text, and it's cursor position. | 212 // The current preedit text, and it's cursor position. |
212 scoped_ptr<ui::CompositionText> composition_text_; | 213 std::unique_ptr<ui::CompositionText> composition_text_; |
213 int composition_cursor_; | 214 int composition_cursor_; |
214 | 215 |
215 // Used with SendKeyEvents and ProcessKeyEvent to check if the key event | 216 // Used with SendKeyEvents and ProcessKeyEvent to check if the key event |
216 // sent to ProcessKeyEvent is sent by SendKeyEvents. | 217 // sent to ProcessKeyEvent is sent by SendKeyEvents. |
217 const ui::KeyEvent* sent_key_event_; | 218 const ui::KeyEvent* sent_key_event_; |
218 | 219 |
219 Profile* profile_; | 220 Profile* profile_; |
220 | 221 |
221 using RequestMap = | 222 using RequestMap = |
222 std::map<std::string, | 223 std::map<std::string, |
(...skipping 10 matching lines...) Expand all Loading... |
233 std::string text_; | 234 std::string text_; |
234 | 235 |
235 // Indicates whether the IME extension is currently handling a physical key | 236 // Indicates whether the IME extension is currently handling a physical key |
236 // event. This is used in CommitText/UpdateCompositionText/etc. | 237 // event. This is used in CommitText/UpdateCompositionText/etc. |
237 bool handling_key_event_; | 238 bool handling_key_event_; |
238 }; | 239 }; |
239 | 240 |
240 } // namespace input_method | 241 } // namespace input_method |
241 | 242 |
242 #endif // CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_ | 243 #endif // CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_ |
OLD | NEW |