Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Unified Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 2919973002: desktop_aura: do not restore focused view if it has modal transient child (Closed)
Patch Set: added test coverage Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/widget/widget_interactive_uitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
index b1f2574c975d26540f8bf072b1f11d50cbbe2050..09c44eec03c0f3295592dc7c3d4ba2133b12ab6a 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -364,11 +364,18 @@ void DesktopNativeWidgetAura::HandleActivationChanged(bool active) {
if (!view_for_activation) {
view_for_activation = GetWidget()->GetRootView();
} else if (view_for_activation == focus_manager->GetStoredFocusView()) {
- focus_manager->RestoreFocusedView();
- // Set to false if desktop native widget has activated activation
- // change, so that aura window activation change focus restore operation
- // can be ignored.
- restore_focus_on_activate_ = false;
+ // When desktop native widget has modal transient child, we don't
+ // restore focused view here, as the modal transient child window will
+ // get activated and focused. Thus, we are not left with multiple
+ // focuses. For aura child widgets, since their views are managed by
+ // |focus_manager|, we then allow restoring focused view.
+ if (!wm::GetModalTransient(GetWidget()->GetNativeView())) {
+ focus_manager->RestoreFocusedView();
+ // Set to false if desktop native widget has activated activation
+ // change, so that aura window activation change focus restore
+ // operation can be ignored.
+ restore_focus_on_activate_ = false;
+ }
}
activation_client->ActivateWindow(
view_for_activation->GetWidget()->GetNativeView());
« no previous file with comments | « no previous file | ui/views/widget/widget_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698