From a4ad544b57c98407e6687abd77897c4cdbcdfb60 Mon Sep 17 00:00:00 2001 From: "jcivelli@chromium.org" Date: Mon, 30 Aug 2010 22:20:14 +0000 Subject: Relanding this CL that was previously backed-out. Fix the focus on post reload warning constrained window. The initial focus was not set to the right view. TBR=chase BUG=41926 TEST=Navigate to a page with a post. Reload the page. A constrained window with a warning that it is going to repost. The OK button should be focused. Pressing TAB should move the button to the next button. Pressing ESC should close the dialog. Review URL: http://codereview.chromium.org/3238004 Review URL: http://codereview.chromium.org/3228004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57919 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/views/constrained_window_win.cc | 6 ++---- chrome/browser/views/constrained_window_win.h | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'chrome/browser') diff --git a/chrome/browser/views/constrained_window_win.cc b/chrome/browser/views/constrained_window_win.cc index 7874b12..4230606 100644 --- a/chrome/browser/views/constrained_window_win.cc +++ b/chrome/browser/views/constrained_window_win.cc @@ -563,7 +563,8 @@ views::NonClientFrameView* ConstrainedWindowWin::CreateFrameViewForWindow() { } void ConstrainedWindowWin::FocusConstrainedWindow() { - focused_view_->RequestFocus(); + if (GetDelegate() && GetDelegate()->GetInitiallyFocusedView()) + GetDelegate()->GetInitiallyFocusedView()->RequestFocus(); } void ConstrainedWindowWin::ShowConstrainedWindow() { @@ -611,9 +612,6 @@ ConstrainedWindowWin::ConstrainedWindowWin( set_focus_on_creation(false); WindowWin::Init(owner_->GetNativeView(), gfx::Rect()); - - focused_view_ = window_delegate->GetContentsView(); - DCHECK(focused_view_); } void ConstrainedWindowWin::ActivateConstrainedWindow() { diff --git a/chrome/browser/views/constrained_window_win.h b/chrome/browser/views/constrained_window_win.h index 5e925b3..9b17bf6 100644 --- a/chrome/browser/views/constrained_window_win.h +++ b/chrome/browser/views/constrained_window_win.h @@ -71,7 +71,6 @@ class ConstrainedWindowWin : public ConstrainedWindow, // Current display rectangle (relative to owner_'s visible area). gfx::Rect current_bounds_; - views::View* focused_view_; DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowWin); }; -- cgit v1.1