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

Unified Diff: ui/wm/core/focus_controller.cc

Issue 2172363002: Created min size for print preview dialog and modified to allow the Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix mac build error 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/wm/core/focus_controller.cc
diff --git a/ui/wm/core/focus_controller.cc b/ui/wm/core/focus_controller.cc
index e1b644dccc75d72e6dd86b3849956e0d190dfdf5..2e442cd56fbe1e4e6aabd4946ccecef9d1885cee 100644
--- a/ui/wm/core/focus_controller.cc
+++ b/ui/wm/core/focus_controller.cc
@@ -12,6 +12,7 @@
#include "ui/aura/window_tracker.h"
#include "ui/events/event.h"
#include "ui/wm/core/focus_rules.h"
+#include "ui/wm/core/window_modality_controller.h"
#include "ui/wm/core/window_util.h"
#include "ui/wm/public/activation_change_observer.h"
@@ -189,7 +190,11 @@ void FocusController::FocusAndActivateWindow(
if (window &&
(window->Contains(focused_window_) || window->Contains(active_window_))) {
StackActiveWindow();
- return;
+ if (HasWindowModalTransient(window) && active_window_ == window)
+ // Trying to reactivate the window, need to activate the transient first
+ ActivateWindow(HasWindowModalTransient(window));
+ else
+ return;
}
// Focusing a window also activates its containing activatable window. Note
@@ -214,6 +219,13 @@ void FocusController::FocusAndActivateWindow(
// If the window's ActivationChangeObserver shifted focus to a valid window,
// we don't want to focus the window we thought would be focused by default.
bool activation_changed_focus = last_focused_window != focused_window_;
+ if ((!updating_focus_ && (!activation_changed_focus || !focused_window_)) &&
+ active_window_ && focusable &&
+ !active_window_->Contains(focusable) &&
+ (HasWindowModalTransient(active_window_) ==
+ GetToplevelWindow(window))){
+ return;
+ }
if (!updating_focus_ && (!activation_changed_focus || !focused_window_)) {
if (active_window_ && focusable)
DCHECK(active_window_->Contains(focusable));
@@ -271,7 +283,7 @@ void FocusController::SetActiveWindow(
if (updating_activation_)
return;
- if (window == active_window_) {
+ if (window == active_window_ && !HasWindowModalTransient(window)) {
if (requested_window) {
FOR_EACH_OBSERVER(aura::client::ActivationChangeObserver,
activation_observers_,

Powered by Google App Engine
This is Rietveld 408576698