OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/mus/ws/server_window.h" | 5 #include "components/mus/ws/server_window.h" |
6 | 6 |
7 #include <inttypes.h> | 7 #include <inttypes.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 for (ServerWindow* child : children_) { | 222 for (ServerWindow* child : children_) { |
223 ServerWindow* window = child->GetChildWindow(window_id); | 223 ServerWindow* window = child->GetChildWindow(window_id); |
224 if (window) | 224 if (window) |
225 return window; | 225 return window; |
226 } | 226 } |
227 | 227 |
228 return nullptr; | 228 return nullptr; |
229 } | 229 } |
230 | 230 |
231 void ServerWindow::AddTransientWindow(ServerWindow* child) { | 231 void ServerWindow::AddTransientWindow(ServerWindow* child) { |
| 232 // A system modal window cannot become a transient child. |
| 233 DCHECK(!child->is_modal() || child->transient_parent()); |
| 234 |
232 if (child->transient_parent()) | 235 if (child->transient_parent()) |
233 child->transient_parent()->RemoveTransientWindow(child); | 236 child->transient_parent()->RemoveTransientWindow(child); |
234 | 237 |
235 DCHECK(std::find(transient_children_.begin(), transient_children_.end(), | 238 DCHECK(std::find(transient_children_.begin(), transient_children_.end(), |
236 child) == transient_children_.end()); | 239 child) == transient_children_.end()); |
237 transient_children_.push_back(child); | 240 transient_children_.push_back(child); |
238 child->transient_parent_ = this; | 241 child->transient_parent_ = this; |
239 | 242 |
240 // Restack |child| properly above its transient parent, if they share the same | 243 // Restack |child| properly above its transient parent, if they share the same |
241 // parent. | 244 // parent. |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 } | 462 } |
460 | 463 |
461 // static | 464 // static |
462 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) { | 465 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) { |
463 return &window->stacking_target_; | 466 return &window->stacking_target_; |
464 } | 467 } |
465 | 468 |
466 } // namespace ws | 469 } // namespace ws |
467 | 470 |
468 } // namespace mus | 471 } // namespace mus |
OLD | NEW |