summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbashi@chromium.org <bashi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-10 08:14:03 +0000
committerbashi@chromium.org <bashi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-10 08:14:03 +0000
commit696be13864efaee592095628393f3ced59a97e1f (patch)
tree8ea399ce359cb96dee2ea8fdf727d6a9d5fd894b
parente2036c519b4685b13a82a1860d2c6c7326983abb (diff)
downloadchromium_src-696be13864efaee592095628393f3ced59a97e1f.zip
chromium_src-696be13864efaee592095628393f3ced59a97e1f.tar.gz
chromium_src-696be13864efaee592095628393f3ced59a97e1f.tar.bz2
Enable/disable input methods according to |text_input_type_| when a view
is selected so that input methods don't eat keyboard shortcuts. BUG=80772 TEST=manual Review URL: http://codereview.chromium.org/7554005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96149 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc
index 986bbb9..a6fcd5b 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc
@@ -209,6 +209,11 @@ LRESULT CALLBACK PluginWrapperWindowProc(HWND window, unsigned int message,
return ::DefWindowProc(window, message, wparam, lparam);
}
+bool ShouldEnableIME(ui::TextInputType type) {
+ return type != ui::TEXT_INPUT_TYPE_NONE &&
+ type != ui::TEXT_INPUT_TYPE_PASSWORD;
+}
+
} // namespace
// RenderWidgetHostView --------------------------------------------------------
@@ -287,6 +292,10 @@ void RenderWidgetHostViewWin::DidBecomeSelected() {
tab_switch_paint_time_ = TimeTicks::Now();
is_hidden_ = false;
EnsureTooltip();
+ if (ShouldEnableIME(text_input_type_))
+ ime_input_.EnableIME(m_hWnd);
+ else
+ ime_input_.DisableIME(m_hWnd);
render_widget_host_->WasRestored();
}
@@ -598,8 +607,7 @@ void RenderWidgetHostViewWin::ImeUpdateTextInputState(
// as true. We need to support "can_compose_inline=false" for PPAPI plugins
// that may want to avoid drawing composition-text by themselves and pass
// the responsibility to the browser.
- bool is_enabled = (type != ui::TEXT_INPUT_TYPE_NONE &&
- type != ui::TEXT_INPUT_TYPE_PASSWORD);
+ bool is_enabled = ShouldEnableIME(type);
if (text_input_type_ != type) {
text_input_type_ = type;
if (is_enabled)