| 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 (window_state->allow_set_bounds_in_maximized()) { |
| 167 window_state->SetBoundsConstrained( |
| 168 static_cast<const wm::SetBoundsEvent*>(event)->requested_bounds()); |
| 169 break; |
| 170 } |
| 171 |
| 166 if (current_state_type_ == wm::WINDOW_STATE_TYPE_MAXIMIZED) { | 172 if (current_state_type_ == wm::WINDOW_STATE_TYPE_MAXIMIZED) { |
| 167 // Having a maximized window, it could have been created with an empty | 173 // 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 | 174 // 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. | 175 // mode. As such we set the restore bounds to the requested bounds. |
| 170 gfx::Rect bounds_in_parent = | 176 gfx::Rect bounds_in_parent = |
| 171 (static_cast<const wm::SetBoundsEvent*>(event))->requested_bounds(); | 177 (static_cast<const wm::SetBoundsEvent*>(event))->requested_bounds(); |
| 172 if (!bounds_in_parent.IsEmpty()) | 178 if (!bounds_in_parent.IsEmpty()) |
| 173 window_state->SetRestoreBoundsInParent(bounds_in_parent); | 179 window_state->SetRestoreBoundsInParent(bounds_in_parent); |
| 174 } else if (current_state_type_ != wm::WINDOW_STATE_TYPE_MINIMIZED && | 180 } else if (current_state_type_ != wm::WINDOW_STATE_TYPE_MINIMIZED && |
| 175 current_state_type_ != wm::WINDOW_STATE_TYPE_FULLSCREEN && | 181 current_state_type_ != wm::WINDOW_STATE_TYPE_FULLSCREEN && |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 // avoid flashing. | 322 // avoid flashing. |
| 317 if (window_state->IsMaximized()) | 323 if (window_state->IsMaximized()) |
| 318 window_state->SetBoundsDirectCrossFade(bounds_in_parent); | 324 window_state->SetBoundsDirectCrossFade(bounds_in_parent); |
| 319 else | 325 else |
| 320 window_state->SetBoundsDirectAnimated(bounds_in_parent); | 326 window_state->SetBoundsDirectAnimated(bounds_in_parent); |
| 321 } | 327 } |
| 322 } | 328 } |
| 323 } | 329 } |
| 324 | 330 |
| 325 } // namespace ash | 331 } // namespace ash |
| OLD | NEW |