Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(763)

Side by Side Diff: ash/common/wm/maximize_mode/maximize_mode_window_state.cc

Issue 2193783003: Notify WindowStateObserver when minimizing in maximized mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/BUILD.gn ('k') | ash/common/wm/window_state_observer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 void MaximizeModeWindowState::UpdateWindow(wm::WindowState* window_state, 247 void MaximizeModeWindowState::UpdateWindow(wm::WindowState* window_state,
248 wm::WindowStateType target_state, 248 wm::WindowStateType target_state,
249 bool animated) { 249 bool animated) {
250 DCHECK(target_state == wm::WINDOW_STATE_TYPE_MINIMIZED || 250 DCHECK(target_state == wm::WINDOW_STATE_TYPE_MINIMIZED ||
251 target_state == wm::WINDOW_STATE_TYPE_MAXIMIZED || 251 target_state == wm::WINDOW_STATE_TYPE_MAXIMIZED ||
252 target_state == wm::WINDOW_STATE_TYPE_PINNED || 252 target_state == wm::WINDOW_STATE_TYPE_PINNED ||
253 (target_state == wm::WINDOW_STATE_TYPE_NORMAL && 253 (target_state == wm::WINDOW_STATE_TYPE_NORMAL &&
254 !window_state->CanMaximize()) || 254 !window_state->CanMaximize()) ||
255 target_state == wm::WINDOW_STATE_TYPE_FULLSCREEN); 255 target_state == wm::WINDOW_STATE_TYPE_FULLSCREEN);
256 256
257 if (target_state == wm::WINDOW_STATE_TYPE_MINIMIZED) { 257 if (current_state_type_ == target_state) {
258 if (current_state_type_ == wm::WINDOW_STATE_TYPE_MINIMIZED) 258 if (target_state == wm::WINDOW_STATE_TYPE_MINIMIZED)
259 return; 259 return;
260
261 current_state_type_ = target_state;
262 window_state->window()->SetVisibilityAnimationType(
263 wm::WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
264 window_state->window()->Hide();
265 if (window_state->IsActive())
266 window_state->Deactivate();
267 return;
268 }
269
270 if (current_state_type_ == target_state) {
271 // If the state type did not change, update it accordingly. 260 // If the state type did not change, update it accordingly.
272 UpdateBounds(window_state, animated); 261 UpdateBounds(window_state, animated);
273 return; 262 return;
274 } 263 }
275 264
276 const wm::WindowStateType old_state_type = current_state_type_; 265 const wm::WindowStateType old_state_type = current_state_type_;
277 current_state_type_ = target_state; 266 current_state_type_ = target_state;
278 window_state->UpdateWindowShowStateFromStateType(); 267 window_state->UpdateWindowShowStateFromStateType();
279 window_state->NotifyPreStateTypeChange(old_state_type); 268 window_state->NotifyPreStateTypeChange(old_state_type);
280 UpdateBounds(window_state, animated); 269
270 if (target_state == wm::WINDOW_STATE_TYPE_MINIMIZED) {
271 window_state->window()->SetVisibilityAnimationType(
272 wm::WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
273 window_state->window()->Hide();
274 if (window_state->IsActive())
275 window_state->Deactivate();
276 } else {
277 UpdateBounds(window_state, animated);
278 }
279
281 window_state->NotifyPostStateTypeChange(old_state_type); 280 window_state->NotifyPostStateTypeChange(old_state_type);
282 281
283 if (old_state_type == wm::WINDOW_STATE_TYPE_PINNED || 282 if (old_state_type == wm::WINDOW_STATE_TYPE_PINNED ||
284 target_state == wm::WINDOW_STATE_TYPE_PINNED) { 283 target_state == wm::WINDOW_STATE_TYPE_PINNED) {
285 WmShell::Get()->SetPinnedWindow(window_state->window()); 284 WmShell::Get()->SetPinnedWindow(window_state->window());
286 } 285 }
287 286
288 if ((window_state->window()->GetTargetVisibility() || 287 if ((window_state->window()->GetTargetVisibility() ||
289 old_state_type == wm::WINDOW_STATE_TYPE_MINIMIZED) && 288 old_state_type == wm::WINDOW_STATE_TYPE_MINIMIZED) &&
290 !window_state->window()->GetLayer()->visible()) { 289 !window_state->window()->GetLayer()->visible()) {
(...skipping 26 matching lines...) Expand all
317 // avoid flashing. 316 // avoid flashing.
318 if (window_state->IsMaximized()) 317 if (window_state->IsMaximized())
319 window_state->SetBoundsDirectCrossFade(bounds_in_parent); 318 window_state->SetBoundsDirectCrossFade(bounds_in_parent);
320 else 319 else
321 window_state->SetBoundsDirectAnimated(bounds_in_parent); 320 window_state->SetBoundsDirectAnimated(bounds_in_parent);
322 } 321 }
323 } 322 }
324 } 323 }
325 324
326 } // namespace ash 325 } // namespace ash
OLDNEW
« no previous file with comments | « ash/BUILD.gn ('k') | ash/common/wm/window_state_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698