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