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

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: based on comments Created 4 years, 2 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 | « ui/views/view_targeter_unittest.cc ('k') | ui/views/widget/native_widget_aura_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 bcfb221c4e3ff65c55cabd9df7b0dd5dfa37eda9..6c4ce6835b2acfb1b52fae2e6a4a34fd07ca3422 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -350,12 +350,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
« no previous file with comments | « ui/views/view_targeter_unittest.cc ('k') | ui/views/widget/native_widget_aura_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698