| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_overview.h" | 5 #include "ash/wm/overview/window_overview.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/metrics/user_metrics_recorder.h" | 9 #include "ash/metrics/user_metrics_recorder.h" |
| 10 #include "ash/screen_ash.h" | 10 #include "ash/screen_util.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
| 13 #include "ash/wm/mru_window_tracker.h" | 13 #include "ash/wm/mru_window_tracker.h" |
| 14 #include "ash/wm/overview/scoped_transform_overview_window.h" | 14 #include "ash/wm/overview/scoped_transform_overview_window.h" |
| 15 #include "ash/wm/overview/window_selector.h" | 15 #include "ash/wm/overview/window_selector.h" |
| 16 #include "ash/wm/overview/window_selector_item.h" | 16 #include "ash/wm/overview/window_selector_item.h" |
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 18 #include "third_party/skia/include/core/SkColor.h" | 18 #include "third_party/skia/include/core/SkColor.h" |
| 19 #include "ui/aura/client/cursor_client.h" | 19 #include "ui/aura/client/cursor_client.h" |
| 20 #include "ui/aura/root_window.h" | 20 #include "ui/aura/root_window.h" |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 PositionWindowsOnRoot(root_window, windows); | 366 PositionWindowsOnRoot(root_window, windows); |
| 367 } | 367 } |
| 368 | 368 |
| 369 void WindowOverview::PositionWindowsOnRoot( | 369 void WindowOverview::PositionWindowsOnRoot( |
| 370 aura::Window* root_window, | 370 aura::Window* root_window, |
| 371 const std::vector<WindowSelectorItem*>& windows) { | 371 const std::vector<WindowSelectorItem*>& windows) { |
| 372 if (windows.empty()) | 372 if (windows.empty()) |
| 373 return; | 373 return; |
| 374 | 374 |
| 375 gfx::Size window_size; | 375 gfx::Size window_size; |
| 376 gfx::Rect total_bounds = ScreenAsh::ConvertRectToScreen(root_window, | 376 gfx::Rect total_bounds = ScreenUtil::ConvertRectToScreen(root_window, |
| 377 ScreenAsh::GetDisplayWorkAreaBoundsInParent( | 377 ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
| 378 Shell::GetContainer(root_window, | 378 Shell::GetContainer(root_window, |
| 379 internal::kShellWindowId_DefaultContainer))); | 379 internal::kShellWindowId_DefaultContainer))); |
| 380 | 380 |
| 381 // Find the minimum number of windows per row that will fit all of the | 381 // Find the minimum number of windows per row that will fit all of the |
| 382 // windows on screen. | 382 // windows on screen. |
| 383 size_t columns = std::max( | 383 size_t columns = std::max( |
| 384 total_bounds.width() > total_bounds.height() ? kMinCardsMajor : 1, | 384 total_bounds.width() > total_bounds.height() ? kMinCardsMajor : 1, |
| 385 static_cast<int>(ceil(sqrt(total_bounds.width() * windows.size() / | 385 static_cast<int>(ceil(sqrt(total_bounds.width() * windows.size() / |
| 386 (kCardAspectRatio * total_bounds.height()))))); | 386 (kCardAspectRatio * total_bounds.height()))))); |
| 387 size_t rows = ((windows.size() + columns - 1) / columns); | 387 size_t rows = ((windows.size() + columns - 1) / columns); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 } | 435 } |
| 436 | 436 |
| 437 gfx::Rect WindowOverview::GetSelectionBounds(size_t index) { | 437 gfx::Rect WindowOverview::GetSelectionBounds(size_t index) { |
| 438 gfx::Rect bounds((*windows_)[index]->bounds()); | 438 gfx::Rect bounds((*windows_)[index]->bounds()); |
| 439 bounds.Inset(-kWindowOverviewSelectionPadding, | 439 bounds.Inset(-kWindowOverviewSelectionPadding, |
| 440 -kWindowOverviewSelectionPadding); | 440 -kWindowOverviewSelectionPadding); |
| 441 return bounds; | 441 return bounds; |
| 442 } | 442 } |
| 443 | 443 |
| 444 } // namespace ash | 444 } // namespace ash |
| OLD | NEW |