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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/input_method/input_method_engine_base.h
diff --git a/chrome/browser/ui/input_method/input_method_engine_base.h b/chrome/browser/ui/input_method/input_method_engine_base.h
index 28ef642f4d305c72ecb86e37eca93f35e0e0dca0..5b57f627096ed8fd143b4f38afa5d19807e902f3 100644
--- a/chrome/browser/ui/input_method/input_method_engine_base.h
+++ b/chrome/browser/ui/input_method/input_method_engine_base.h
@@ -10,6 +10,7 @@
#include <vector>
#include "base/time/time.h"
#include "ui/base/ime/chromeos/input_method_descriptor.h"
+#include "ui/base/ime/composition_text.h"
#include "ui/base/ime/ime_engine_handler_interface.h"
#include "url/gurl.h"
@@ -165,7 +166,17 @@ class InputMethodEngineBase : virtual public ui::IMEEngineHandlerInterface {
const std::vector<SegmentInfo>& segments,
std::string* error);
+ // Called when a key event was handled.
+ void KeyEventHandled();
+
protected:
+ // Notifies InputContextHandler that the composition is changed.
+ virtual void UpdateComposition(const ui::CompositionText& composition_text,
+ uint32_t cursor_pos,
+ bool is_visible) = 0;
+ // Notifies InputContextHanlder to commit |text|.
+ virtual void CommitTextToInputContext(int context_id, const char* text) = 0;
+
ui::TextInputType current_input_type_;
// ID that is used for the current input context. False if there is no focus.
@@ -187,11 +198,21 @@ class InputMethodEngineBase : virtual public ui::IMEEngineHandlerInterface {
scoped_ptr<ui::CompositionText> composition_text_;
int composition_cursor_;
+ // The composition text to be set from setComposition.
+ ui::CompositionText composition_;
+
+ // The text to be committed from calling commitText.
+ std::string text_;
+
// Used with SendKeyEvents and ProcessKeyEvent to check if the key event
// sent to ProcessKeyEvent is sent by SendKeyEvents.
const ui::KeyEvent* sent_key_event_;
Profile* profile_;
+
+ // Indicates whether the IME extension is currently handling a physical key
+ // event. This is used in CommitText/UpdateCompositionText/etc.
+ bool handling_key_event_;
};
} // namespace input_method

Powered by Google App Engine
This is Rietveld 408576698