Chromium Code Reviews
Help | Chromium Project | Sign in
(199)

Side by Side Diff: ash/wm/workspace/workspace_window_resizer.cc

Issue 11366215: Prevents windows in chromeos from resizing bigger than their maximum size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comments Created 1 year, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 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
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
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1280:2d3e6564b7b6