diff options
author | jennyz@chromium.org <jennyz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-27 19:20:17 +0000 |
---|---|---|
committer | jennyz@chromium.org <jennyz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-27 19:20:17 +0000 |
commit | 165c4583c6334e6037402a2e7efc3d6d4b95051b (patch) | |
tree | 7710891f806344cfc602ac0c24d4c2e30257d1ce /ui/views | |
parent | 474630b0893a33c6bd50d3f6bdb392fa8acb9ce5 (diff) | |
download | chromium_src-165c4583c6334e6037402a2e7efc3d6d4b95051b.zip chromium_src-165c4583c6334e6037402a2e7efc3d6d4b95051b.tar.gz chromium_src-165c4583c6334e6037402a2e7efc3d6d4b95051b.tar.bz2 |
Fix a focus issue broken by revision 119159.
BUG=110522
TEST=HtmlDialog dialog should has focus in web UI when it is displayed. This should work for regular dialog with border and frameless dialog as well, such as KeyboardOverlay dialog.
Review URL: http://codereview.chromium.org/9288082
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119473 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views')
-rw-r--r-- | ui/views/widget/native_widget_aura.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index a0220ad..08e50cd 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -459,8 +459,16 @@ void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { window_->SetIntProperty(aura::client::kShowStateKey, state); } window_->Show(); - if (can_activate_ && state != ui::SHOW_STATE_INACTIVE) { - Activate(); + if (can_activate_) { + if (state != ui::SHOW_STATE_INACTIVE) + Activate(); + // SetInitialFocus() should be always be called, even for + // SHOW_STATE_INACTIVE. When a frameless modal dialog is created by + // a widget of TYPE_WINDOW_FRAMELESS, Widget::Show() will call into + // this function with the window state SHOW_STATE_INACTIVE, + // SetInitialFoucs() has to be called so that the dialog can get focus. + // This also matches NativeWidgetWin which invokes SetInitialFocus + // regardless of show state. GetWidget()->SetInitialFocus(); } } |