Chromium Code Reviews| 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 // Animates selector widget to |opacity|. | |
|
bruthig
2016/07/04 17:06:22
Is this comment needed?
varkha
2016/07/04 18:01:30
Done (duplicated for some reason in the header, I
| |
| 735 void WindowGrid::SetSelectorOpacity(float opacity) { | |
| 736 if (!selection_widget_) | |
| 737 return; | |
| 738 WmWindow* selection_widget_window = | |
| 739 WmLookup::Get()->GetWindowForWidget(selection_widget_.get()); | |
| 740 std::unique_ptr<ScopedOverviewAnimationSettings> animation_settings_label = | |
| 741 ScopedOverviewAnimationSettingsFactory::Get() | |
| 742 ->CreateOverviewAnimationSettings( | |
| 743 OverviewAnimationType::OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM, | |
| 744 selection_widget_window); | |
| 745 selection_widget_->SetOpacity(opacity); | |
| 746 } | |
| 747 | |
| 732 void WindowGrid::OnWindowDestroying(WmWindow* window) { | 748 void WindowGrid::OnWindowDestroying(WmWindow* window) { |
| 733 window->RemoveObserver(this); | 749 window->RemoveObserver(this); |
| 734 observed_windows_.erase(window); | 750 observed_windows_.erase(window); |
| 735 ScopedVector<WindowSelectorItem>::iterator iter = | 751 ScopedVector<WindowSelectorItem>::iterator iter = |
| 736 std::find_if(window_list_.begin(), window_list_.end(), | 752 std::find_if(window_list_.begin(), window_list_.end(), |
| 737 WindowSelectorItemComparator(window)); | 753 WindowSelectorItemComparator(window)); |
| 738 | 754 |
| 739 DCHECK(iter != window_list_.end()); | 755 DCHECK(iter != window_list_.end()); |
| 740 | 756 |
| 741 size_t removed_index = iter - window_list_.begin(); | 757 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()); | 881 root_window_->ConvertRectFromScreen(SelectedWindow()->target_bounds()); |
| 866 if (ash::MaterialDesignController::IsOverviewMaterial()) | 882 if (ash::MaterialDesignController::IsOverviewMaterial()) |
| 867 bounds.Inset(kSelectionInset, kSelectionInset); | 883 bounds.Inset(kSelectionInset, kSelectionInset); |
| 868 if (animate) { | 884 if (animate) { |
| 869 WmWindow* selection_widget_window = | 885 WmWindow* selection_widget_window = |
| 870 WmLookup::Get()->GetWindowForWidget(selection_widget_.get()); | 886 WmLookup::Get()->GetWindowForWidget(selection_widget_.get()); |
| 871 ui::ScopedLayerAnimationSettings animation_settings( | 887 ui::ScopedLayerAnimationSettings animation_settings( |
| 872 selection_widget_window->GetLayer()->GetAnimator()); | 888 selection_widget_window->GetLayer()->GetAnimator()); |
| 873 animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 889 animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
| 874 kOverviewSelectorTransitionMilliseconds)); | 890 kOverviewSelectorTransitionMilliseconds)); |
| 875 animation_settings.SetTweenType(gfx::Tween::LINEAR_OUT_SLOW_IN); | 891 animation_settings.SetTweenType(gfx::Tween::EASE_IN_OUT); |
| 876 animation_settings.SetPreemptionStrategy( | 892 animation_settings.SetPreemptionStrategy( |
| 877 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 893 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 878 selection_widget_->SetBounds(bounds); | 894 selection_widget_->SetBounds(bounds); |
| 879 selection_widget_->SetOpacity(1.f); | 895 selection_widget_->SetOpacity(1.f); |
| 880 return; | 896 return; |
| 881 } | 897 } |
| 882 selection_widget_->SetBounds(bounds); | 898 selection_widget_->SetBounds(bounds); |
| 883 selection_widget_->SetOpacity(1.f); | 899 selection_widget_->SetOpacity(1.f); |
| 884 } | 900 } |
| 885 | 901 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 944 *min_right = left; | 960 *min_right = left; |
| 945 if (*max_right < left) | 961 if (*max_right < left) |
| 946 *max_right = left; | 962 *max_right = left; |
| 947 } | 963 } |
| 948 *max_bottom = top + height; | 964 *max_bottom = top + height; |
| 949 } | 965 } |
| 950 return windows_fit; | 966 return windows_fit; |
| 951 } | 967 } |
| 952 | 968 |
| 953 } // namespace ash | 969 } // namespace ash |
| OLD | NEW |