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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "ash/common/ash_switches.h" | 13 #include "ash/common/ash_switches.h" |
14 #include "ash/common/material_design/material_design_controller.h" | 14 #include "ash/common/material_design/material_design_controller.h" |
15 #include "ash/common/shelf/shelf_types.h" | 15 #include "ash/common/shelf/shelf_types.h" |
16 #include "ash/common/shelf/wm_shelf.h" | 16 #include "ash/common/shelf/wm_shelf.h" |
17 #include "ash/common/shell_window_ids.h" | 17 #include "ash/common/shell_window_ids.h" |
18 #include "ash/common/wm/overview/cleanup_animation_observer.h" | 18 #include "ash/common/wm/overview/cleanup_animation_observer.h" |
19 #include "ash/common/wm/overview/scoped_overview_animation_settings.h" | 19 #include "ash/common/wm/overview/scoped_overview_animation_settings.h" |
20 #include "ash/common/wm/overview/scoped_overview_animation_settings_factory.h" | 20 #include "ash/common/wm/overview/scoped_overview_animation_settings_factory.h" |
21 #include "ash/common/wm/overview/scoped_transform_overview_window.h" | |
22 #include "ash/common/wm/overview/window_selector.h" | 21 #include "ash/common/wm/overview/window_selector.h" |
23 #include "ash/common/wm/overview/window_selector_delegate.h" | 22 #include "ash/common/wm/overview/window_selector_delegate.h" |
24 #include "ash/common/wm/overview/window_selector_item.h" | 23 #include "ash/common/wm/overview/window_selector_item.h" |
25 #include "ash/common/wm/window_state.h" | 24 #include "ash/common/wm/window_state.h" |
26 #include "ash/common/wm/wm_screen_util.h" | 25 #include "ash/common/wm/wm_screen_util.h" |
27 #include "ash/common/wm_lookup.h" | 26 #include "ash/common/wm_lookup.h" |
28 #include "ash/common/wm_root_window_controller.h" | 27 #include "ash/common/wm_root_window_controller.h" |
29 #include "ash/common/wm_window.h" | 28 #include "ash/common/wm_window.h" |
30 #include "base/command_line.h" | 29 #include "base/command_line.h" |
31 #include "base/i18n/string_search.h" | 30 #include "base/i18n/string_search.h" |
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 // Right bound of the narrowest row. | 1004 // Right bound of the narrowest row. |
1006 *min_right = bounds.right(); | 1005 *min_right = bounds.right(); |
1007 // Right bound of the widest row. | 1006 // Right bound of the widest row. |
1008 *max_right = bounds.x(); | 1007 *max_right = bounds.x(); |
1009 | 1008 |
1010 // With Material Design all elements are of same height and only the height is | 1009 // With Material Design all elements are of same height and only the height is |
1011 // necessary to determine each item's scale. | 1010 // necessary to determine each item's scale. |
1012 const gfx::Size item_size(0, height); | 1011 const gfx::Size item_size(0, height); |
1013 size_t i = 0; | 1012 size_t i = 0; |
1014 for (auto* window : window_list_) { | 1013 for (auto* window : window_list_) { |
1015 const gfx::Rect target_bounds = window->GetWindow()->GetTargetBounds(); | 1014 const gfx::Rect target_bounds = window->GetTargetBoundsInScreen(); |
1016 const int width = | 1015 const int width = |
1017 std::max(1, gfx::ToFlooredInt(target_bounds.width() * | 1016 std::max(1, gfx::ToFlooredInt(target_bounds.width() * |
1018 window->GetItemScale(item_size)) + | 1017 window->GetItemScale(item_size)) + |
1019 2 * kWindowMarginMD); | 1018 2 * kWindowMarginMD); |
1020 if (left + width > bounds.right()) { | 1019 if (left + width > bounds.right()) { |
1021 // Move to the next row if possible. | 1020 // Move to the next row if possible. |
1022 if (*min_right > left) | 1021 if (*min_right > left) |
1023 *min_right = left; | 1022 *min_right = left; |
1024 if (*max_right < left) | 1023 if (*max_right < left) |
1025 *max_right = left; | 1024 *max_right = left; |
(...skipping 21 matching lines...) Expand all Loading... |
1047 *min_right = left; | 1046 *min_right = left; |
1048 if (*max_right < left) | 1047 if (*max_right < left) |
1049 *max_right = left; | 1048 *max_right = left; |
1050 } | 1049 } |
1051 *max_bottom = top + height; | 1050 *max_bottom = top + height; |
1052 } | 1051 } |
1053 return windows_fit; | 1052 return windows_fit; |
1054 } | 1053 } |
1055 | 1054 |
1056 } // namespace ash | 1055 } // namespace ash |
OLD | NEW |