| 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/maximize_mode/maximize_mode_window_state.h" | 5 #include "ash/common/wm/maximize_mode/maximize_mode_window_state.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" | 9 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" |
| 10 #include "ash/common/wm/window_animation_types.h" | 10 #include "ash/common/wm/window_animation_types.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 case wm::WM_EVENT_DOCK: | 160 case wm::WM_EVENT_DOCK: |
| 161 UpdateWindow(window_state, GetMaximizedOrCenteredWindowType(window_state), | 161 UpdateWindow(window_state, GetMaximizedOrCenteredWindowType(window_state), |
| 162 true); | 162 true); |
| 163 return; | 163 return; |
| 164 case wm::WM_EVENT_MINIMIZE: | 164 case wm::WM_EVENT_MINIMIZE: |
| 165 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_MINIMIZED, true); | 165 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_MINIMIZED, true); |
| 166 return; | 166 return; |
| 167 case wm::WM_EVENT_SHOW_INACTIVE: | 167 case wm::WM_EVENT_SHOW_INACTIVE: |
| 168 return; | 168 return; |
| 169 case wm::WM_EVENT_SET_BOUNDS: | 169 case wm::WM_EVENT_SET_BOUNDS: |
| 170 if (window_state->allow_set_bounds_in_maximized()) { | 170 if (current_state_type_ == wm::WINDOW_STATE_TYPE_MAXIMIZED) { |
| 171 window_state->SetBoundsConstrained( | |
| 172 static_cast<const wm::SetBoundsEvent*>(event)->requested_bounds()); | |
| 173 } else if (current_state_type_ == wm::WINDOW_STATE_TYPE_MAXIMIZED) { | |
| 174 // Having a maximized window, it could have been created with an empty | 171 // Having a maximized window, it could have been created with an empty |
| 175 // size and the caller should get his size upon leaving the maximized | 172 // size and the caller should get his size upon leaving the maximized |
| 176 // mode. As such we set the restore bounds to the requested bounds. | 173 // mode. As such we set the restore bounds to the requested bounds. |
| 177 gfx::Rect bounds_in_parent = | 174 gfx::Rect bounds_in_parent = |
| 178 (static_cast<const wm::SetBoundsEvent*>(event))->requested_bounds(); | 175 (static_cast<const wm::SetBoundsEvent*>(event))->requested_bounds(); |
| 179 if (!bounds_in_parent.IsEmpty()) | 176 if (!bounds_in_parent.IsEmpty()) |
| 180 window_state->SetRestoreBoundsInParent(bounds_in_parent); | 177 window_state->SetRestoreBoundsInParent(bounds_in_parent); |
| 181 } else if (current_state_type_ != wm::WINDOW_STATE_TYPE_MINIMIZED && | 178 } else if (current_state_type_ != wm::WINDOW_STATE_TYPE_MINIMIZED && |
| 182 current_state_type_ != wm::WINDOW_STATE_TYPE_FULLSCREEN && | 179 current_state_type_ != wm::WINDOW_STATE_TYPE_FULLSCREEN && |
| 183 current_state_type_ != wm::WINDOW_STATE_TYPE_PINNED && | 180 current_state_type_ != wm::WINDOW_STATE_TYPE_PINNED && |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 // avoid flashing. | 325 // avoid flashing. |
| 329 if (window_state->IsMaximized()) | 326 if (window_state->IsMaximized()) |
| 330 window_state->SetBoundsDirectCrossFade(bounds_in_parent); | 327 window_state->SetBoundsDirectCrossFade(bounds_in_parent); |
| 331 else | 328 else |
| 332 window_state->SetBoundsDirectAnimated(bounds_in_parent); | 329 window_state->SetBoundsDirectAnimated(bounds_in_parent); |
| 333 } | 330 } |
| 334 } | 331 } |
| 335 } | 332 } |
| 336 | 333 |
| 337 } // namespace ash | 334 } // namespace ash |
| OLD | NEW |