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

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

Issue 2371113003: Do not give instant focus if a view's toplevelwidget is not active (Closed)
Patch Set: new patch Created 4 years, 3 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
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 935a0f70b6bc31581a1029188e59b8215ce7dc58..a7578ae642fe91c354b33dfdd3eb2c6e82271bd0 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -368,12 +368,14 @@ void DesktopNativeWidgetAura::HandleActivationChanged(bool active) {
// This function can be called before the focus manager has had a
// chance to set the focused view. In which case we should get the
// last focused view.
- View* view_for_activation =
- GetWidget()->GetFocusManager()->GetFocusedView() ?
- GetWidget()->GetFocusManager()->GetFocusedView() :
- GetWidget()->GetFocusManager()->GetStoredFocusView();
+ views::FocusManager* focus_manager = GetWidget()->GetFocusManager();
+ View* view_for_activation = focus_manager->GetFocusedView()
+ ? focus_manager->GetFocusedView()
+ : focus_manager->GetStoredFocusView();
if (!view_for_activation)
view_for_activation = GetWidget()->GetRootView();
+ else if (view_for_activation == focus_manager->GetStoredFocusView())
+ focus_manager->RestoreFocusedView();
activation_client->ActivateWindow(
view_for_activation->GetWidget()->GetNativeView());
// Refreshes the focus info to IMF in case that IMF cached the old info

Powered by Google App Engine
This is Rietveld 408576698