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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 2921253002: Revert of desktop_aura: do not restore focused view if it has modal transient child (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/widget/widget_interactive_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 // This function can be called before the focus manager has had a 357 // This function can be called before the focus manager has had a
358 // chance to set the focused view. In which case we should get the 358 // chance to set the focused view. In which case we should get the
359 // last focused view. 359 // last focused view.
360 views::FocusManager* focus_manager = GetWidget()->GetFocusManager(); 360 views::FocusManager* focus_manager = GetWidget()->GetFocusManager();
361 View* view_for_activation = focus_manager->GetFocusedView() 361 View* view_for_activation = focus_manager->GetFocusedView()
362 ? focus_manager->GetFocusedView() 362 ? focus_manager->GetFocusedView()
363 : focus_manager->GetStoredFocusView(); 363 : focus_manager->GetStoredFocusView();
364 if (!view_for_activation) { 364 if (!view_for_activation) {
365 view_for_activation = GetWidget()->GetRootView(); 365 view_for_activation = GetWidget()->GetRootView();
366 } else if (view_for_activation == focus_manager->GetStoredFocusView()) { 366 } else if (view_for_activation == focus_manager->GetStoredFocusView()) {
367 // When desktop native widget has modal transient child, we don't 367 focus_manager->RestoreFocusedView();
368 // restore focused view here, as the modal transient child window will 368 // Set to false if desktop native widget has activated activation
369 // get activated and focused. Thus, we are not left with multiple 369 // change, so that aura window activation change focus restore operation
370 // focuses. For aura child widgets, since their views are managed by 370 // can be ignored.
371 // |focus_manager|, we then allow restoring focused view. 371 restore_focus_on_activate_ = false;
372 if (!wm::GetModalTransient(GetWidget()->GetNativeView())) {
373 focus_manager->RestoreFocusedView();
374 // Set to false if desktop native widget has activated activation
375 // change, so that aura window activation change focus restore
376 // operation can be ignored.
377 restore_focus_on_activate_ = false;
378 }
379 } 372 }
380 activation_client->ActivateWindow( 373 activation_client->ActivateWindow(
381 view_for_activation->GetWidget()->GetNativeView()); 374 view_for_activation->GetWidget()->GetNativeView());
382 // Refreshes the focus info to IMF in case that IMF cached the old info 375 // Refreshes the focus info to IMF in case that IMF cached the old info
383 // about focused text input client when it was "inactive". 376 // about focused text input client when it was "inactive".
384 GetInputMethod()->OnFocus(); 377 GetInputMethod()->OnFocus();
385 } 378 }
386 } else { 379 } else {
387 // If we're not active we need to deactivate the corresponding 380 // If we're not active we need to deactivate the corresponding
388 // aura::Window. This way if a child widget is active it gets correctly 381 // aura::Window. This way if a child widget is active it gets correctly
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 if (cursor_reference_count_ == 0) { 1205 if (cursor_reference_count_ == 0) {
1213 // We are the last DesktopNativeWidgetAura instance, and we are responsible 1206 // We are the last DesktopNativeWidgetAura instance, and we are responsible
1214 // for cleaning up |cursor_manager_|. 1207 // for cleaning up |cursor_manager_|.
1215 delete cursor_manager_; 1208 delete cursor_manager_;
1216 native_cursor_manager_ = NULL; 1209 native_cursor_manager_ = NULL;
1217 cursor_manager_ = NULL; 1210 cursor_manager_ = NULL;
1218 } 1211 }
1219 } 1212 }
1220 1213
1221 } // namespace views 1214 } // namespace views
OLDNEW
« 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