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/workspace/workspace_window_resizer.h" | 5 #include "ash/wm/workspace/workspace_window_resizer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
747 drag_phantom_window_controller_.reset(); | 747 drag_phantom_window_controller_.reset(); |
748 window()->layer()->SetOpacity(1.0f); | 748 window()->layer()->SetOpacity(1.0f); |
749 } | 749 } |
750 } | 750 } |
751 | 751 |
752 void WorkspaceWindowResizer::UpdateSnapPhantomWindow(const gfx::Point& location, | 752 void WorkspaceWindowResizer::UpdateSnapPhantomWindow(const gfx::Point& location, |
753 const gfx::Rect& bounds) { | 753 const gfx::Rect& bounds) { |
754 if (!did_move_or_resize_ || details_.window_component != HTCAPTION) | 754 if (!did_move_or_resize_ || details_.window_component != HTCAPTION) |
755 return; | 755 return; |
756 | 756 |
757 // If a window has a maximum size defined, snapping may make it too big. | |
758 if (!window()->delegate()->GetMaximumSize().IsEmpty()) | |
jeremya
2012/11/15 01:12:43
Maybe abstract this into ash::wm::CanSnapWindow()
koz (OOO until 15th September)
2012/11/15 02:46:13
Done.
| |
759 return; | |
760 | |
757 SnapType last_type = snap_type_; | 761 SnapType last_type = snap_type_; |
758 snap_type_ = GetSnapType(location); | 762 snap_type_ = GetSnapType(location); |
759 if (snap_type_ == SNAP_NONE || snap_type_ != last_type) { | 763 if (snap_type_ == SNAP_NONE || snap_type_ != last_type) { |
760 snap_phantom_window_controller_.reset(); | 764 snap_phantom_window_controller_.reset(); |
761 snap_sizer_.reset(); | 765 snap_sizer_.reset(); |
762 if (snap_type_ == SNAP_NONE) | 766 if (snap_type_ == SNAP_NONE) |
763 return; | 767 return; |
764 } | 768 } |
765 if (!snap_sizer_.get()) { | 769 if (!snap_sizer_.get()) { |
766 SnapSizer::Edge edge = (snap_type_ == SNAP_LEFT_EDGE) ? | 770 SnapSizer::Edge edge = (snap_type_ == SNAP_LEFT_EDGE) ? |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
837 gfx::Rect layer_bounds = layer_->bounds(); | 841 gfx::Rect layer_bounds = layer_->bounds(); |
838 layer_bounds.set_origin(gfx::Point(0, 0)); | 842 layer_bounds.set_origin(gfx::Point(0, 0)); |
839 layer_->SetBounds(layer_bounds); | 843 layer_->SetBounds(layer_bounds); |
840 layer_->SetVisible(false); | 844 layer_->SetVisible(false); |
841 // Detach it from the current container. | 845 // Detach it from the current container. |
842 layer_->parent()->Remove(layer_); | 846 layer_->parent()->Remove(layer_); |
843 } | 847 } |
844 | 848 |
845 } // namespace internal | 849 } // namespace internal |
846 } // namespace ash | 850 } // namespace ash |
OLD | NEW |