OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/wm/window_util.h" | 5 #include "ash/wm/window_util.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 bounds->set_y(min_height - bounds->height()); | 93 bounds->set_y(min_height - bounds->height()); |
94 } | 94 } |
95 if (bounds->y() < 0) | 95 if (bounds->y() < 0) |
96 bounds->set_y(0); | 96 bounds->set_y(0); |
97 } | 97 } |
98 | 98 |
99 bool MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) { | 99 bool MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) { |
100 views::View* target = static_cast<views::View*>(event.target()); | 100 views::View* target = static_cast<views::View*>(event.target()); |
101 if (!target) | 101 if (!target) |
102 return false; | 102 return false; |
103 aura::RootWindow* target_root = | 103 aura::Window* target_root = |
104 target->GetWidget()->GetNativeView()->GetRootWindow(); | 104 target->GetWidget()->GetNativeView()->GetRootWindow(); |
105 if (!target_root || target_root == window->GetRootWindow()) | 105 if (!target_root || target_root == window->GetRootWindow()) |
106 return false; | 106 return false; |
107 aura::Window* window_container = | 107 aura::Window* window_container = |
108 ash::Shell::GetContainer(target_root, window->parent()->id()); | 108 ash::Shell::GetContainer(target_root, window->parent()->id()); |
109 // Move the window to the target launcher. | 109 // Move the window to the target launcher. |
110 window_container->AddChild(window); | 110 window_container->AddChild(window); |
111 return true; | 111 return true; |
112 } | 112 } |
113 | 113 |
114 void ReparentChildWithTransientChildren(aura::Window* window, | 114 void ReparentChildWithTransientChildren(aura::Window* window, |
115 aura::Window* child) { | 115 aura::Window* child) { |
116 window->AddChild(child); | 116 window->AddChild(child); |
117 ReparentTransientChildrenOfChild(window, child); | 117 ReparentTransientChildrenOfChild(window, child); |
118 } | 118 } |
119 | 119 |
120 void ReparentTransientChildrenOfChild(aura::Window* window, | 120 void ReparentTransientChildrenOfChild(aura::Window* window, |
121 aura::Window* child) { | 121 aura::Window* child) { |
122 for (size_t i = 0; i < child->transient_children().size(); ++i) | 122 for (size_t i = 0; i < child->transient_children().size(); ++i) |
123 ReparentChildWithTransientChildren(window, child->transient_children()[i]); | 123 ReparentChildWithTransientChildren(window, child->transient_children()[i]); |
124 } | 124 } |
125 | 125 |
126 } // namespace wm | 126 } // namespace wm |
127 } // namespace ash | 127 } // namespace ash |
OLD | NEW |