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/window_properties.h" | 17 #include "ash/wm/window_properties.h" |
17 #include "ash/wm/workspace/colored_window_controller.h" | 18 #include "ash/wm/workspace/colored_window_controller.h" |
18 #include "ash/wm/workspace/workspace.h" | 19 #include "ash/wm/workspace/workspace.h" |
19 #include "ash/wm/workspace/workspace_cycler_configuration.h" | 20 #include "ash/wm/workspace/workspace_cycler_configuration.h" |
20 #include "base/values.h" | 21 #include "base/values.h" |
21 #include "ui/aura/root_window.h" | 22 #include "ui/aura/root_window.h" |
22 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
23 #include "ui/base/events/event_utils.h" | 24 #include "ui/base/events/event_utils.h" |
24 #include "ui/compositor/layer_animator.h" | 25 #include "ui/compositor/layer_animator.h" |
25 #include "ui/compositor/scoped_layer_animation_settings.h" | 26 #include "ui/compositor/scoped_layer_animation_settings.h" |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 double change) const { | 665 double change) const { |
665 double ratio = Config::GetDouble( | 666 double ratio = Config::GetDouble( |
666 Config::CYCLER_STEP_ANIMATION_DURATION_RATIO); | 667 Config::CYCLER_STEP_ANIMATION_DURATION_RATIO); |
667 return static_cast<int>(fabs(change) * ratio); | 668 return static_cast<int>(fabs(change) * ratio); |
668 } | 669 } |
669 | 670 |
670 void WorkspaceCyclerAnimator::CreateLauncherBackground() { | 671 void WorkspaceCyclerAnimator::CreateLauncherBackground() { |
671 if (screen_bounds_ == maximized_bounds_) | 672 if (screen_bounds_ == maximized_bounds_) |
672 return; | 673 return; |
673 | 674 |
674 aura::Window* random_workspace_window = workspaces_[0]->window(); | |
675 ash::Launcher* launcher = ash::Launcher::ForWindow(random_workspace_window); | |
676 aura::Window* launcher_window = launcher->widget()->GetNativeWindow(); | |
677 | |
678 // TODO(pkotwicz): Figure out what to do when the launcher visible state is | 675 // TODO(pkotwicz): Figure out what to do when the launcher visible state is |
679 // SHELF_AUTO_HIDE. | 676 // SHELF_AUTO_HIDE. |
680 ShelfLayoutManager* shelf_layout_manager = | 677 ShelfLayoutManager* shelf_layout_manager = |
681 ShelfLayoutManager::ForLauncher(launcher_window); | 678 ShelfLayoutManager::ForLauncher(workspaces_[0]->window()); |
682 if (!shelf_layout_manager->IsVisible()) | 679 if (!shelf_layout_manager->IsVisible()) |
683 return; | 680 return; |
684 | 681 |
| 682 aura::Window* launcher_window = shelf_layout_manager->shelf_widget()-> |
| 683 GetNativeWindow(); |
| 684 |
685 gfx::Rect shelf_bounds = shelf_layout_manager->GetIdealBounds(); | 685 gfx::Rect shelf_bounds = shelf_layout_manager->GetIdealBounds(); |
686 | 686 |
687 launcher_background_controller_.reset(new ColoredWindowController( | 687 launcher_background_controller_.reset(new ColoredWindowController( |
688 launcher_window->parent(), "LauncherBackground")); | 688 launcher_window->parent(), "LauncherBackground")); |
689 launcher_background_controller_->SetColor(SK_ColorBLACK); | 689 launcher_background_controller_->SetColor(SK_ColorBLACK); |
690 aura::Window* tint_window = | 690 aura::Window* tint_window = |
691 launcher_background_controller_->GetWidget()->GetNativeWindow(); | 691 launcher_background_controller_->GetWidget()->GetNativeWindow(); |
692 tint_window->SetBounds(shelf_bounds); | 692 tint_window->SetBounds(shelf_bounds); |
693 launcher_window->parent()->StackChildBelow(tint_window, launcher_window); | 693 launcher_window->parent()->StackChildBelow(tint_window, launcher_window); |
694 tint_window->Show(); | 694 tint_window->Show(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 MessageLoopForUI::current()->PostTask( | 728 MessageLoopForUI::current()->PostTask( |
729 FROM_HERE, | 729 FROM_HERE, |
730 base::Bind(&WorkspaceCyclerAnimator::NotifyDelegate, | 730 base::Bind(&WorkspaceCyclerAnimator::NotifyDelegate, |
731 AsWeakPtr(), | 731 AsWeakPtr(), |
732 completed_animation)); | 732 completed_animation)); |
733 } | 733 } |
734 } | 734 } |
735 | 735 |
736 } // namespace internal | 736 } // namespace internal |
737 } // namespace ash | 737 } // namespace ash |
OLD | NEW |