Index: ash/wm/window_state.cc |
diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc |
index f0bed4ba0f38d31bdabbde0bf9f6c6b1b9f646b0..7c5c1674f14b050f4593608c1fa278d72e571221 100644 |
--- a/ash/wm/window_state.cc |
+++ b/ash/wm/window_state.cc |
@@ -24,6 +24,7 @@ |
#include "ui/compositor/layer_tree_owner.h" |
#include "ui/compositor/scoped_layer_animation_settings.h" |
#include "ui/gfx/display.h" |
+#include "ui/gfx/screen.h" |
#include "ui/wm/core/window_util.h" |
namespace ash { |
@@ -357,7 +358,21 @@ void WindowState::NotifyPostStateTypeChange( |
} |
void WindowState::SetBoundsDirect(const gfx::Rect& bounds) { |
- BoundsSetter().SetBounds(window_, bounds); |
+ gfx::Rect actual_new_bounds(bounds); |
+ // Ensure we don't go smaller than our minimum bounds in "normal" window |
+ // modes |
+ if (window_->delegate() && !IsMaximized() && !IsFullscreen()) { |
+ // Get the minimum usable size of the minimum size and the screen size. |
+ gfx::Size min_size = window_->delegate()->GetMinimumSize(); |
+ min_size.SetToMin(gfx::Screen::GetScreenFor( |
+ window_)->GetDisplayNearestWindow(window_).work_area().size()); |
+ |
+ actual_new_bounds.set_width( |
+ std::max(min_size.width(), actual_new_bounds.width())); |
+ actual_new_bounds.set_height( |
+ std::max(min_size.height(), actual_new_bounds.height())); |
+ } |
+ BoundsSetter().SetBounds(window_, actual_new_bounds); |
} |
void WindowState::SetBoundsConstrained(const gfx::Rect& bounds) { |