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/workspace/workspace_cycler_animator.h" | 5 #include "ash/wm/workspace/workspace_cycler_animator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
11 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
12 #include "ash/screen_ash.h" | 12 #include "ash/screen_ash.h" |
| 13 #include "ash/shelf/shelf_layout_manager.h" |
| 14 #include "ash/shelf/shelf_widget.h" |
13 #include "ash/shell_window_ids.h" | 15 #include "ash/shell_window_ids.h" |
14 #include "ash/wm/property_util.h" | 16 #include "ash/wm/property_util.h" |
15 #include "ash/wm/shelf_layout_manager.h" | |
16 #include "ash/wm/workspace/colored_window_controller.h" | 17 #include "ash/wm/workspace/colored_window_controller.h" |
17 #include "ash/wm/workspace/workspace.h" | 18 #include "ash/wm/workspace/workspace.h" |
18 #include "ash/wm/workspace/workspace_cycler_configuration.h" | 19 #include "ash/wm/workspace/workspace_cycler_configuration.h" |
19 #include "base/values.h" | 20 #include "base/values.h" |
20 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
21 #include "ui/base/events/event_utils.h" | 22 #include "ui/base/events/event_utils.h" |
22 #include "ui/compositor/layer_animator.h" | 23 #include "ui/compositor/layer_animator.h" |
23 #include "ui/compositor/scoped_layer_animation_settings.h" | 24 #include "ui/compositor/scoped_layer_animation_settings.h" |
24 #include "ui/gfx/transform_util.h" | 25 #include "ui/gfx/transform_util.h" |
25 #include "ui/views/widget/widget.h" | 26 #include "ui/views/widget/widget.h" |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 double change) const { | 654 double change) const { |
654 double ratio = Config::GetDouble( | 655 double ratio = Config::GetDouble( |
655 Config::CYCLER_STEP_ANIMATION_DURATION_RATIO); | 656 Config::CYCLER_STEP_ANIMATION_DURATION_RATIO); |
656 return static_cast<int>(fabs(change) * ratio); | 657 return static_cast<int>(fabs(change) * ratio); |
657 } | 658 } |
658 | 659 |
659 void WorkspaceCyclerAnimator::CreateLauncherBackground() { | 660 void WorkspaceCyclerAnimator::CreateLauncherBackground() { |
660 if (screen_bounds_ == maximized_bounds_) | 661 if (screen_bounds_ == maximized_bounds_) |
661 return; | 662 return; |
662 | 663 |
663 aura::Window* random_workspace_window = workspaces_[0]->window(); | |
664 ash::Launcher* launcher = ash::Launcher::ForWindow(random_workspace_window); | |
665 aura::Window* launcher_window = launcher->widget()->GetNativeWindow(); | |
666 | |
667 // TODO(pkotwicz): Figure out what to do when the launcher visible state is | 664 // TODO(pkotwicz): Figure out what to do when the launcher visible state is |
668 // SHELF_AUTO_HIDE. | 665 // SHELF_AUTO_HIDE. |
669 ShelfLayoutManager* shelf_layout_manager = | 666 ShelfLayoutManager* shelf_layout_manager = |
670 ShelfLayoutManager::ForLauncher(launcher_window); | 667 ShelfLayoutManager::ForLauncher(workspaces_[0]->window()); |
671 if (!shelf_layout_manager->IsVisible()) | 668 if (!shelf_layout_manager->IsVisible()) |
672 return; | 669 return; |
673 | 670 |
| 671 aura::Window* launcher_window = shelf_layout_manager->shelf_widget()-> |
| 672 GetNativeWindow(); |
| 673 |
674 gfx::Rect shelf_bounds = shelf_layout_manager->GetIdealBounds(); | 674 gfx::Rect shelf_bounds = shelf_layout_manager->GetIdealBounds(); |
675 | 675 |
676 launcher_background_controller_.reset(new ColoredWindowController( | 676 launcher_background_controller_.reset(new ColoredWindowController( |
677 launcher_window->parent(), "LauncherBackground")); | 677 launcher_window->parent(), "LauncherBackground")); |
678 launcher_background_controller_->SetColor(SK_ColorBLACK); | 678 launcher_background_controller_->SetColor(SK_ColorBLACK); |
679 aura::Window* tint_window = | 679 aura::Window* tint_window = |
680 launcher_background_controller_->GetWidget()->GetNativeWindow(); | 680 launcher_background_controller_->GetWidget()->GetNativeWindow(); |
681 tint_window->SetBounds(shelf_bounds); | 681 tint_window->SetBounds(shelf_bounds); |
682 launcher_window->parent()->StackChildBelow(tint_window, launcher_window); | 682 launcher_window->parent()->StackChildBelow(tint_window, launcher_window); |
683 tint_window->Show(); | 683 tint_window->Show(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 MessageLoopForUI::current()->PostTask( | 717 MessageLoopForUI::current()->PostTask( |
718 FROM_HERE, | 718 FROM_HERE, |
719 base::Bind(&WorkspaceCyclerAnimator::NotifyDelegate, | 719 base::Bind(&WorkspaceCyclerAnimator::NotifyDelegate, |
720 AsWeakPtr(), | 720 AsWeakPtr(), |
721 completed_animation)); | 721 completed_animation)); |
722 } | 722 } |
723 } | 723 } |
724 | 724 |
725 } // namespace internal | 725 } // namespace internal |
726 } // namespace ash | 726 } // namespace ash |
OLD | NEW |