Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1605)

Unified Diff: ash/wm/window_state.cc

Issue 557693002: [Ash] Only snap windows that can maximize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/wm/window_state_unittest.cc » ('j') | ash/wm/window_state_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_state.cc
diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc
index e60dc34fceb106f39fdc74e3ddf3639b73bf1c9c..d34a2eda6970ae2ca8159b416cfbdc041f762841 100644
--- a/ash/wm/window_state.cc
+++ b/ash/wm/window_state.cc
@@ -141,6 +141,12 @@ bool WindowState::IsDocked() const {
}
bool WindowState::CanMaximize() const {
+ if (window_->delegate()) {
+ gfx::Size max_size = window_->delegate()->GetMaximumSize();
+ if (max_size.width() || max_size.height())
+ return false;
+ }
+
return window_->GetProperty(aura::client::kCanMaximizeKey);
oshima 2014/09/11 01:00:05 This should be window->GetProperty(aura::client::
jackhou1 2014/09/11 01:52:42 Ah I see. BTW, GetMaximumSize will return 0x200 i
}
@@ -168,10 +174,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 {
« no previous file with comments | « no previous file | ash/wm/window_state_unittest.cc » ('j') | ash/wm/window_state_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698