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

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

Issue 1771173002: Implement input.ime.sendKeyEvents API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test failure. Created 4 years, 9 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>
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 std::string* error) override; 147 std::string* error) override;
148 const std::string& GetActiveComponentId() const override; 148 const std::string& GetActiveComponentId() const override;
149 bool DeleteSurroundingText(int context_id, 149 bool DeleteSurroundingText(int context_id,
150 int offset, 150 int offset,
151 size_t number_of_chars, 151 size_t number_of_chars,
152 std::string* error) override; 152 std::string* error) override;
153 int GetCotextIdForTesting() { return context_id_; } 153 int GetCotextIdForTesting() { return context_id_; }
154 bool IsInterestedInKeyEvent() const override; 154 bool IsInterestedInKeyEvent() const override;
155 155
156 // Send the sequence of key events. 156 // Send the sequence of key events.
157 virtual bool SendKeyEvents(int context_id, 157 bool SendKeyEvents(int context_id, const std::vector<KeyboardEvent>& events);
158 const std::vector<KeyboardEvent>& events) = 0;
159 158
160 // Set the current composition and associated properties. 159 // Set the current composition and associated properties.
161 bool SetComposition(int context_id, 160 bool SetComposition(int context_id,
162 const char* text, 161 const char* text,
163 int selection_start, 162 int selection_start,
164 int selection_end, 163 int selection_end,
165 int cursor, 164 int cursor,
166 const std::vector<SegmentInfo>& segments, 165 const std::vector<SegmentInfo>& segments,
167 std::string* error); 166 std::string* error);
168 // Called when a key event is handled. 167 // Called when a key event is handled.
(...skipping 10 matching lines...) Expand all
179 void KeyEventHandled(); 178 void KeyEventHandled();
180 179
181 protected: 180 protected:
182 // Notifies InputContextHandler that the composition is changed. 181 // Notifies InputContextHandler that the composition is changed.
183 virtual void UpdateComposition(const ui::CompositionText& composition_text, 182 virtual void UpdateComposition(const ui::CompositionText& composition_text,
184 uint32_t cursor_pos, 183 uint32_t cursor_pos,
185 bool is_visible) = 0; 184 bool is_visible) = 0;
186 // Notifies InputContextHanlder to commit |text|. 185 // Notifies InputContextHanlder to commit |text|.
187 virtual void CommitTextToInputContext(int context_id, 186 virtual void CommitTextToInputContext(int context_id,
188 const std::string& text) = 0; 187 const std::string& text) = 0;
188 // Sends the key event to the window tree host.
189 virtual bool SendKeyEvent(ui::KeyEvent* ui_event,
190 const std::string& code) = 0;
189 191
190 ui::TextInputType current_input_type_; 192 ui::TextInputType current_input_type_;
191 193
192 // ID that is used for the current input context. False if there is no focus. 194 // ID that is used for the current input context. False if there is no focus.
193 int context_id_; 195 int context_id_;
194 196
195 // Next id that will be assigned to a context. 197 // Next id that will be assigned to a context.
196 int next_context_id_; 198 int next_context_id_;
197 199
198 // The input_component ID in IME extension's manifest. 200 // The input_component ID in IME extension's manifest.
(...skipping 30 matching lines...) Expand all
229 std::string text_; 231 std::string text_;
230 232
231 // Indicates whether the IME extension is currently handling a physical key 233 // Indicates whether the IME extension is currently handling a physical key
232 // event. This is used in CommitText/UpdateCompositionText/etc. 234 // event. This is used in CommitText/UpdateCompositionText/etc.
233 bool handling_key_event_; 235 bool handling_key_event_;
234 }; 236 };
235 237
236 } // namespace input_method 238 } // namespace input_method
237 239
238 #endif // CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_ 240 #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