OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura_shell/shell.h" | 5 #include "ui/aura_shell/shell.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ui/aura/desktop.h" | 8 #include "ui/aura/desktop.h" |
9 #include "ui/aura/screen_aura.h" | 9 #include "ui/aura/screen_aura.h" |
10 #include "ui/aura/toplevel_window_container.h" | 10 #include "ui/aura/toplevel_window_container.h" |
11 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
12 #include "ui/aura/window_types.h" | 12 #include "ui/aura/window_types.h" |
13 #include "ui/aura_shell/default_container_layout_manager.h" | 13 #include "ui/aura_shell/default_container_layout_manager.h" |
14 #include "ui/aura_shell/desktop_layout_manager.h" | 14 #include "ui/aura_shell/desktop_layout_manager.h" |
15 #include "ui/aura_shell/launcher/launcher.h" | 15 #include "ui/aura_shell/launcher/launcher.h" |
16 #include "ui/aura_shell/shell_delegate.h" | 16 #include "ui/aura_shell/shell_delegate.h" |
17 #include "ui/aura_shell/shell_factory.h" | 17 #include "ui/aura_shell/shell_factory.h" |
18 #include "ui/aura_shell/shell_window_ids.h" | 18 #include "ui/aura_shell/shell_window_ids.h" |
19 #include "ui/base/view_prop.h" | 19 #include "ui/base/view_prop.h" |
20 #include "ui/gfx/compositor/layer.h" | 20 #include "ui/gfx/compositor/layer.h" |
| 21 #include "ui/gfx/compositor/layer_animator.h" |
21 #include "views/widget/native_widget_aura.h" | 22 #include "views/widget/native_widget_aura.h" |
22 #include "views/widget/widget.h" | 23 #include "views/widget/widget.h" |
23 | 24 |
24 namespace aura_shell { | 25 namespace aura_shell { |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 using views::Widget; | 29 using views::Widget; |
29 | 30 |
30 // Creates each of the special window containers that holds windows of various | 31 // Creates each of the special window containers that holds windows of various |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 std::vector<WindowAndBoundsPair> bounds; | 203 std::vector<WindowAndBoundsPair> bounds; |
203 CalculateWindowBoundsAndScaleForTiling(window_container->bounds().size(), | 204 CalculateWindowBoundsAndScaleForTiling(window_container->bounds().size(), |
204 windows, &x_scale, &y_scale, &bounds); | 205 windows, &x_scale, &y_scale, &bounds); |
205 if (bounds.empty()) | 206 if (bounds.empty()) |
206 return; | 207 return; |
207 ui::Transform transform; | 208 ui::Transform transform; |
208 transform.SetScale(x_scale, y_scale); | 209 transform.SetScale(x_scale, y_scale); |
209 for (size_t i = 0; i < bounds.size(); ++i) { | 210 for (size_t i = 0; i < bounds.size(); ++i) { |
210 to_restore_.push_back( | 211 to_restore_.push_back( |
211 std::make_pair(bounds[i].first, bounds[i].first->bounds())); | 212 std::make_pair(bounds[i].first, bounds[i].first->bounds())); |
212 bounds[i].first->layer()->SetAnimation( | 213 ui::LayerAnimator::TransientSettings settings( |
213 aura::Window::CreateDefaultAnimation()); | 214 bounds[i].first->layer()->GetAnimator()); |
| 215 aura::Window::ApplyDefaultAnimationSettings(&settings); |
214 bounds[i].first->SetBounds(bounds[i].second); | 216 bounds[i].first->SetBounds(bounds[i].second); |
215 bounds[i].first->layer()->SetTransform(transform); | 217 bounds[i].first->layer()->SetTransform(transform); |
216 bounds[i].first->layer()->SetOpacity(0.5f); | 218 bounds[i].first->layer()->SetOpacity(0.5f); |
217 } | 219 } |
218 | 220 |
219 MessageLoop::current()->PostDelayedTask( | 221 MessageLoop::current()->PostDelayedTask( |
220 FROM_HERE, | 222 FROM_HERE, |
221 base::Bind(&Shell::RestoreTiledWindows, method_factory_.GetWeakPtr()), | 223 base::Bind(&Shell::RestoreTiledWindows, method_factory_.GetWeakPtr()), |
222 2000); | 224 2000); |
223 } | 225 } |
224 | 226 |
225 void Shell::RestoreTiledWindows() { | 227 void Shell::RestoreTiledWindows() { |
226 ui::Transform identity_transform; | 228 ui::Transform identity_transform; |
227 for (size_t i = 0; i < to_restore_.size(); ++i) { | 229 for (size_t i = 0; i < to_restore_.size(); ++i) { |
228 to_restore_[i].first->layer()->SetAnimation( | 230 ui::LayerAnimator::TransientSettings settings( |
229 aura::Window::CreateDefaultAnimation()); | 231 to_restore_[i].first->layer()->GetAnimator()); |
| 232 aura::Window::ApplyDefaultAnimationSettings(&settings); |
230 to_restore_[i].first->SetBounds(to_restore_[i].second); | 233 to_restore_[i].first->SetBounds(to_restore_[i].second); |
231 to_restore_[i].first->layer()->SetTransform(identity_transform); | 234 to_restore_[i].first->layer()->SetTransform(identity_transform); |
232 to_restore_[i].first->layer()->SetOpacity(1.0f); | 235 to_restore_[i].first->layer()->SetOpacity(1.0f); |
233 } | 236 } |
234 to_restore_.clear(); | 237 to_restore_.clear(); |
235 } | 238 } |
236 | 239 |
237 //////////////////////////////////////////////////////////////////////////////// | 240 //////////////////////////////////////////////////////////////////////////////// |
238 // Shell, aura::DesktopDelegate implementation: | 241 // Shell, aura::DesktopDelegate implementation: |
239 | 242 |
(...skipping 21 matching lines...) Expand all Loading... |
261 } | 264 } |
262 | 265 |
263 aura::Window* Shell::GetTopmostWindowToActivate(aura::Window* ignore) const { | 266 aura::Window* Shell::GetTopmostWindowToActivate(aura::Window* ignore) const { |
264 const aura::ToplevelWindowContainer* container = | 267 const aura::ToplevelWindowContainer* container = |
265 GetContainer(internal::kShellWindowId_DefaultContainer)-> | 268 GetContainer(internal::kShellWindowId_DefaultContainer)-> |
266 AsToplevelWindowContainer(); | 269 AsToplevelWindowContainer(); |
267 return container->GetTopmostWindowToActivate(ignore); | 270 return container->GetTopmostWindowToActivate(ignore); |
268 } | 271 } |
269 | 272 |
270 } // namespace aura_shell | 273 } // namespace aura_shell |
OLD | NEW |