OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef COMPONENTS_MUS_COMMON_TRANSIENT_WINDOW_UTILS_H_ | 5 #ifndef SERVICES_UI_COMMON_TRANSIENT_WINDOW_UTILS_H_ |
6 #define COMPONENTS_MUS_COMMON_TRANSIENT_WINDOW_UTILS_H_ | 6 #define SERVICES_UI_COMMON_TRANSIENT_WINDOW_UTILS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "components/mus/public/interfaces/mus_constants.mojom.h" | 12 #include "services/ui/public/interfaces/mus_constants.mojom.h" |
13 | 13 |
14 namespace mus { | 14 namespace mus { |
15 | 15 |
16 // Returns true if |window| has |ancestor| as a transient ancestor. A transient | 16 // Returns true if |window| has |ancestor| as a transient ancestor. A transient |
17 // ancestor is found by following the transient parent chain of the window. | 17 // ancestor is found by following the transient parent chain of the window. |
18 template <class T> | 18 template <class T> |
19 bool HasTransientAncestor(const T* window, const T* ancestor) { | 19 bool HasTransientAncestor(const T* window, const T* ancestor) { |
20 const T* transient_parent = window->transient_parent(); | 20 const T* transient_parent = window->transient_parent(); |
21 if (transient_parent == ancestor) | 21 if (transient_parent == ancestor) |
22 return true; | 22 return true; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 if ((*it) != window && HasTransientAncestor(*it, window)) { | 116 if ((*it) != window && HasTransientAncestor(*it, window)) { |
117 T* old_stacking_target = *GetStackingTarget(*it); | 117 T* old_stacking_target = *GetStackingTarget(*it); |
118 *GetStackingTarget(*it) = window; | 118 *GetStackingTarget(*it) = window; |
119 Reorder(*it, window, mojom::OrderDirection::ABOVE); | 119 Reorder(*it, window, mojom::OrderDirection::ABOVE); |
120 *GetStackingTarget(*it) = old_stacking_target; | 120 *GetStackingTarget(*it) = old_stacking_target; |
121 } | 121 } |
122 } | 122 } |
123 } | 123 } |
124 } // namespace mus | 124 } // namespace mus |
125 | 125 |
126 #endif // COMPONENTS_MUS_COMMON_TRANSIENT_WINDOW_UTILS_H_ | 126 #endif // SERVICES_UI_COMMON_TRANSIENT_WINDOW_UTILS_H_ |
OLD | NEW |