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

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: Checkout InputImeEventRouter. 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 159
159 // Set the current composition and associated properties. 160 // Set the current composition and associated properties.
160 bool SetComposition(int context_id, 161 bool SetComposition(int context_id,
161 const char* text, 162 const char* text,
162 int selection_start, 163 int selection_start,
163 int selection_end, 164 int selection_end,
164 int cursor, 165 int cursor,
165 const std::vector<SegmentInfo>& segments, 166 const std::vector<SegmentInfo>& segments,
166 std::string* error); 167 std::string* error);
167 168
169 // Called when a key event was handled.
170 void KeyEventHandled();
171
168 protected: 172 protected:
173 // Notifies InputContextHandler that the composition is changed.
174 virtual void UpdateComposition(const ui::CompositionText& composition_text,
175 uint32_t cursor_pos,
176 bool is_visible) = 0;
177 // Notifies InputContextHanlder to commit |text|.
178 virtual void CommitTextToInputContext(int context_id, const char* text) = 0;
179
169 ui::TextInputType current_input_type_; 180 ui::TextInputType current_input_type_;
170 181
171 // ID that is used for the current input context. False if there is no focus. 182 // ID that is used for the current input context. False if there is no focus.
172 int context_id_; 183 int context_id_;
173 184
174 // Next id that will be assigned to a context. 185 // Next id that will be assigned to a context.
175 int next_context_id_; 186 int next_context_id_;
176 187
177 // The input_component ID in IME extension's manifest. 188 // The input_component ID in IME extension's manifest.
178 std::string active_component_id_; 189 std::string active_component_id_;
179 190
180 // The IME extension ID. 191 // The IME extension ID.
181 std::string extension_id_; 192 std::string extension_id_;
182 193
183 // The observer object recieving events for this IME. 194 // The observer object recieving events for this IME.
184 scoped_ptr<InputMethodEngineBase::Observer> observer_; 195 scoped_ptr<InputMethodEngineBase::Observer> observer_;
185 196
186 // The current preedit text, and it's cursor position. 197 // The current preedit text, and it's cursor position.
187 scoped_ptr<ui::CompositionText> composition_text_; 198 scoped_ptr<ui::CompositionText> composition_text_;
188 int composition_cursor_; 199 int composition_cursor_;
189 200
201 // The composition text to be set from setComposition.
202 ui::CompositionText composition_;
203
204 // The text to be committed from calling commitText.
205 std::string text_;
206
190 // Used with SendKeyEvents and ProcessKeyEvent to check if the key event 207 // Used with SendKeyEvents and ProcessKeyEvent to check if the key event
191 // sent to ProcessKeyEvent is sent by SendKeyEvents. 208 // sent to ProcessKeyEvent is sent by SendKeyEvents.
192 const ui::KeyEvent* sent_key_event_; 209 const ui::KeyEvent* sent_key_event_;
193 210
194 Profile* profile_; 211 Profile* profile_;
212
213 // Indicates whether the IME extension is currently handling a physical key
214 // event. This is used in CommitText/UpdateCompositionText/etc.
215 bool handling_key_event_;
195 }; 216 };
196 217
197 } // namespace input_method 218 } // namespace input_method
198 219
199 #endif // CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_ 220 #endif // CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698