| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/panels/panel_layout_manager.h" | 5 #include "ash/common/wm/panels/panel_layout_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "ash/common/shelf/wm_shelf.h" | 11 #include "ash/common/shelf/wm_shelf.h" |
| 12 #include "ash/common/shelf/wm_shelf_util.h" | 12 #include "ash/common/shelf/wm_shelf_util.h" |
| 13 #include "ash/common/shell_window_ids.h" | 13 #include "ash/common/shell_window_ids.h" |
| 14 #include "ash/common/wm/overview/window_selector_controller.h" |
| 14 #include "ash/common/wm/window_animation_types.h" | 15 #include "ash/common/wm/window_animation_types.h" |
| 15 #include "ash/common/wm/window_parenting_utils.h" | 16 #include "ash/common/wm/window_parenting_utils.h" |
| 16 #include "ash/common/wm/window_state.h" | 17 #include "ash/common/wm/window_state.h" |
| 17 #include "ash/common/wm_lookup.h" | 18 #include "ash/common/wm_lookup.h" |
| 18 #include "ash/common/wm_root_window_controller.h" | 19 #include "ash/common/wm_root_window_controller.h" |
| 19 #include "ash/common/wm_shell.h" | 20 #include "ash/common/wm_shell.h" |
| 20 #include "ash/common/wm_window.h" | 21 #include "ash/common/wm_window.h" |
| 21 #include "ash/common/wm_window_property.h" | 22 #include "ash/common/wm_window_property.h" |
| 22 #include "base/auto_reset.h" | 23 #include "base/auto_reset.h" |
| 23 #include "third_party/skia/include/core/SkColor.h" | 24 #include "third_party/skia/include/core/SkColor.h" |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 } | 572 } |
| 572 | 573 |
| 573 void PanelLayoutManager::Relayout() { | 574 void PanelLayoutManager::Relayout() { |
| 574 if (!shelf_) | 575 if (!shelf_) |
| 575 return; | 576 return; |
| 576 | 577 |
| 577 // Suppress layouts during overview mode because changing window bounds | 578 // Suppress layouts during overview mode because changing window bounds |
| 578 // interfered with overview mode animations. However, layouts need to be done | 579 // interfered with overview mode animations. However, layouts need to be done |
| 579 // when the WindowSelectorController is restoring minimized windows so that | 580 // when the WindowSelectorController is restoring minimized windows so that |
| 580 // they actually become visible. | 581 // they actually become visible. |
| 581 WmShell* shell = panel_container_->GetShell(); | 582 WindowSelectorController* window_selector_controller = |
| 582 if (in_layout_ || (shell->IsOverviewModeSelecting() && | 583 WmShell::Get()->window_selector_controller(); |
| 583 !shell->IsOverviewModeRestoringMinimizedWindows())) { | 584 if (in_layout_ || |
| 585 (window_selector_controller->IsSelecting() && |
| 586 !window_selector_controller->IsRestoringMinimizedWindows())) { |
| 584 return; | 587 return; |
| 585 } | 588 } |
| 586 | 589 |
| 587 base::AutoReset<bool> auto_reset_in_layout(&in_layout_, true); | 590 base::AutoReset<bool> auto_reset_in_layout(&in_layout_, true); |
| 588 | 591 |
| 589 const ShelfAlignment alignment = shelf_->GetAlignment(); | 592 const ShelfAlignment alignment = shelf_->GetAlignment(); |
| 590 const bool horizontal = IsHorizontalAlignment(shelf_->GetAlignment()); | 593 const bool horizontal = IsHorizontalAlignment(shelf_->GetAlignment()); |
| 591 gfx::Rect shelf_bounds = panel_container_->ConvertRectFromScreen( | 594 gfx::Rect shelf_bounds = panel_container_->ConvertRectFromScreen( |
| 592 shelf_->GetWindow()->GetBoundsInScreen()); | 595 shelf_->GetWindow()->GetBoundsInScreen()); |
| 593 int panel_start_bounds = kPanelIdealSpacing; | 596 int panel_start_bounds = kPanelIdealSpacing; |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 // Keyboard hidden, restore original bounds if they exist. | 891 // Keyboard hidden, restore original bounds if they exist. |
| 889 panel->SetBoundsDirect(panel_state->GetRestoreBoundsInScreen()); | 892 panel->SetBoundsDirect(panel_state->GetRestoreBoundsInScreen()); |
| 890 } | 893 } |
| 891 } | 894 } |
| 892 // This bounds change will have caused a change to the Shelf which does not | 895 // This bounds change will have caused a change to the Shelf which does not |
| 893 // propogate automatically to this class, so manually recalculate bounds. | 896 // propogate automatically to this class, so manually recalculate bounds. |
| 894 OnWindowResized(); | 897 OnWindowResized(); |
| 895 } | 898 } |
| 896 | 899 |
| 897 } // namespace ash | 900 } // namespace ash |
| OLD | NEW |