summaryrefslogtreecommitdiffstats
path: root/views/widget/native_widget_views.cc
diff options
context:
space:
mode:
authoroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-25 08:46:16 +0000
committeroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-25 08:46:16 +0000
commit923baa404798c9a28d7091f8cdf70f1e5ad9a403 (patch)
treeb3bac355df1f488d6c1fe5486492f7b23194e9e5 /views/widget/native_widget_views.cc
parent3f05f4eadd930f4bf2b1142274e23529311bee14 (diff)
downloadchromium_src-923baa404798c9a28d7091f8cdf70f1e5ad9a403.zip
chromium_src-923baa404798c9a28d7091f8cdf70f1e5ad9a403.tar.gz
chromium_src-923baa404798c9a28d7091f8cdf70f1e5ad9a403.tar.bz2
More input focus fix
OnKeyEvent should create IM object if necessary NULL check in OnActivate TBR=penghuang@chromium.org BUG=none TEST=none Review URL: http://codereview.chromium.org/7748013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98206 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget/native_widget_views.cc')
-rw-r--r--views/widget/native_widget_views.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/views/widget/native_widget_views.cc b/views/widget/native_widget_views.cc
index 6e0139b..c029b2f 100644
--- a/views/widget/native_widget_views.cc
+++ b/views/widget/native_widget_views.cc
@@ -69,11 +69,13 @@ void NativeWidgetViews::OnActivate(bool active) {
if (widget->is_top_level()) {
InputMethod* input_method = widget->GetInputMethodDirect();
if (active) {
- input_method->OnFocus();
+ if (input_method)
+ input_method->OnFocus();
// See description of got_initial_focus_in_ for details on this.
widget->GetFocusManager()->RestoreFocusedView();
} else {
- input_method->OnBlur();
+ if (input_method)
+ input_method->OnBlur();
widget->GetFocusManager()->StoreFocusedView();
}
}
@@ -81,7 +83,7 @@ void NativeWidgetViews::OnActivate(bool active) {
}
bool NativeWidgetViews::OnKeyEvent(const KeyEvent& key_event) {
- InputMethod* input_method = GetWidget()->GetInputMethodDirect();
+ InputMethod* input_method = GetWidget()->GetInputMethod();
DCHECK(input_method);
input_method->DispatchKeyEvent(key_event);
return true;