Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: chrome/browser/ui/input_method/input_method_engine_base.h

Issue 1657593007: Implement chrome.input.ime.setComposition/commitText API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use Xxx::Results::Create(). Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "ui/base/ime/chromeos/input_method_descriptor.h" 12 #include "ui/base/ime/chromeos/input_method_descriptor.h"
13 #include "ui/base/ime/composition_text.h"
13 #include "ui/base/ime/ime_engine_handler_interface.h" 14 #include "ui/base/ime/ime_engine_handler_interface.h"
14 #include "url/gurl.h" 15 #include "url/gurl.h"
15 16
16 class Profile; 17 class Profile;
17 18
18 namespace ui { 19 namespace ui {
19 struct CompositionText; 20 struct CompositionText;
20 class IMEEngineHandlerInterface; 21 class IMEEngineHandlerInterface;
21 class KeyEvent; 22 class KeyEvent;
22 } // namespace ui 23 } // namespace ui
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // Called when a key event is handled. 168 // Called when a key event is handled.
168 void KeyEventHandled(const std::string& extension_id, 169 void KeyEventHandled(const std::string& extension_id,
169 const std::string& request_id, 170 const std::string& request_id,
170 bool handled); 171 bool handled);
171 172
172 // Adds unprocessed key event to |request_map_|. 173 // Adds unprocessed key event to |request_map_|.
173 std::string AddRequest( 174 std::string AddRequest(
174 const std::string& component_id, 175 const std::string& component_id,
175 ui::IMEEngineHandlerInterface::KeyEventDoneCallback& key_data); 176 ui::IMEEngineHandlerInterface::KeyEventDoneCallback& key_data);
176 177
178 // Called when a key event is handled.
179 void KeyEventHandled();
180
177 protected: 181 protected:
182 // Notifies InputContextHandler that the composition is changed.
183 virtual void UpdateComposition(const ui::CompositionText& composition_text,
184 uint32_t cursor_pos,
185 bool is_visible) = 0;
186 // Notifies InputContextHanlder to commit |text|.
187 virtual void CommitTextToInputContext(int context_id,
188 const std::string& text) = 0;
189
178 ui::TextInputType current_input_type_; 190 ui::TextInputType current_input_type_;
179 191
180 // ID that is used for the current input context. False if there is no focus. 192 // ID that is used for the current input context. False if there is no focus.
181 int context_id_; 193 int context_id_;
182 194
183 // Next id that will be assigned to a context. 195 // Next id that will be assigned to a context.
184 int next_context_id_; 196 int next_context_id_;
185 197
186 // The input_component ID in IME extension's manifest. 198 // The input_component ID in IME extension's manifest.
187 std::string active_component_id_; 199 std::string active_component_id_;
(...skipping 14 matching lines...) Expand all
202 214
203 Profile* profile_; 215 Profile* profile_;
204 216
205 using RequestMap = 217 using RequestMap =
206 std::map<std::string, 218 std::map<std::string,
207 std::pair<std::string, 219 std::pair<std::string,
208 ui::IMEEngineHandlerInterface::KeyEventDoneCallback>>; 220 ui::IMEEngineHandlerInterface::KeyEventDoneCallback>>;
209 221
210 unsigned int next_request_id_; 222 unsigned int next_request_id_;
211 RequestMap request_map_; 223 RequestMap request_map_;
224
225 // The composition text to be set from calling input.ime.setComposition API.
226 ui::CompositionText composition_;
227
228 // The text to be committed from calling input.ime.commitText API.
229 std::string text_;
230
231 // Indicates whether the IME extension is currently handling a physical key
232 // event. This is used in CommitText/UpdateCompositionText/etc.
233 bool handling_key_event_;
212 }; 234 };
213 235
214 } // namespace input_method 236 } // namespace input_method
215 237
216 #endif // CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_ 238 #endif // CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/input_method/input_method_engine.cc ('k') | chrome/browser/ui/input_method/input_method_engine_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698