diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-31 22:19:43 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-31 22:19:43 +0000 |
commit | 9c8108d9356604eec57bf3c880f1580eb41fd1c3 (patch) | |
tree | 57c45ff318a11d96f6604906c326ba9fe531c6c4 /chrome/browser | |
parent | 2346f78737731d1c4456a950b2e5123ea6f33fbc (diff) | |
download | chromium_src-9c8108d9356604eec57bf3c880f1580eb41fd1c3.zip chromium_src-9c8108d9356604eec57bf3c880f1580eb41fd1c3.tar.gz chromium_src-9c8108d9356604eec57bf3c880f1580eb41fd1c3.tar.bz2 |
Some code in MessageBoxView was focusing the first focusable element in the view, overidding the focus set from the DialogDelegate.
We now only rely on the dialog delegate.
Also changed dialog delegate so the default button is also the focused button.
BUG=98
TEST=Open a javascript alert then confirm dialog. A button should be focused. Open all dialogs in Chrome. A button should be focused by default.
Review URL: http://codereview.chromium.org/8786
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4334 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/views/constrained_window_impl.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc index c687041..abd10fa 100644 --- a/chrome/browser/views/constrained_window_impl.cc +++ b/chrome/browser/views/constrained_window_impl.cc @@ -868,8 +868,13 @@ void ConstrainedWindowImpl::ActivateConstrainedWindow() { // better find whether the inner window should get focus. ::SetFocus(constrained_contents_->GetContainerHWND()); } else { - // Give our window the focus so we get keyboard messages. - ::SetFocus(GetHWND()); + views::View* view_to_focus = NULL; + if (window_delegate()) + view_to_focus = window_delegate()->GetInitiallyFocusedView(); + if (view_to_focus) + view_to_focus->RequestFocus(); + else // Give our window the focus so we get keyboard messages. + ::SetFocus(GetHWND()); } } } |