OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/overview/scoped_transform_overview_window.h" | 5 #include "ash/wm/overview/scoped_transform_overview_window.h" |
6 | 6 |
7 #include "ash/screen_ash.h" | 7 #include "ash/screen_ash.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/wm/overview/scoped_window_copy.h" | 9 #include "ash/wm/overview/scoped_window_copy.h" |
10 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
11 #include "ui/aura/client/aura_constants.h" | 11 #include "ui/aura/client/aura_constants.h" |
12 #include "ui/aura/client/screen_position_client.h" | 12 #include "ui/aura/client/screen_position_client.h" |
13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
14 #include "ui/compositor/scoped_layer_animation_settings.h" | 14 #include "ui/compositor/scoped_layer_animation_settings.h" |
15 #include "ui/gfx/animation/tween.h" | 15 #include "ui/gfx/animation/tween.h" |
16 #include "ui/views/corewm/window_animations.h" | 16 #include "ui/views/corewm/window_animations.h" |
| 17 #include "ui/views/corewm/window_util.h" |
17 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
18 | 19 |
19 namespace ash { | 20 namespace ash { |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 // The animation settings used for window selector animations. | 24 // The animation settings used for window selector animations. |
24 class WindowSelectorAnimationSettings | 25 class WindowSelectorAnimationSettings |
25 : public ui::ScopedLayerAnimationSettings { | 26 : public ui::ScopedLayerAnimationSettings { |
26 public: | 27 public: |
(...skipping 29 matching lines...) Expand all Loading... |
56 result.Translate(new_origin.x(), new_origin.y()); | 57 result.Translate(new_origin.x(), new_origin.y()); |
57 return result; | 58 return result; |
58 } | 59 } |
59 | 60 |
60 void SetTransformOnWindowAndAllTransientChildren( | 61 void SetTransformOnWindowAndAllTransientChildren( |
61 aura::Window* window, | 62 aura::Window* window, |
62 const gfx::Transform& transform, | 63 const gfx::Transform& transform, |
63 bool animate) { | 64 bool animate) { |
64 SetTransformOnWindow(window, transform, animate); | 65 SetTransformOnWindow(window, transform, animate); |
65 | 66 |
66 aura::Window::Windows transient_children = window->transient_children(); | 67 aura::Window::Windows transient_children = |
| 68 views::corewm::GetTransientChildren(window); |
67 for (aura::Window::Windows::iterator iter = transient_children.begin(); | 69 for (aura::Window::Windows::iterator iter = transient_children.begin(); |
68 iter != transient_children.end(); ++iter) { | 70 iter != transient_children.end(); ++iter) { |
69 aura::Window* transient_child = *iter; | 71 aura::Window* transient_child = *iter; |
70 gfx::Rect window_bounds = window->bounds(); | 72 gfx::Rect window_bounds = window->bounds(); |
71 gfx::Rect child_bounds = transient_child->bounds(); | 73 gfx::Rect child_bounds = transient_child->bounds(); |
72 gfx::Transform transient_window_transform( | 74 gfx::Transform transient_window_transform( |
73 TranslateTransformOrigin(child_bounds.origin() - window_bounds.origin(), | 75 TranslateTransformOrigin(child_bounds.origin() - window_bounds.origin(), |
74 transform)); | 76 transform)); |
75 SetTransformOnWindow(transient_child, transient_window_transform, animate); | 77 SetTransformOnWindow(transient_child, transient_window_transform, animate); |
76 } | 78 } |
77 } | 79 } |
78 | 80 |
79 aura::Window* GetModalTransientParent(aura::Window* window) { | 81 aura::Window* GetModalTransientParent(aura::Window* window) { |
80 if (window->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_WINDOW) | 82 if (window->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_WINDOW) |
81 return window->transient_parent(); | 83 return views::corewm::GetTransientParent(window); |
82 return NULL; | 84 return NULL; |
83 } | 85 } |
84 | 86 |
85 } // namespace | 87 } // namespace |
86 | 88 |
87 const int ScopedTransformOverviewWindow::kTransitionMilliseconds = 200; | 89 const int ScopedTransformOverviewWindow::kTransitionMilliseconds = 200; |
88 | 90 |
89 ScopedTransformOverviewWindow::ScopedTransformOverviewWindow( | 91 ScopedTransformOverviewWindow::ScopedTransformOverviewWindow( |
90 aura::Window* window) | 92 aura::Window* window) |
91 : window_(window), | 93 : window_(window), |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 if (modal_parent) | 232 if (modal_parent) |
231 CopyWindowAndTransientParents(target_root, modal_parent); | 233 CopyWindowAndTransientParents(target_root, modal_parent); |
232 window_copies_.push_back(new ScopedWindowCopy(target_root, window)); | 234 window_copies_.push_back(new ScopedWindowCopy(target_root, window)); |
233 } | 235 } |
234 | 236 |
235 void ScopedTransformOverviewWindow::SetTransformOnWindowAndTransientChildren( | 237 void ScopedTransformOverviewWindow::SetTransformOnWindowAndTransientChildren( |
236 const gfx::Transform& transform, | 238 const gfx::Transform& transform, |
237 bool animate) { | 239 bool animate) { |
238 gfx::Point origin(GetBoundsInScreen().origin()); | 240 gfx::Point origin(GetBoundsInScreen().origin()); |
239 aura::Window* window = window_; | 241 aura::Window* window = window_; |
240 while (window->transient_parent()) | 242 while (views::corewm::GetTransientParent(window)) |
241 window = window->transient_parent(); | 243 window = views::corewm::GetTransientParent(window); |
242 for (ScopedVector<ScopedWindowCopy>::const_iterator iter = | 244 for (ScopedVector<ScopedWindowCopy>::const_iterator iter = |
243 window_copies_.begin(); iter != window_copies_.end(); ++iter) { | 245 window_copies_.begin(); iter != window_copies_.end(); ++iter) { |
244 SetTransformOnWindow( | 246 SetTransformOnWindow( |
245 (*iter)->GetWindow(), | 247 (*iter)->GetWindow(), |
246 TranslateTransformOrigin(ScreenAsh::ConvertRectToScreen( | 248 TranslateTransformOrigin(ScreenAsh::ConvertRectToScreen( |
247 (*iter)->GetWindow()->parent(), | 249 (*iter)->GetWindow()->parent(), |
248 (*iter)->GetWindow()->GetTargetBounds()).origin() - origin, | 250 (*iter)->GetWindow()->GetTargetBounds()).origin() - origin, |
249 transform), | 251 transform), |
250 animate); | 252 animate); |
251 } | 253 } |
252 SetTransformOnWindowAndAllTransientChildren( | 254 SetTransformOnWindowAndAllTransientChildren( |
253 window, | 255 window, |
254 TranslateTransformOrigin(ScreenAsh::ConvertRectToScreen( | 256 TranslateTransformOrigin(ScreenAsh::ConvertRectToScreen( |
255 window->parent(), window->GetTargetBounds()).origin() - origin, | 257 window->parent(), window->GetTargetBounds()).origin() - origin, |
256 transform), | 258 transform), |
257 animate); | 259 animate); |
258 } | 260 } |
259 | 261 |
260 void ScopedTransformOverviewWindow::PrepareForOverview() { | 262 void ScopedTransformOverviewWindow::PrepareForOverview() { |
261 DCHECK(!overview_started_); | 263 DCHECK(!overview_started_); |
262 overview_started_ = true; | 264 overview_started_ = true; |
263 ash::wm::GetWindowState(window_)->set_ignored_by_shelf(true); | 265 ash::wm::GetWindowState(window_)->set_ignored_by_shelf(true); |
264 RestoreWindow(); | 266 RestoreWindow(); |
265 } | 267 } |
266 | 268 |
267 } // namespace ash | 269 } // namespace ash |
OLD | NEW |