Index: ash/wm/window_state.cc |
diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc |
index e60dc34fceb106f39fdc74e3ddf3639b73bf1c9c..5d4711956af25fbb44774aba5865266df882b3a3 100644 |
--- a/ash/wm/window_state.cc |
+++ b/ash/wm/window_state.cc |
@@ -141,7 +141,14 @@ bool WindowState::IsDocked() const { |
} |
bool WindowState::CanMaximize() const { |
- return window_->GetProperty(aura::client::kCanMaximizeKey); |
+ // Window must have the kCanMaximizeKey and have no maximum width or height. |
+ if (!window()->GetProperty(aura::client::kCanMaximizeKey) || |
+ !window_->delegate()) { |
+ return false; |
+ } |
+ |
Mr4D (OOO till 08-26)
2014/09/11 20:24:17
A window which can be maximized and has a maximum
oshima
2014/09/11 20:32:14
potentially yes, but that conflicts when the displ
|
+ gfx::Size max_size = window_->delegate()->GetMaximumSize(); |
+ return !max_size.width() && !max_size.height(); |
} |
bool WindowState::CanMinimize() const { |
@@ -168,10 +175,10 @@ bool WindowState::CanSnap() const { |
if (!CanResize() || window_->type() == ui::wm::WINDOW_TYPE_PANEL || |
::wm::GetTransientParent(window_)) |
return false; |
- // If a window has a maximum size defined, snapping may make it too big. |
- // TODO(oshima): We probably should snap if possible. |
- return window_->delegate() ? window_->delegate()->GetMaximumSize().IsEmpty() : |
- true; |
+ // If a window cannot be maximized, assume it cannot snap either. |
+ // TODO(oshima): We should probably snap if the maximum size is greater than |
+ // the snapped size. |
+ return CanMaximize(); |
} |
bool WindowState::HasRestoreBounds() const { |