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

Unified Diff: components/mus/ws/server_window.cc

Issue 1818333002: Reland: mus: Enable system modal windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased after fixing the crash Created 4 years, 7 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 | « components/mus/ws/server_window.h ('k') | components/mus/ws/test_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/ws/server_window.cc
diff --git a/components/mus/ws/server_window.cc b/components/mus/ws/server_window.cc
index d64d10c77ca379a1486aa69e212fb87cb298e9dc..e1c7d2c8c4c9f6175f7ff870dabcf2959c31f954 100644
--- a/components/mus/ws/server_window.cc
+++ b/components/mus/ws/server_window.cc
@@ -18,28 +18,6 @@ namespace mus {
namespace ws {
-namespace {
-
-const ServerWindow* GetModalChildForWindowAncestor(const ServerWindow* window) {
- for (const ServerWindow* ancestor = window; ancestor;
- ancestor = ancestor->parent()) {
- for (const auto& transient_child : ancestor->transient_children()) {
- if (transient_child->is_modal() && transient_child->IsDrawn())
- return transient_child;
- }
- }
- return nullptr;
-}
-
-const ServerWindow* GetModalTargetForWindow(const ServerWindow* window) {
- const ServerWindow* modal_window = GetModalChildForWindowAncestor(window);
- if (!modal_window)
- return window;
- return GetModalTargetForWindow(modal_window);
-}
-
-} // namespace
-
ServerWindow::ServerWindow(ServerWindowDelegate* delegate, const WindowId& id)
: ServerWindow(delegate, id, Properties()) {}
@@ -229,7 +207,11 @@ ServerWindow* ServerWindow::GetChildWindow(const WindowId& window_id) {
return nullptr;
}
-void ServerWindow::AddTransientWindow(ServerWindow* child) {
+bool ServerWindow::AddTransientWindow(ServerWindow* child) {
+ // A system modal window cannot become a transient child.
+ if (child->is_modal() && !child->transient_parent())
+ return false;
+
if (child->transient_parent())
child->transient_parent()->RemoveTransientWindow(child);
@@ -245,6 +227,7 @@ void ServerWindow::AddTransientWindow(ServerWindow* child) {
FOR_EACH_OBSERVER(ServerWindowObserver, observers_,
OnTransientWindowAdded(this, child));
+ return true;
}
void ServerWindow::RemoveTransientWindow(ServerWindow* child) {
@@ -269,14 +252,6 @@ void ServerWindow::SetModal() {
is_modal_ = true;
}
-bool ServerWindow::IsBlockedByModalWindow() const {
- return !!GetModalChildForWindowAncestor(this);
-}
-
-const ServerWindow* ServerWindow::GetModalTarget() const {
- return GetModalTargetForWindow(this);
-}
-
bool ServerWindow::Contains(const ServerWindow* window) const {
for (const ServerWindow* parent = window; parent; parent = parent->parent_) {
if (parent == this)
« no previous file with comments | « components/mus/ws/server_window.h ('k') | components/mus/ws/test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698