| 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/window_state.h" | 9 #include "ash/wm/window_state.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| 11 #include "ui/aura/client/screen_position_client.h" | 11 #include "ui/aura/client/screen_position_client.h" |
| 12 #include "ui/aura/root_window.h" | |
| 13 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
| 14 #include "ui/compositor/layer_animation_observer.h" | 13 #include "ui/compositor/layer_animation_observer.h" |
| 15 #include "ui/compositor/scoped_layer_animation_settings.h" | 14 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 16 #include "ui/gfx/display.h" | 15 #include "ui/gfx/display.h" |
| 17 #include "ui/gfx/interpolated_transform.h" | 16 #include "ui/gfx/interpolated_transform.h" |
| 18 #include "ui/gfx/transform_util.h" | 17 #include "ui/gfx/transform_util.h" |
| 19 #include "ui/views/corewm/shadow_types.h" | 18 #include "ui/views/corewm/shadow_types.h" |
| 20 #include "ui/views/corewm/window_animations.h" | 19 #include "ui/views/corewm/window_animations.h" |
| 21 #include "ui/views/corewm/window_util.h" | 20 #include "ui/views/corewm/window_util.h" |
| 22 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 23 | 22 |
| 24 namespace ash { | 23 namespace ash { |
| 25 | 24 |
| 26 namespace { | 25 namespace { |
| 27 | 26 |
| 28 // Creates a copy of |window| with |recreated_layer| in the |target_root|. | 27 // Creates a copy of |window| with |recreated_layer| in the |target_root|. |
| 29 views::Widget* CreateCopyOfWindow(aura::RootWindow* target_root, | 28 views::Widget* CreateCopyOfWindow(aura::Window* target_root, |
| 30 aura::Window* src_window, | 29 aura::Window* src_window, |
| 31 ui::Layer* recreated_layer) { | 30 ui::Layer* recreated_layer) { |
| 32 // Save and remove the transform from the layer to later reapply to both the | 31 // Save and remove the transform from the layer to later reapply to both the |
| 33 // source and newly created copy window. | 32 // source and newly created copy window. |
| 34 gfx::Transform transform = recreated_layer->transform(); | 33 gfx::Transform transform = recreated_layer->transform(); |
| 35 recreated_layer->SetTransform(gfx::Transform()); | 34 recreated_layer->SetTransform(gfx::Transform()); |
| 36 | 35 |
| 37 src_window->SetTransform(transform); | 36 src_window->SetTransform(transform); |
| 38 views::Widget* widget = new views::Widget; | 37 views::Widget* widget = new views::Widget; |
| 39 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 38 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 DCHECK(!dst_rect.IsEmpty()); | 309 DCHECK(!dst_rect.IsEmpty()); |
| 311 gfx::Transform transform; | 310 gfx::Transform transform; |
| 312 transform.Translate(dst_rect.x() - src_rect.x(), | 311 transform.Translate(dst_rect.x() - src_rect.x(), |
| 313 dst_rect.y() - src_rect.y()); | 312 dst_rect.y() - src_rect.y()); |
| 314 transform.Scale(static_cast<float>(dst_rect.width()) / src_rect.width(), | 313 transform.Scale(static_cast<float>(dst_rect.width()) / src_rect.width(), |
| 315 static_cast<float>(dst_rect.height()) / src_rect.height()); | 314 static_cast<float>(dst_rect.height()) / src_rect.height()); |
| 316 return transform; | 315 return transform; |
| 317 } | 316 } |
| 318 | 317 |
| 319 void ScopedTransformOverviewWindow::SetTransform( | 318 void ScopedTransformOverviewWindow::SetTransform( |
| 320 aura::RootWindow* root_window, | 319 aura::Window* root_window, |
| 321 const gfx::Transform& transform, | 320 const gfx::Transform& transform, |
| 322 bool animate) { | 321 bool animate) { |
| 323 DCHECK(overview_started_); | 322 DCHECK(overview_started_); |
| 324 | 323 |
| 325 // If the window bounds have changed and a copy of the window is being | 324 // If the window bounds have changed and a copy of the window is being |
| 326 // shown on another display, forcibly recreate the copy. | 325 // shown on another display, forcibly recreate the copy. |
| 327 if (window_copy_ && window_copy_->GetNativeWindow()->GetBoundsInScreen() != | 326 if (window_copy_ && window_copy_->GetNativeWindow()->GetBoundsInScreen() != |
| 328 window_->GetBoundsInScreen()) { | 327 window_->GetBoundsInScreen()) { |
| 329 DCHECK_NE(window_->GetRootWindow(), root_window); | 328 DCHECK_NE(window_->GetRootWindow(), root_window); |
| 330 // TODO(flackr): If only the position changed and not the size, update the | 329 // TODO(flackr): If only the position changed and not the size, update the |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 } | 370 } |
| 372 | 371 |
| 373 void ScopedTransformOverviewWindow::PrepareForOverview() { | 372 void ScopedTransformOverviewWindow::PrepareForOverview() { |
| 374 DCHECK(!overview_started_); | 373 DCHECK(!overview_started_); |
| 375 overview_started_ = true; | 374 overview_started_ = true; |
| 376 ash::wm::GetWindowState(window_)->set_ignored_by_shelf(true); | 375 ash::wm::GetWindowState(window_)->set_ignored_by_shelf(true); |
| 377 RestoreWindow(); | 376 RestoreWindow(); |
| 378 } | 377 } |
| 379 | 378 |
| 380 } // namespace ash | 379 } // namespace ash |
| OLD | NEW |