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

Side by Side Diff: components/mus/common/transient_window_utils.h

Issue 1527183003: Change mojo enums to be scoped enums in the generated C++ bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-binding-equals
Patch Set: rebase Created 4 years, 11 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 unified diff | Download patch
OLDNEW
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 COMPONENTS_MUS_COMMON_TRANSIENT_WINDOW_UTILS_H_
6 #define COMPONENTS_MUS_COMMON_TRANSIENT_WINDOW_UTILS_H_ 6 #define COMPONENTS_MUS_COMMON_TRANSIENT_WINDOW_UTILS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 T* stacking_target) { 71 T* stacking_target) {
72 if (stacking_target == *target) 72 if (stacking_target == *target)
73 return true; 73 return true;
74 74
75 // For windows that have transient children stack the transient ancestors that 75 // For windows that have transient children stack the transient ancestors that
76 // are siblings. This prevents one transient group from being inserted in the 76 // are siblings. This prevents one transient group from being inserted in the
77 // middle of another. 77 // middle of another.
78 FindCommonTransientAncestor(child, target); 78 FindCommonTransientAncestor(child, target);
79 79
80 // When stacking above skip to the topmost transient descendant of the target. 80 // When stacking above skip to the topmost transient descendant of the target.
81 if (*direction == mojom::ORDER_DIRECTION_ABOVE && 81 if (*direction == mojom::OrderDirection::ABOVE &&
82 !HasTransientAncestor(*child, *target)) { 82 !HasTransientAncestor(*child, *target)) {
83 const std::vector<T*>& siblings((*child)->parent()->children()); 83 const std::vector<T*>& siblings((*child)->parent()->children());
84 size_t target_i = 84 size_t target_i =
85 std::find(siblings.begin(), siblings.end(), *target) - siblings.begin(); 85 std::find(siblings.begin(), siblings.end(), *target) - siblings.begin();
86 while (target_i + 1 < siblings.size() && 86 while (target_i + 1 < siblings.size() &&
87 HasTransientAncestor(siblings[target_i + 1], *target)) { 87 HasTransientAncestor(siblings[target_i + 1], *target)) {
88 ++target_i; 88 ++target_i;
89 } 89 }
90 *target = siblings[target_i]; 90 *target = siblings[target_i];
91 } 91 }
(...skipping 17 matching lines...) Expand all
109 return; 109 return;
110 110
111 // stack any transient children that share the same parent to be in front of 111 // stack any transient children that share the same parent to be in front of
112 // |window_|. the existing stacking order is preserved by iterating backwards 112 // |window_|. the existing stacking order is preserved by iterating backwards
113 // and always stacking on top. 113 // and always stacking on top.
114 std::vector<T*> children(parent->children()); 114 std::vector<T*> children(parent->children());
115 for (auto it = children.rbegin(); it != children.rend(); ++it) { 115 for (auto it = children.rbegin(); it != children.rend(); ++it) {
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::ORDER_DIRECTION_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 // COMPONENTS_MUS_COMMON_TRANSIENT_WINDOW_UTILS_H_
OLDNEW
« no previous file with comments | « components/html_viewer/web_socket_handle_impl.cc ('k') | components/mus/public/cpp/event_matcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698