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> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 | 90 |
91 // Conceptually the window overview is a table or grid of cells having this | 91 // Conceptually the window overview is a table or grid of cells having this |
92 // fixed aspect ratio. The number of columns is determined by maximizing the | 92 // fixed aspect ratio. The number of columns is determined by maximizing the |
93 // area of them based on the number of window_list. | 93 // area of them based on the number of window_list. |
94 const float kCardAspectRatio = 4.0f / 3.0f; | 94 const float kCardAspectRatio = 4.0f / 3.0f; |
95 | 95 |
96 // The minimum number of cards along the major axis (i.e. horizontally on a | 96 // The minimum number of cards along the major axis (i.e. horizontally on a |
97 // landscape orientation). | 97 // landscape orientation). |
98 const int kMinCardsMajor = 3; | 98 const int kMinCardsMajor = 3; |
99 | 99 |
100 // Hiding windows headers can be resource intensive. Only hide the headers when | |
tdanderson
2016/07/18 16:26:58
nit: windows->window
varkha
2016/07/19 00:29:07
Done.
| |
101 // the number of windows in this grid is less or equal than this number. | |
102 const int kMaxWindowsCountToHideHeader = 10; | |
103 | |
100 const int kOverviewSelectorTransitionMilliseconds = 250; | 104 const int kOverviewSelectorTransitionMilliseconds = 250; |
101 | 105 |
102 // The color and opacity of the screen shield in overview. | 106 // The color and opacity of the screen shield in overview. |
103 const SkColor kShieldColor = SkColorSetARGB(178, 0, 0, 0); | 107 const SkColor kShieldColor = SkColorSetARGB(178, 0, 0, 0); |
104 | 108 |
105 // The color and opacity of the overview selector. | 109 // The color and opacity of the overview selector. |
106 const SkColor kWindowSelectionColor = SkColorSetARGB(128, 0, 0, 0); | 110 const SkColor kWindowSelectionColor = SkColorSetARGB(128, 0, 0, 0); |
107 const SkColor kWindowSelectionColorMD = SkColorSetARGB(51, 255, 255, 255); | 111 const SkColor kWindowSelectionColorMD = SkColorSetARGB(51, 255, 255, 255); |
108 const SkColor kWindowSelectionBorderColor = SkColorSetARGB(38, 255, 255, 255); | 112 const SkColor kWindowSelectionBorderColor = SkColorSetARGB(38, 255, 255, 255); |
109 const SkColor kWindowSelectionBorderColorMD = SkColorSetARGB(76, 255, 255, 255); | 113 const SkColor kWindowSelectionBorderColorMD = SkColorSetARGB(76, 255, 255, 255); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
439 void WindowGrid::PrepareForOverview() { | 443 void WindowGrid::PrepareForOverview() { |
440 if (ash::MaterialDesignController::IsOverviewMaterial()) | 444 if (ash::MaterialDesignController::IsOverviewMaterial()) |
441 InitShieldWidget(); | 445 InitShieldWidget(); |
442 for (auto iter = window_list_.begin(); iter != window_list_.end(); ++iter) | 446 for (auto iter = window_list_.begin(); iter != window_list_.end(); ++iter) |
443 (*iter)->PrepareForOverview(); | 447 (*iter)->PrepareForOverview(); |
444 } | 448 } |
445 | 449 |
446 void WindowGrid::PositionWindowsMD(bool animate) { | 450 void WindowGrid::PositionWindowsMD(bool animate) { |
447 if (window_list_.empty()) | 451 if (window_list_.empty()) |
448 return; | 452 return; |
453 const bool hide_header = window_list_.size() <= kMaxWindowsCountToHideHeader; | |
454 for (auto* window : window_list_) | |
455 window->set_hide_header(hide_header); | |
449 gfx::Rect total_bounds = | 456 gfx::Rect total_bounds = |
450 root_window_->ConvertRectToScreen(wm::GetDisplayWorkAreaBoundsInParent( | 457 root_window_->ConvertRectToScreen(wm::GetDisplayWorkAreaBoundsInParent( |
451 root_window_->GetChildByShellWindowId( | 458 root_window_->GetChildByShellWindowId( |
452 kShellWindowId_DefaultContainer))); | 459 kShellWindowId_DefaultContainer))); |
453 // Windows occupy vertically centered area with additional vertical insets. | 460 // Windows occupy vertically centered area with additional vertical insets. |
454 int horizontal_inset = | 461 int horizontal_inset = |
455 gfx::ToFlooredInt(std::min(kOverviewInsetRatio * total_bounds.width(), | 462 gfx::ToFlooredInt(std::min(kOverviewInsetRatio * total_bounds.width(), |
456 kOverviewInsetRatio * total_bounds.height())); | 463 kOverviewInsetRatio * total_bounds.height())); |
457 int vertical_inset = | 464 int vertical_inset = |
458 horizontal_inset + | 465 horizontal_inset + |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
993 *min_right = left; | 1000 *min_right = left; |
994 if (*max_right < left) | 1001 if (*max_right < left) |
995 *max_right = left; | 1002 *max_right = left; |
996 } | 1003 } |
997 *max_bottom = top + height; | 1004 *max_bottom = top + height; |
998 } | 1005 } |
999 return windows_fit; | 1006 return windows_fit; |
1000 } | 1007 } |
1001 | 1008 |
1002 } // namespace ash | 1009 } // namespace ash |
OLD | NEW |