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