OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/wm/overview/window_grid.h" | 5 #include "ash/common/wm/overview/window_grid.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "ash/common/ash_switches.h" | 13 #include "ash/common/ash_switches.h" |
14 #include "ash/common/material_design/material_design_controller.h" | 14 #include "ash/common/material_design/material_design_controller.h" |
15 #include "ash/common/shell_window_ids.h" | 15 #include "ash/common/shell_window_ids.h" |
16 #include "ash/common/wm/overview/scoped_overview_animation_settings.h" | |
17 #include "ash/common/wm/overview/scoped_overview_animation_settings_factory.h" | |
16 #include "ash/common/wm/overview/scoped_transform_overview_window.h" | 18 #include "ash/common/wm/overview/scoped_transform_overview_window.h" |
17 #include "ash/common/wm/overview/window_selector.h" | 19 #include "ash/common/wm/overview/window_selector.h" |
18 #include "ash/common/wm/overview/window_selector_item.h" | 20 #include "ash/common/wm/overview/window_selector_item.h" |
19 #include "ash/common/wm/window_state.h" | 21 #include "ash/common/wm/window_state.h" |
20 #include "ash/common/wm/wm_screen_util.h" | 22 #include "ash/common/wm/wm_screen_util.h" |
21 #include "ash/common/wm_lookup.h" | 23 #include "ash/common/wm_lookup.h" |
22 #include "ash/common/wm_root_window_controller.h" | 24 #include "ash/common/wm_root_window_controller.h" |
23 #include "ash/common/wm_window.h" | 25 #include "ash/common/wm_window.h" |
24 #include "base/command_line.h" | 26 #include "base/command_line.h" |
25 #include "base/i18n/string_search.h" | 27 #include "base/i18n/string_search.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 | 89 |
88 // Conceptually the window overview is a table or grid of cells having this | 90 // Conceptually the window overview is a table or grid of cells having this |
89 // fixed aspect ratio. The number of columns is determined by maximizing the | 91 // fixed aspect ratio. The number of columns is determined by maximizing the |
90 // area of them based on the number of window_list. | 92 // area of them based on the number of window_list. |
91 const float kCardAspectRatio = 4.0f / 3.0f; | 93 const float kCardAspectRatio = 4.0f / 3.0f; |
92 | 94 |
93 // The minimum number of cards along the major axis (i.e. horizontally on a | 95 // The minimum number of cards along the major axis (i.e. horizontally on a |
94 // landscape orientation). | 96 // landscape orientation). |
95 const int kMinCardsMajor = 3; | 97 const int kMinCardsMajor = 3; |
96 | 98 |
97 const int kOverviewSelectorTransitionMilliseconds = 200; | 99 const int kOverviewSelectorTransitionMilliseconds = 250; |
98 | 100 |
99 // The color and opacity of the screen shield in overview. | 101 // The color and opacity of the screen shield in overview. |
100 const SkColor kShieldColor = SkColorSetARGB(178, 0, 0, 0); | 102 const SkColor kShieldColor = SkColorSetARGB(178, 0, 0, 0); |
101 | 103 |
102 // The color and opacity of the overview selector. | 104 // The color and opacity of the overview selector. |
103 const SkColor kWindowSelectionColor = SkColorSetARGB(128, 0, 0, 0); | 105 const SkColor kWindowSelectionColor = SkColorSetARGB(128, 0, 0, 0); |
104 const SkColor kWindowSelectionColorMD = SkColorSetARGB(51, 255, 255, 255); | 106 const SkColor kWindowSelectionColorMD = SkColorSetARGB(51, 255, 255, 255); |
105 const SkColor kWindowSelectionBorderColor = SkColorSetARGB(38, 255, 255, 255); | 107 const SkColor kWindowSelectionBorderColor = SkColorSetARGB(38, 255, 255, 255); |
106 const SkColor kWindowSelectionBorderColorMD = SkColorSetARGB(76, 255, 255, 255); | 108 const SkColor kWindowSelectionBorderColorMD = SkColorSetARGB(76, 255, 255, 255); |
107 | 109 |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
722 } else { | 724 } else { |
723 (*iter)->SetDimmed(true); | 725 (*iter)->SetDimmed(true); |
724 if (selection_widget_ && SelectedWindow() == *iter) { | 726 if (selection_widget_ && SelectedWindow() == *iter) { |
725 SelectedWindow()->SetSelected(false); | 727 SelectedWindow()->SetSelected(false); |
726 selection_widget_.reset(); | 728 selection_widget_.reset(); |
727 } | 729 } |
728 } | 730 } |
729 } | 731 } |
730 } | 732 } |
731 | 733 |
734 void WindowGrid::HideSelector() { | |
735 if (!selection_widget_) | |
736 return; | |
737 WmWindow* selection_widget_window = | |
738 WmLookup::Get()->GetWindowForWidget(selection_widget_.get()); | |
739 std::unique_ptr<ScopedOverviewAnimationSettings> animation_settings_label = | |
740 ScopedOverviewAnimationSettingsFactory::Get() | |
741 ->CreateOverviewAnimationSettings( | |
742 OverviewAnimationType::OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM, | |
743 selection_widget_window); | |
744 selection_widget_->SetOpacity(0.f); | |
745 } | |
746 | |
732 void WindowGrid::OnWindowDestroying(WmWindow* window) { | 747 void WindowGrid::OnWindowDestroying(WmWindow* window) { |
733 window->RemoveObserver(this); | 748 window->RemoveObserver(this); |
734 observed_windows_.erase(window); | 749 observed_windows_.erase(window); |
735 ScopedVector<WindowSelectorItem>::iterator iter = | 750 ScopedVector<WindowSelectorItem>::iterator iter = |
736 std::find_if(window_list_.begin(), window_list_.end(), | 751 std::find_if(window_list_.begin(), window_list_.end(), |
737 WindowSelectorItemComparator(window)); | 752 WindowSelectorItemComparator(window)); |
738 | 753 |
739 DCHECK(iter != window_list_.end()); | 754 DCHECK(iter != window_list_.end()); |
740 | 755 |
741 size_t removed_index = iter - window_list_.begin(); | 756 size_t removed_index = iter - window_list_.begin(); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
865 root_window_->ConvertRectFromScreen(SelectedWindow()->target_bounds()); | 880 root_window_->ConvertRectFromScreen(SelectedWindow()->target_bounds()); |
866 if (ash::MaterialDesignController::IsOverviewMaterial()) | 881 if (ash::MaterialDesignController::IsOverviewMaterial()) |
867 bounds.Inset(kSelectionInset, kSelectionInset); | 882 bounds.Inset(kSelectionInset, kSelectionInset); |
868 if (animate) { | 883 if (animate) { |
869 WmWindow* selection_widget_window = | 884 WmWindow* selection_widget_window = |
870 WmLookup::Get()->GetWindowForWidget(selection_widget_.get()); | 885 WmLookup::Get()->GetWindowForWidget(selection_widget_.get()); |
871 ui::ScopedLayerAnimationSettings animation_settings( | 886 ui::ScopedLayerAnimationSettings animation_settings( |
872 selection_widget_window->GetLayer()->GetAnimator()); | 887 selection_widget_window->GetLayer()->GetAnimator()); |
873 animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 888 animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
874 kOverviewSelectorTransitionMilliseconds)); | 889 kOverviewSelectorTransitionMilliseconds)); |
875 animation_settings.SetTweenType(gfx::Tween::LINEAR_OUT_SLOW_IN); | 890 animation_settings.SetTweenType(gfx::Tween::EASE_IN_OUT); |
varkha
2016/07/05 15:08:55
Self review: make the change --md-ash flag-depende
| |
876 animation_settings.SetPreemptionStrategy( | 891 animation_settings.SetPreemptionStrategy( |
877 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 892 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
878 selection_widget_->SetBounds(bounds); | 893 selection_widget_->SetBounds(bounds); |
879 selection_widget_->SetOpacity(1.f); | 894 selection_widget_->SetOpacity(1.f); |
880 return; | 895 return; |
881 } | 896 } |
882 selection_widget_->SetBounds(bounds); | 897 selection_widget_->SetBounds(bounds); |
883 selection_widget_->SetOpacity(1.f); | 898 selection_widget_->SetOpacity(1.f); |
884 } | 899 } |
885 | 900 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
944 *min_right = left; | 959 *min_right = left; |
945 if (*max_right < left) | 960 if (*max_right < left) |
946 *max_right = left; | 961 *max_right = left; |
947 } | 962 } |
948 *max_bottom = top + height; | 963 *max_bottom = top + height; |
949 } | 964 } |
950 return windows_fit; | 965 return windows_fit; |
951 } | 966 } |
952 | 967 |
953 } // namespace ash | 968 } // namespace ash |
OLD | NEW |