| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/wm/default_state.h" | 5 #include "ash/common/wm/default_state.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_switches.h" | 7 #include "ash/common/ash_switches.h" |
| 8 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 8 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
| 9 #include "ash/common/wm/window_animation_types.h" | 9 #include "ash/common/wm/window_animation_types.h" |
| 10 #include "ash/common/wm/window_parenting_utils.h" | 10 #include "ash/common/wm/window_parenting_utils.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 if (next_state_type == current_state_type && window_state->IsSnapped()) { | 273 if (next_state_type == current_state_type && window_state->IsSnapped()) { |
| 274 gfx::Rect snapped_bounds = | 274 gfx::Rect snapped_bounds = |
| 275 event->type() == WM_EVENT_SNAP_LEFT | 275 event->type() == WM_EVENT_SNAP_LEFT |
| 276 ? GetDefaultLeftSnappedWindowBoundsInParent(window_state->window()) | 276 ? GetDefaultLeftSnappedWindowBoundsInParent(window_state->window()) |
| 277 : GetDefaultRightSnappedWindowBoundsInParent( | 277 : GetDefaultRightSnappedWindowBoundsInParent( |
| 278 window_state->window()); | 278 window_state->window()); |
| 279 window_state->SetBoundsDirectAnimated(snapped_bounds); | 279 window_state->SetBoundsDirectAnimated(snapped_bounds); |
| 280 return; | 280 return; |
| 281 } | 281 } |
| 282 | 282 |
| 283 if (event->type() == WM_EVENT_SNAP_LEFT || |
| 284 event->type() == WM_EVENT_SNAP_RIGHT) { |
| 285 window_state->set_bounds_changed_by_user(true); |
| 286 } |
| 287 |
| 283 EnterToNextState(window_state, next_state_type); | 288 EnterToNextState(window_state, next_state_type); |
| 284 } | 289 } |
| 285 | 290 |
| 286 WindowStateType DefaultState::GetType() const { | 291 WindowStateType DefaultState::GetType() const { |
| 287 return state_type_; | 292 return state_type_; |
| 288 } | 293 } |
| 289 | 294 |
| 290 void DefaultState::AttachState(WindowState* window_state, | 295 void DefaultState::AttachState(WindowState* window_state, |
| 291 WindowState::State* state_in_previous_mode) { | 296 WindowState::State* state_in_previous_mode) { |
| 292 DCHECK_EQ(stored_window_state_, window_state); | 297 DCHECK_EQ(stored_window_state_, window_state); |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); | 814 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); |
| 810 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); | 815 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); |
| 811 window_state->SetBoundsDirectAnimated(center_in_parent); | 816 window_state->SetBoundsDirectAnimated(center_in_parent); |
| 812 } | 817 } |
| 813 // Centering window is treated as if a user moved and resized the window. | 818 // Centering window is treated as if a user moved and resized the window. |
| 814 window_state->set_bounds_changed_by_user(true); | 819 window_state->set_bounds_changed_by_user(true); |
| 815 } | 820 } |
| 816 | 821 |
| 817 } // namespace wm | 822 } // namespace wm |
| 818 } // namespace ash | 823 } // namespace ash |
| OLD | NEW |