summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-13 00:30:18 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-13 00:30:18 +0000
commit1afda2ef4b3759fff38a6092891e07e8ea9443a7 (patch)
treee092b9cd9c38c6344de63a6d6142080f6e28c99c /ui
parentfe303c5fd7baa1203e8205d9124d4e13069a983e (diff)
downloadchromium_src-1afda2ef4b3759fff38a6092891e07e8ea9443a7.zip
chromium_src-1afda2ef4b3759fff38a6092891e07e8ea9443a7.tar.gz
chromium_src-1afda2ef4b3759fff38a6092891e07e8ea9443a7.tar.bz2
Clear focused view if the focused view is in a window that is being destroyed.
Original CL (http://codereview.chromium.org/8821004/) was causing crash on some of browser_tests due to this. BUG=104361 TEST=manual, and browser_tests now pass without crash Review URL: http://codereview.chromium.org/8892025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114131 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/views/widget/native_widget_aura.cc6
-rw-r--r--ui/views/widget/widget.cc5
2 files changed, 6 insertions, 5 deletions
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index ac87620..91bb44a 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -574,9 +574,6 @@ void NativeWidgetAura::OnFocus() {
if (widget->is_top_level()) {
InputMethod* input_method = widget->GetInputMethod();
input_method->OnFocus();
- // See description of got_initial_focus_in_ for details on this.
- // TODO(mazda): Investigate this is actually necessary.
- // widget->GetFocusManager()->RestoreFocusedView();
}
delegate_->OnNativeFocus(window_);
}
@@ -586,7 +583,6 @@ void NativeWidgetAura::OnBlur() {
if (widget->is_top_level()) {
InputMethod* input_method = widget->GetInputMethod();
input_method->OnBlur();
- widget->GetFocusManager()->StoreFocusedView();
}
delegate_->OnNativeBlur(NULL);
}
@@ -672,12 +668,14 @@ bool NativeWidgetAura::ShouldActivate(aura::Event* event) {
}
void NativeWidgetAura::OnActivated() {
+ GetWidget()->GetFocusManager()->RestoreFocusedView();
delegate_->OnNativeWidgetActivationChanged(true);
if (IsVisible() && GetWidget()->non_client_view())
GetWidget()->non_client_view()->SchedulePaint();
}
void NativeWidgetAura::OnLostActive() {
+ GetWidget()->GetFocusManager()->StoreFocusedView();
delegate_->OnNativeWidgetActivationChanged(false);
if (IsVisible() && GetWidget()->non_client_view())
GetWidget()->non_client_view()->SchedulePaint();
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index b186728..42f704c 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -365,7 +365,6 @@ void Widget::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
if (!is_add) {
if (child == dragged_view_)
dragged_view_ = NULL;
-
FocusManager* focus_manager = GetFocusManager();
if (focus_manager)
focus_manager->ViewRemoved(child);
@@ -895,6 +894,10 @@ void Widget::OnNativeWidgetCreated() {
}
void Widget::OnNativeWidgetDestroying() {
+ // Tell the focus manager (if any) that root_view is being removed
+ // in case that the focused view is under this root view.
+ if (GetFocusManager())
+ GetFocusManager()->ViewRemoved(root_view_.get());
FOR_EACH_OBSERVER(Observer, observers_, OnWidgetClosing(this));
if (non_client_view_)
non_client_view_->WindowClosing();