Index: ash/wm/window_state.cc |
diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc |
index 1a06a58da1bb0a0b876bb2c64457d10d234feab1..4e603f838fcbc0fc7744660f2da059948a6f2c2a 100644 |
--- a/ash/wm/window_state.cc |
+++ b/ash/wm/window_state.cc |
@@ -136,7 +136,7 @@ void WindowState::SnapLeft(const gfx::Rect& bounds) { |
} |
void WindowState::SnapRight(const gfx::Rect& bounds) { |
- SnapWindow(SHOW_TYPE_LEFT_SNAPPED, bounds); |
+ SnapWindow(SHOW_TYPE_RIGHT_SNAPPED, bounds); |
varkha
2013/11/20 00:11:13
We did not really use this show type so everything
|
} |
void WindowState::Minimize() { |
@@ -244,6 +244,20 @@ void WindowState::SetTrackedByWorkspace(bool tracked_by_workspace) { |
OnTrackedByWorkspaceChanged(this, old)); |
} |
+void WindowState::SetWindowShowTypeUnsnapped() { |
+ if (window_show_type_ != SHOW_TYPE_LEFT_SNAPPED && |
+ window_show_type_ != SHOW_TYPE_RIGHT_SNAPPED) { |
+ return; |
+ } |
+ window_show_type_ = SHOW_TYPE_NORMAL; |
+} |
+ |
+void WindowState::SetBoundsChangedByUser(bool bounds_changed_by_user) { |
+ bounds_changed_by_user_ = bounds_changed_by_user; |
+ if (bounds_changed_by_user_) |
+ SetWindowShowTypeUnsnapped(); |
+} |
+ |
void WindowState::OnWindowPropertyChanged(aura::Window* window, |
const void* key, |
intptr_t old) { |
@@ -265,6 +279,13 @@ void WindowState::OnWindowDestroying(aura::Window* window) { |
void WindowState::SnapWindow(WindowShowType left_or_right, |
const gfx::Rect& bounds) { |
+ DCHECK(left_or_right == SHOW_TYPE_LEFT_SNAPPED || |
+ left_or_right == SHOW_TYPE_RIGHT_SNAPPED); |
+ WindowShowType old_type = window_show_type_; |
+ window_show_type_ = left_or_right; |
+ FOR_EACH_OBSERVER( |
+ WindowStateObserver, observer_list_, |
+ OnWindowShowTypeChanged(this, old_type)); |
if (IsMaximizedOrFullscreen()) { |
// Before we can set the bounds we need to restore the window. |
// Restoring the window will set the window to its restored bounds. |
@@ -280,9 +301,6 @@ void WindowState::SnapWindow(WindowShowType left_or_right, |
} else { |
window_->SetBounds(bounds); |
} |
- DCHECK(left_or_right == SHOW_TYPE_LEFT_SNAPPED || |
- left_or_right == SHOW_TYPE_RIGHT_SNAPPED); |
- window_show_type_ = left_or_right; |
} |
WindowState* GetActiveWindowState() { |