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/wm/panels/panel_layout_manager.h" | 5 #include "ash/wm/panels/panel_layout_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
11 #include "ash/shelf/shelf.h" | 11 #include "ash/shelf/shelf.h" |
12 #include "ash/shelf/shelf_layout_manager.h" | 12 #include "ash/shelf/shelf_layout_manager.h" |
13 #include "ash/shelf/shelf_types.h" | 13 #include "ash/shelf/shelf_types.h" |
14 #include "ash/shelf/shelf_util.h" | 14 #include "ash/shelf/shelf_util.h" |
15 #include "ash/shelf/shelf_widget.h" | 15 #include "ash/shelf/shelf_widget.h" |
16 #include "ash/shell.h" | 16 #include "ash/shell.h" |
17 #include "ash/shell_window_ids.h" | 17 #include "ash/shell_window_ids.h" |
18 #include "ash/wm/window_animations.h" | 18 #include "ash/wm/window_animations.h" |
19 #include "ash/wm/window_state.h" | 19 #include "ash/wm/window_state.h" |
20 #include "ash/wm/window_util.h" | 20 #include "ash/wm/window_util.h" |
21 #include "base/auto_reset.h" | 21 #include "base/auto_reset.h" |
22 #include "base/bind.h" | 22 #include "base/bind.h" |
23 #include "base/bind_helpers.h" | 23 #include "base/bind_helpers.h" |
24 #include "third_party/skia/include/core/SkColor.h" | 24 #include "third_party/skia/include/core/SkColor.h" |
25 #include "third_party/skia/include/core/SkPaint.h" | 25 #include "third_party/skia/include/core/SkPaint.h" |
26 #include "third_party/skia/include/core/SkPath.h" | 26 #include "third_party/skia/include/core/SkPath.h" |
27 #include "ui/aura/client/focus_client.h" | 27 #include "ui/aura/client/focus_client.h" |
28 #include "ui/aura/client/window_tree_client.h" | 28 #include "ui/aura/client/window_tree_client.h" |
29 #include "ui/aura/window.h" | 29 #include "ui/aura/window.h" |
| 30 #include "ui/aura/window_delegate.h" |
30 #include "ui/aura/window_event_dispatcher.h" | 31 #include "ui/aura/window_event_dispatcher.h" |
31 #include "ui/aura/window_tracker.h" | 32 #include "ui/aura/window_tracker.h" |
32 #include "ui/compositor/scoped_layer_animation_settings.h" | 33 #include "ui/compositor/scoped_layer_animation_settings.h" |
33 #include "ui/gfx/canvas.h" | 34 #include "ui/gfx/canvas.h" |
34 #include "ui/gfx/rect.h" | 35 #include "ui/gfx/rect.h" |
35 #include "ui/gfx/vector2d.h" | 36 #include "ui/gfx/vector2d.h" |
36 #include "ui/views/background.h" | 37 #include "ui/views/background.h" |
37 #include "ui/views/widget/widget.h" | 38 #include "ui/views/widget/widget.h" |
38 #include "ui/wm/public/activation_client.h" | 39 #include "ui/wm/public/activation_client.h" |
39 | 40 |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 ++new_position) { | 427 ++new_position) { |
427 const gfx::Rect& bounds = (*new_position).window->bounds(); | 428 const gfx::Rect& bounds = (*new_position).window->bounds(); |
428 if (bounds.x() + bounds.width()/2 <= requested_bounds.x()) break; | 429 if (bounds.x() + bounds.width()/2 <= requested_bounds.x()) break; |
429 } | 430 } |
430 if (new_position != dragged_panel_iter) { | 431 if (new_position != dragged_panel_iter) { |
431 PanelInfo dragged_panel_info = *dragged_panel_iter; | 432 PanelInfo dragged_panel_info = *dragged_panel_iter; |
432 panel_windows_.erase(dragged_panel_iter); | 433 panel_windows_.erase(dragged_panel_iter); |
433 panel_windows_.insert(new_position, dragged_panel_info); | 434 panel_windows_.insert(new_position, dragged_panel_info); |
434 } | 435 } |
435 } | 436 } |
| 437 // Respect the minimum size of the window. |
| 438 if (child->delegate()) { |
| 439 const gfx::Size& min_size = child->delegate()->GetMinimumSize(); |
| 440 bounds.set_width(std::max(min_size.width(), bounds.width())); |
| 441 bounds.set_height(std::max(min_size.height(), bounds.height())); |
| 442 } |
436 | 443 |
437 SetChildBoundsDirect(child, bounds); | 444 SetChildBoundsDirect(child, bounds); |
438 Relayout(); | 445 Relayout(); |
439 } | 446 } |
440 | 447 |
441 //////////////////////////////////////////////////////////////////////////////// | 448 //////////////////////////////////////////////////////////////////////////////// |
442 // PanelLayoutManager, ShelfIconObserver implementation: | 449 // PanelLayoutManager, ShelfIconObserver implementation: |
443 | 450 |
444 void PanelLayoutManager::OnShelfIconPositionsChanged() { | 451 void PanelLayoutManager::OnShelfIconPositionsChanged() { |
445 // TODO: As this is called for every animation step now. Relayout needs to be | 452 // TODO: As this is called for every animation step now. Relayout needs to be |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 // keyboard::KeyboardControllerObserver implementation: | 897 // keyboard::KeyboardControllerObserver implementation: |
891 | 898 |
892 void PanelLayoutManager::OnKeyboardBoundsChanging( | 899 void PanelLayoutManager::OnKeyboardBoundsChanging( |
893 const gfx::Rect& keyboard_bounds) { | 900 const gfx::Rect& keyboard_bounds) { |
894 // This bounds change will have caused a change to the Shelf which does not | 901 // This bounds change will have caused a change to the Shelf which does not |
895 // propogate automatically to this class, so manually recalculate bounds. | 902 // propogate automatically to this class, so manually recalculate bounds. |
896 OnWindowResized(); | 903 OnWindowResized(); |
897 } | 904 } |
898 | 905 |
899 } // namespace ash | 906 } // namespace ash |
OLD | NEW |