| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // fixed aspect ratio. The number of columns is determined by maximizing the | 67 // fixed aspect ratio. The number of columns is determined by maximizing the |
| 68 // area of them based on the number of window_list. | 68 // area of them based on the number of window_list. |
| 69 const float kCardAspectRatio = 4.0f / 3.0f; | 69 const float kCardAspectRatio = 4.0f / 3.0f; |
| 70 | 70 |
| 71 // The minimum number of cards along the major axis (i.e. horizontally on a | 71 // The minimum number of cards along the major axis (i.e. horizontally on a |
| 72 // landscape orientation). | 72 // landscape orientation). |
| 73 const int kMinCardsMajor = 3; | 73 const int kMinCardsMajor = 3; |
| 74 | 74 |
| 75 // Hiding window headers can be resource intensive. Only hide the headers when | 75 // Hiding window headers can be resource intensive. Only hide the headers when |
| 76 // the number of windows in this grid is less or equal than this number. | 76 // the number of windows in this grid is less or equal than this number. |
| 77 const int kMaxWindowsCountToHideHeader = 10; | 77 // The default is 0, meaning that mask layers are never used and the bottom |
| 78 // corners are not rounded in overview. |
| 79 const int kMaxWindowsCountToHideHeaderWithMasks = 0; |
| 78 | 80 |
| 79 const int kOverviewSelectorTransitionMilliseconds = 250; | 81 const int kOverviewSelectorTransitionMilliseconds = 250; |
| 80 | 82 |
| 81 // The color and opacity of the screen shield in overview. | 83 // The color and opacity of the screen shield in overview. |
| 82 const SkColor kShieldColor = SkColorSetARGB(255, 0, 0, 0); | 84 const SkColor kShieldColor = SkColorSetARGB(255, 0, 0, 0); |
| 83 const float kShieldOpacity = 0.7f; | 85 const float kShieldOpacity = 0.7f; |
| 84 | 86 |
| 85 // The color and opacity of the overview selector. | 87 // The color and opacity of the overview selector. |
| 86 const SkColor kWindowSelectionColor = SkColorSetARGB(128, 0, 0, 0); | 88 const SkColor kWindowSelectionColor = SkColorSetARGB(128, 0, 0, 0); |
| 87 const SkColor kWindowSelectionColorMD = SkColorSetARGB(51, 255, 255, 255); | 89 const SkColor kWindowSelectionColorMD = SkColorSetARGB(51, 255, 255, 255); |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 } | 455 } |
| 454 | 456 |
| 455 void WindowGrid::PositionWindowsMD(bool animate) { | 457 void WindowGrid::PositionWindowsMD(bool animate) { |
| 456 if (window_list_.empty()) | 458 if (window_list_.empty()) |
| 457 return; | 459 return; |
| 458 | 460 |
| 459 const int kUnlimited = -1; | 461 const int kUnlimited = -1; |
| 460 const size_t windows_count = window_list_.size(); | 462 const size_t windows_count = window_list_.size(); |
| 461 const base::CommandLine* command_line = | 463 const base::CommandLine* command_line = |
| 462 base::CommandLine::ForCurrentProcess(); | 464 base::CommandLine::ForCurrentProcess(); |
| 463 int windows_to_use_masks = kMaxWindowsCountToHideHeader; | 465 int windows_to_use_masks = kMaxWindowsCountToHideHeaderWithMasks; |
| 464 if (command_line->HasSwitch(switches::kAshMaxWindowsToUseMaskInOverview) && | 466 if (command_line->HasSwitch(switches::kAshMaxWindowsToUseMaskInOverview) && |
| 465 (!base::StringToInt(command_line->GetSwitchValueASCII( | 467 (!base::StringToInt(command_line->GetSwitchValueASCII( |
| 466 switches::kAshMaxWindowsToUseMaskInOverview), | 468 switches::kAshMaxWindowsToUseMaskInOverview), |
| 467 &windows_to_use_masks) || | 469 &windows_to_use_masks) || |
| 468 windows_to_use_masks <= kUnlimited)) { | 470 windows_to_use_masks <= kUnlimited)) { |
| 469 windows_to_use_masks = kMaxWindowsCountToHideHeader; | 471 windows_to_use_masks = kMaxWindowsCountToHideHeaderWithMasks; |
| 470 } | 472 } |
| 471 int windows_to_use_shapes = kUnlimited; | 473 int windows_to_use_shapes = kUnlimited; |
| 472 if (command_line->HasSwitch(switches::kAshMaxWindowsToUseShapeInOverview) && | 474 if (command_line->HasSwitch(switches::kAshMaxWindowsToUseShapeInOverview) && |
| 473 (!base::StringToInt(command_line->GetSwitchValueASCII( | 475 (!base::StringToInt(command_line->GetSwitchValueASCII( |
| 474 switches::kAshMaxWindowsToUseShapeInOverview), | 476 switches::kAshMaxWindowsToUseShapeInOverview), |
| 475 &windows_to_use_shapes) || | 477 &windows_to_use_shapes) || |
| 476 windows_to_use_shapes <= kUnlimited)) { | 478 windows_to_use_shapes <= kUnlimited)) { |
| 477 windows_to_use_shapes = kUnlimited; | 479 windows_to_use_shapes = kUnlimited; |
| 478 } | 480 } |
| 479 WindowSelectorItem::set_use_mask(windows_to_use_masks <= kUnlimited || | 481 WindowSelectorItem::set_use_mask(windows_to_use_masks <= kUnlimited || |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 *min_right = left; | 1016 *min_right = left; |
| 1015 if (*max_right < left) | 1017 if (*max_right < left) |
| 1016 *max_right = left; | 1018 *max_right = left; |
| 1017 } | 1019 } |
| 1018 *max_bottom = top + height; | 1020 *max_bottom = top + height; |
| 1019 } | 1021 } |
| 1020 return windows_fit; | 1022 return windows_fit; |
| 1021 } | 1023 } |
| 1022 | 1024 |
| 1023 } // namespace ash | 1025 } // namespace ash |
| OLD | NEW |