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

Unified Diff: ui/views/ime/input_method_win.cc

Issue 17112021: New method: InputMethod::IsCandidatePopupOpen() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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: ui/views/ime/input_method_win.cc
diff --git a/ui/views/ime/input_method_win.cc b/ui/views/ime/input_method_win.cc
index 35c0a4252723dfe63c4da6deb70da5faf6839614..8230a34e8c2cff0f043ebe25561afc266630e03c 100644
--- a/ui/views/ime/input_method_win.cc
+++ b/ui/views/ime/input_method_win.cc
@@ -27,6 +27,7 @@ InputMethodWin::InputMethodWin(internal::InputMethodDelegate* delegate,
ui::InputMethod* host)
: hwnd_(hwnd),
active_(false),
+ is_popup_open_(false),
direction_(base::i18n::UNKNOWN_DIRECTION),
pending_requested_direction_(base::i18n::UNKNOWN_DIRECTION),
host_(host) {
@@ -78,6 +79,10 @@ bool InputMethodWin::OnUntranslatedIMEMessage(const base::NativeEvent& event,
original_result = OnImeRequest(
event.message, event.wParam, event.lParam, &handled);
break;
+ case WM_IME_NOTIFY:
+ original_result = OnImeNotify(
+ event.message, event.wParam, event.lParam, &handled);
+ break;
case WM_CHAR:
case WM_SYSCHAR:
original_result = OnChar(
@@ -167,6 +172,10 @@ ui::TextInputClient* InputMethodWin::GetTextInputClient() const {
return host_ ? host_->GetTextInputClient() : NULL;
}
+bool InputMethodWin::IsPopupOpen() const {
+ return is_popup_open_;
+}
+
void InputMethodWin::OnWillChangeFocus(View* focused_before, View* focused) {
ConfirmCompositionText();
}
@@ -274,6 +283,23 @@ LRESULT InputMethodWin::OnImeRequest(
}
}
+LRESULT InputMethodWin::OnImeNotify(
+ UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled) {
+ *handled = FALSE;
+
+ // Update |is_popup_open_|, whether a candidate window is open or not.
+ switch (wparam) {
+ case IMN_OPENCANDIDATE:
+ is_popup_open_ = true;
+ break;
+ case IMN_CLOSECANDIDATE:
+ is_popup_open_ = false;
+ break;
+ }
+
+ return 0;
+}
+
LRESULT InputMethodWin::OnChar(
UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled) {
*handled = TRUE;

Powered by Google App Engine
This is Rietveld 408576698