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

Unified Diff: services/ui/ws/modal_window_controller.cc

Issue 2710023007: Make WindowTree::SetModal() take the type. (Closed)
Patch Set: Don't check for system modal when AddTransientWindow(). Created 3 years, 9 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: services/ui/ws/modal_window_controller.cc
diff --git a/services/ui/ws/modal_window_controller.cc b/services/ui/ws/modal_window_controller.cc
index a07dc1f420ce93bdd92192f534ee0d063dc4b00c..bb1c0bf135a439d22aecf86635158699c44e69a7 100644
--- a/services/ui/ws/modal_window_controller.cc
+++ b/services/ui/ws/modal_window_controller.cc
@@ -18,7 +18,8 @@ const ServerWindow* GetModalChildForWindowAncestor(const ServerWindow* window) {
for (const ServerWindow* ancestor = window; ancestor;
ancestor = ancestor->parent()) {
for (auto* transient_child : ancestor->transient_children()) {
- if (transient_child->is_modal() && transient_child->IsDrawn())
+ if (transient_child->modal_type() != MODAL_TYPE_NONE &&
+ transient_child->IsDrawn())
return transient_child;
}
}
@@ -48,7 +49,7 @@ void ModalWindowController::AddSystemModalWindow(ServerWindow* window) {
DCHECK(window);
DCHECK(!base::ContainsValue(system_modal_windows_, window));
- window->SetModal();
+ window->SetModalType(ui::MODAL_TYPE_SYSTEM);
system_modal_windows_.push_back(window);
window_drawn_trackers_.insert(make_pair(
window, base::MakeUnique<ServerWindowDrawnTracker>(window, this)));
@@ -62,8 +63,10 @@ bool ModalWindowController::IsWindowBlockedBy(
const ServerWindow* modal_window) const {
DCHECK(window);
DCHECK(modal_window);
- if (!modal_window->is_modal() || !modal_window->IsDrawn())
+ if (modal_window->modal_type() == MODAL_TYPE_NONE ||
+ !modal_window->IsDrawn()) {
return false;
+ }
if (modal_window->transient_parent() &&
!modal_window->transient_parent()->Contains(window)) {
@@ -80,6 +83,8 @@ bool ModalWindowController::IsWindowBlocked(const ServerWindow* window) const {
const ServerWindow* ModalWindowController::GetTargetForWindow(
const ServerWindow* window) const {
+ // TODO(moshayedi): crbug.com/697127. Handle windows which are modal to
+ // children of their transient parent.
ServerWindow* system_modal_window = GetActiveSystemModalWindow();
if (system_modal_window)
return system_modal_window;

Powered by Google App Engine
This is Rietveld 408576698