| 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/wm/overview/window_grid.h" | 5 #include "ash/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 <vector> | 10 #include <vector> |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 void WindowGrid::PositionWindows(bool animate) { | 156 void WindowGrid::PositionWindows(bool animate) { |
| 157 CHECK(!window_list_.empty()); | 157 CHECK(!window_list_.empty()); |
| 158 | 158 |
| 159 gfx::Size window_size; | 159 gfx::Size window_size; |
| 160 gfx::Rect total_bounds = ScreenUtil::ConvertRectToScreen( | 160 gfx::Rect total_bounds = ScreenUtil::ConvertRectToScreen( |
| 161 root_window_, | 161 root_window_, |
| 162 ScreenUtil::GetDisplayWorkAreaBoundsInParent( | 162 ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
| 163 Shell::GetContainer(root_window_, kShellWindowId_DefaultContainer))); | 163 Shell::GetContainer(root_window_, kShellWindowId_DefaultContainer))); |
| 164 | 164 |
| 165 // If the text filtering feature is enabled, reserve space at the top for the | 165 // Reserve space at the top for the text filtering textbox to appear. |
| 166 // text filtering textbox to appear. | 166 total_bounds.Inset( |
| 167 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 167 0, WindowSelector::kTextFilterBottomEdge + kTextFilterBottomMargin, 0, 0); |
| 168 switches::kAshDisableTextFilteringInOverviewMode)) { | |
| 169 total_bounds.Inset( | |
| 170 0, | |
| 171 WindowSelector::kTextFilterBottomEdge + kTextFilterBottomMargin, | |
| 172 0, | |
| 173 0); | |
| 174 } | |
| 175 | 168 |
| 176 // Find the minimum number of windows per row that will fit all of the | 169 // Find the minimum number of windows per row that will fit all of the |
| 177 // windows on screen. | 170 // windows on screen. |
| 178 num_columns_ = std::max( | 171 num_columns_ = std::max( |
| 179 total_bounds.width() > total_bounds.height() ? kMinCardsMajor : 1, | 172 total_bounds.width() > total_bounds.height() ? kMinCardsMajor : 1, |
| 180 static_cast<int>(ceil(sqrt(total_bounds.width() * window_list_.size() / | 173 static_cast<int>(ceil(sqrt(total_bounds.width() * window_list_.size() / |
| 181 (kCardAspectRatio * total_bounds.height()))))); | 174 (kCardAspectRatio * total_bounds.height()))))); |
| 182 int num_rows = ((window_list_.size() + num_columns_ - 1) / num_columns_); | 175 int num_rows = ((window_list_.size() + num_columns_ - 1) / num_columns_); |
| 183 window_size.set_width(std::min( | 176 window_size.set_width(std::min( |
| 184 static_cast<int>(total_bounds.width() / num_columns_), | 177 static_cast<int>(total_bounds.width() / num_columns_), |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 439 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 447 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); | 440 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); |
| 448 selection_widget_->SetOpacity(kWindowOverviewSelectorOpacity); | 441 selection_widget_->SetOpacity(kWindowOverviewSelectorOpacity); |
| 449 return; | 442 return; |
| 450 } | 443 } |
| 451 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); | 444 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); |
| 452 selection_widget_->SetOpacity(kWindowOverviewSelectorOpacity); | 445 selection_widget_->SetOpacity(kWindowOverviewSelectorOpacity); |
| 453 } | 446 } |
| 454 | 447 |
| 455 } // namespace ash | 448 } // namespace ash |
| OLD | NEW |