OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/dock/docked_window_layout_manager.h" | 5 #include "ash/wm/dock/docked_window_layout_manager.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
9 #include "ash/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
10 #include "ash/shelf/shelf_constants.h" | 10 #include "ash/shelf/shelf_constants.h" |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 return; | 700 return; |
701 if (visible) | 701 if (visible) |
702 wm::GetWindowState(child)->Restore(); | 702 wm::GetWindowState(child)->Restore(); |
703 Relayout(); | 703 Relayout(); |
704 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED); | 704 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED); |
705 } | 705 } |
706 | 706 |
707 void DockedWindowLayoutManager::SetChildBounds( | 707 void DockedWindowLayoutManager::SetChildBounds( |
708 aura::Window* child, | 708 aura::Window* child, |
709 const gfx::Rect& requested_bounds) { | 709 const gfx::Rect& requested_bounds) { |
| 710 // The minimum constraints have to be applied first by the layout manager. |
| 711 gfx::Rect actual_new_bounds(requested_bounds); |
| 712 if (child->delegate()) { |
| 713 const gfx::Size& min_size = child->delegate()->GetMinimumSize(); |
| 714 actual_new_bounds.set_width( |
| 715 std::max(min_size.width(), actual_new_bounds.width())); |
| 716 actual_new_bounds.set_height( |
| 717 std::max(min_size.height(), actual_new_bounds.height())); |
| 718 } |
710 // Whenever one of our windows is moved or resized enforce layout. | 719 // Whenever one of our windows is moved or resized enforce layout. |
711 SetChildBoundsDirect(child, requested_bounds); | 720 SetChildBoundsDirect(child, actual_new_bounds); |
712 if (IsPopupOrTransient(child)) | 721 if (IsPopupOrTransient(child)) |
713 return; | 722 return; |
714 ShelfLayoutManager* shelf_layout = | 723 ShelfLayoutManager* shelf_layout = |
715 ShelfLayoutManager::ForShelf(dock_container_); | 724 ShelfLayoutManager::ForShelf(dock_container_); |
716 if (shelf_layout) | 725 if (shelf_layout) |
717 shelf_layout->UpdateVisibilityState(); | 726 shelf_layout->UpdateVisibilityState(); |
718 } | 727 } |
719 | 728 |
720 //////////////////////////////////////////////////////////////////////////////// | 729 //////////////////////////////////////////////////////////////////////////////// |
721 // DockedWindowLayoutManager, ash::ShellObserver implementation: | 730 // DockedWindowLayoutManager, ash::ShellObserver implementation: |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 | 1318 |
1310 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1319 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
1311 const gfx::Rect& keyboard_bounds) { | 1320 const gfx::Rect& keyboard_bounds) { |
1312 // This bounds change will have caused a change to the Shelf which does not | 1321 // This bounds change will have caused a change to the Shelf which does not |
1313 // propagate automatically to this class, so manually recalculate bounds. | 1322 // propagate automatically to this class, so manually recalculate bounds. |
1314 Relayout(); | 1323 Relayout(); |
1315 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1324 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
1316 } | 1325 } |
1317 | 1326 |
1318 } // namespace ash | 1327 } // namespace ash |
OLD | NEW |