| 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/shell_window_ids.h" | 9 #include "ash/common/shell_window_ids.h" |
| 10 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" | 10 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 case wm::WM_EVENT_DOCK: | 156 case wm::WM_EVENT_DOCK: |
| 157 UpdateWindow(window_state, GetMaximizedOrCenteredWindowType(window_state), | 157 UpdateWindow(window_state, GetMaximizedOrCenteredWindowType(window_state), |
| 158 true); | 158 true); |
| 159 return; | 159 return; |
| 160 case wm::WM_EVENT_MINIMIZE: | 160 case wm::WM_EVENT_MINIMIZE: |
| 161 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_MINIMIZED, true); | 161 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_MINIMIZED, true); |
| 162 return; | 162 return; |
| 163 case wm::WM_EVENT_SHOW_INACTIVE: | 163 case wm::WM_EVENT_SHOW_INACTIVE: |
| 164 return; | 164 return; |
| 165 case wm::WM_EVENT_SET_BOUNDS: | 165 case wm::WM_EVENT_SET_BOUNDS: |
| 166 if (current_state_type_ == wm::WINDOW_STATE_TYPE_MAXIMIZED) { | 166 if (window_state->allow_set_bounds_in_maximized()) { |
| 167 window_state->SetBoundsConstrained( |
| 168 static_cast<const wm::SetBoundsEvent*>(event)->requested_bounds()); |
| 169 } else if (current_state_type_ == wm::WINDOW_STATE_TYPE_MAXIMIZED) { |
| 167 // Having a maximized window, it could have been created with an empty | 170 // Having a maximized window, it could have been created with an empty |
| 168 // size and the caller should get his size upon leaving the maximized | 171 // size and the caller should get his size upon leaving the maximized |
| 169 // mode. As such we set the restore bounds to the requested bounds. | 172 // mode. As such we set the restore bounds to the requested bounds. |
| 170 gfx::Rect bounds_in_parent = | 173 gfx::Rect bounds_in_parent = |
| 171 (static_cast<const wm::SetBoundsEvent*>(event))->requested_bounds(); | 174 (static_cast<const wm::SetBoundsEvent*>(event))->requested_bounds(); |
| 172 if (!bounds_in_parent.IsEmpty()) | 175 if (!bounds_in_parent.IsEmpty()) |
| 173 window_state->SetRestoreBoundsInParent(bounds_in_parent); | 176 window_state->SetRestoreBoundsInParent(bounds_in_parent); |
| 174 } else if (current_state_type_ != wm::WINDOW_STATE_TYPE_MINIMIZED && | 177 } else if (current_state_type_ != wm::WINDOW_STATE_TYPE_MINIMIZED && |
| 175 current_state_type_ != wm::WINDOW_STATE_TYPE_FULLSCREEN && | 178 current_state_type_ != wm::WINDOW_STATE_TYPE_FULLSCREEN && |
| 176 current_state_type_ != wm::WINDOW_STATE_TYPE_PINNED) { | 179 current_state_type_ != wm::WINDOW_STATE_TYPE_PINNED) { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 // avoid flashing. | 319 // avoid flashing. |
| 317 if (window_state->IsMaximized()) | 320 if (window_state->IsMaximized()) |
| 318 window_state->SetBoundsDirectCrossFade(bounds_in_parent); | 321 window_state->SetBoundsDirectCrossFade(bounds_in_parent); |
| 319 else | 322 else |
| 320 window_state->SetBoundsDirectAnimated(bounds_in_parent); | 323 window_state->SetBoundsDirectAnimated(bounds_in_parent); |
| 321 } | 324 } |
| 322 } | 325 } |
| 323 } | 326 } |
| 324 | 327 |
| 325 } // namespace ash | 328 } // namespace ash |
| OLD | NEW |