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

Side by Side Diff: ash/wm/default_state.cc

Issue 597683003: Add window states docked; and docked minimized. Add wm window event to set docked and undocked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dock
Patch Set: Address Restore of App Windows and DockLeft/Dock Right issues Created 6 years, 2 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
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/wm/default_state.h" 5 #include "ash/wm/default_state.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/screen_util.h" 8 #include "ash/screen_util.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 DefaultState::~DefaultState() {} 71 DefaultState::~DefaultState() {}
72 72
73 void DefaultState::OnWMEvent(WindowState* window_state, 73 void DefaultState::OnWMEvent(WindowState* window_state,
74 const WMEvent* event) { 74 const WMEvent* event) {
75 if (ProcessWorkspaceEvents(window_state, event)) 75 if (ProcessWorkspaceEvents(window_state, event))
76 return; 76 return;
77 77
78 if (ProcessCompoundEvents(window_state, event)) 78 if (ProcessCompoundEvents(window_state, event))
79 return; 79 return;
80 80
81 WindowStateType current_state_type = window_state->GetStateType();
81 WindowStateType next_state_type = WINDOW_STATE_TYPE_NORMAL; 82 WindowStateType next_state_type = WINDOW_STATE_TYPE_NORMAL;
82 switch (event->type()) { 83 switch (event->type()) {
83 case WM_EVENT_NORMAL: 84 case WM_EVENT_NORMAL:
84 next_state_type = WINDOW_STATE_TYPE_NORMAL; 85 next_state_type =
86 current_state_type == WINDOW_STATE_TYPE_DOCKED_MINIMIZED ?
87 WINDOW_STATE_TYPE_DOCKED : WINDOW_STATE_TYPE_NORMAL;
varkha 2014/09/29 18:59:28 nit: indent 4.
dtapuska 2014/09/29 20:59:56 Done.
85 break; 88 break;
86 case WM_EVENT_MAXIMIZE: 89 case WM_EVENT_MAXIMIZE:
87 next_state_type = WINDOW_STATE_TYPE_MAXIMIZED; 90 next_state_type = WINDOW_STATE_TYPE_MAXIMIZED;
88 break; 91 break;
89 case WM_EVENT_MINIMIZE: 92 case WM_EVENT_MINIMIZE:
90 next_state_type = WINDOW_STATE_TYPE_MINIMIZED; 93 next_state_type =
94 current_state_type == WINDOW_STATE_TYPE_DOCKED ?
95 WINDOW_STATE_TYPE_DOCKED_MINIMIZED : WINDOW_STATE_TYPE_MINIMIZED;
varkha 2014/09/29 18:59:28 nit: indent 4.
dtapuska 2014/09/29 20:59:56 Done.
91 break; 96 break;
92 case WM_EVENT_FULLSCREEN: 97 case WM_EVENT_FULLSCREEN:
93 next_state_type = WINDOW_STATE_TYPE_FULLSCREEN; 98 next_state_type = WINDOW_STATE_TYPE_FULLSCREEN;
94 break; 99 break;
95 case WM_EVENT_SNAP_LEFT: 100 case WM_EVENT_SNAP_LEFT:
96 next_state_type = WINDOW_STATE_TYPE_LEFT_SNAPPED; 101 next_state_type = WINDOW_STATE_TYPE_LEFT_SNAPPED;
97 break; 102 break;
98 case WM_EVENT_SNAP_RIGHT: 103 case WM_EVENT_SNAP_RIGHT:
99 next_state_type = WINDOW_STATE_TYPE_RIGHT_SNAPPED; 104 next_state_type = WINDOW_STATE_TYPE_RIGHT_SNAPPED;
100 break; 105 break;
106 case WM_EVENT_DOCK:
107 next_state_type = WINDOW_STATE_TYPE_DOCKED;
108 break;
101 case WM_EVENT_SET_BOUNDS: 109 case WM_EVENT_SET_BOUNDS:
102 SetBounds(window_state, static_cast<const SetBoundsEvent*>(event)); 110 SetBounds(window_state, static_cast<const SetBoundsEvent*>(event));
103 return; 111 return;
104 case WM_EVENT_SHOW_INACTIVE: 112 case WM_EVENT_SHOW_INACTIVE:
105 next_state_type = WINDOW_STATE_TYPE_INACTIVE; 113 next_state_type = WINDOW_STATE_TYPE_INACTIVE;
106 break; 114 break;
107 case WM_EVENT_TOGGLE_MAXIMIZE_CAPTION: 115 case WM_EVENT_TOGGLE_MAXIMIZE_CAPTION:
108 case WM_EVENT_TOGGLE_MAXIMIZE: 116 case WM_EVENT_TOGGLE_MAXIMIZE:
109 case WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE: 117 case WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE:
110 case WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE: 118 case WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE:
111 case WM_EVENT_TOGGLE_FULLSCREEN: 119 case WM_EVENT_TOGGLE_FULLSCREEN:
112 case WM_EVENT_CENTER: 120 case WM_EVENT_CENTER:
113 NOTREACHED() << "Compound event should not reach here:" << event; 121 NOTREACHED() << "Compound event should not reach here:" << event;
114 return; 122 return;
115 case WM_EVENT_ADDED_TO_WORKSPACE: 123 case WM_EVENT_ADDED_TO_WORKSPACE:
116 case WM_EVENT_WORKAREA_BOUNDS_CHANGED: 124 case WM_EVENT_WORKAREA_BOUNDS_CHANGED:
117 case WM_EVENT_DISPLAY_BOUNDS_CHANGED: 125 case WM_EVENT_DISPLAY_BOUNDS_CHANGED:
118 NOTREACHED() << "Workspace event should not reach here:" << event; 126 NOTREACHED() << "Workspace event should not reach here:" << event;
119 return; 127 return;
120 } 128 }
121 129
122 WindowStateType current = window_state->GetStateType(); 130 if (next_state_type == current_state_type && window_state->IsSnapped()) {
123
124 if (next_state_type == current && window_state->IsSnapped()) {
125 gfx::Rect snapped_bounds = event->type() == WM_EVENT_SNAP_LEFT ? 131 gfx::Rect snapped_bounds = event->type() == WM_EVENT_SNAP_LEFT ?
126 GetDefaultLeftSnappedWindowBoundsInParent(window_state->window()) : 132 GetDefaultLeftSnappedWindowBoundsInParent(window_state->window()) :
127 GetDefaultRightSnappedWindowBoundsInParent(window_state->window()); 133 GetDefaultRightSnappedWindowBoundsInParent(window_state->window());
128 window_state->SetBoundsDirectAnimated(snapped_bounds); 134 window_state->SetBoundsDirectAnimated(snapped_bounds);
129 return; 135 return;
130 } 136 }
131 137
132 EnterToNextState(window_state, next_state_type); 138 EnterToNextState(window_state, next_state_type);
133 } 139 }
134 140
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 CenterWindow(window_state); 272 CenterWindow(window_state);
267 return true; 273 return true;
268 case WM_EVENT_NORMAL: 274 case WM_EVENT_NORMAL:
269 case WM_EVENT_MAXIMIZE: 275 case WM_EVENT_MAXIMIZE:
270 case WM_EVENT_MINIMIZE: 276 case WM_EVENT_MINIMIZE:
271 case WM_EVENT_FULLSCREEN: 277 case WM_EVENT_FULLSCREEN:
272 case WM_EVENT_SNAP_LEFT: 278 case WM_EVENT_SNAP_LEFT:
273 case WM_EVENT_SNAP_RIGHT: 279 case WM_EVENT_SNAP_RIGHT:
274 case WM_EVENT_SET_BOUNDS: 280 case WM_EVENT_SET_BOUNDS:
275 case WM_EVENT_SHOW_INACTIVE: 281 case WM_EVENT_SHOW_INACTIVE:
282 case WM_EVENT_DOCK:
276 break; 283 break;
277 case WM_EVENT_ADDED_TO_WORKSPACE: 284 case WM_EVENT_ADDED_TO_WORKSPACE:
278 case WM_EVENT_WORKAREA_BOUNDS_CHANGED: 285 case WM_EVENT_WORKAREA_BOUNDS_CHANGED:
279 case WM_EVENT_DISPLAY_BOUNDS_CHANGED: 286 case WM_EVENT_DISPLAY_BOUNDS_CHANGED:
280 NOTREACHED() << "Workspace event should not reach here:" << event; 287 NOTREACHED() << "Workspace event should not reach here:" << event;
281 break; 288 break;
282 } 289 }
283 return false; 290 return false;
284 } 291 }
285 292
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 case WM_EVENT_TOGGLE_FULLSCREEN: 372 case WM_EVENT_TOGGLE_FULLSCREEN:
366 case WM_EVENT_CENTER: 373 case WM_EVENT_CENTER:
367 case WM_EVENT_NORMAL: 374 case WM_EVENT_NORMAL:
368 case WM_EVENT_MAXIMIZE: 375 case WM_EVENT_MAXIMIZE:
369 case WM_EVENT_MINIMIZE: 376 case WM_EVENT_MINIMIZE:
370 case WM_EVENT_FULLSCREEN: 377 case WM_EVENT_FULLSCREEN:
371 case WM_EVENT_SNAP_LEFT: 378 case WM_EVENT_SNAP_LEFT:
372 case WM_EVENT_SNAP_RIGHT: 379 case WM_EVENT_SNAP_RIGHT:
373 case WM_EVENT_SET_BOUNDS: 380 case WM_EVENT_SET_BOUNDS:
374 case WM_EVENT_SHOW_INACTIVE: 381 case WM_EVENT_SHOW_INACTIVE:
382 case WM_EVENT_DOCK:
375 break; 383 break;
376 } 384 }
377 return false; 385 return false;
378 } 386 }
379 387
380 // static 388 // static
381 bool DefaultState::SetMaximizedOrFullscreenBounds(WindowState* window_state) { 389 bool DefaultState::SetMaximizedOrFullscreenBounds(WindowState* window_state) {
382 DCHECK(!window_state->is_dragged()); 390 DCHECK(!window_state->is_dragged());
383 if (window_state->IsMaximized()) { 391 if (window_state->IsMaximized()) {
384 window_state->SetBoundsDirect( 392 window_state->SetBoundsDirect(
(...skipping 30 matching lines...) Expand all
415 // Do nothing if we're already in the same state. 423 // Do nothing if we're already in the same state.
416 if (state_type_ == next_state_type) 424 if (state_type_ == next_state_type)
417 return; 425 return;
418 426
419 WindowStateType previous_state_type = state_type_; 427 WindowStateType previous_state_type = state_type_;
420 state_type_ = next_state_type; 428 state_type_ = next_state_type;
421 429
422 window_state->UpdateWindowShowStateFromStateType(); 430 window_state->UpdateWindowShowStateFromStateType();
423 window_state->NotifyPreStateTypeChange(previous_state_type); 431 window_state->NotifyPreStateTypeChange(previous_state_type);
424 432
425 // This Docked/Snapped hack is due to the issue that IsDocked returns 433 if (window_state->window()->parent()) {
426 // true for dragging window. TODO(oshima): Make docked window a state
427 // and remove this hack.
428 if (window_state->window()->parent() &&
429 (window_state->IsSnapped() ||
430 (!window_state->IsDocked() && !IsPanel(window_state->window())))) {
431 if (!window_state->HasRestoreBounds() && 434 if (!window_state->HasRestoreBounds() &&
432 (previous_state_type == WINDOW_STATE_TYPE_DEFAULT || 435 (previous_state_type == WINDOW_STATE_TYPE_DEFAULT ||
433 previous_state_type == WINDOW_STATE_TYPE_NORMAL) && 436 previous_state_type == WINDOW_STATE_TYPE_NORMAL) &&
434 !window_state->IsMinimized() && 437 !window_state->IsMinimized() &&
435 !window_state->IsNormalStateType()) { 438 !window_state->IsNormalStateType()) {
436 window_state->SaveCurrentBoundsForRestore(); 439 window_state->SaveCurrentBoundsForRestore();
440 } else if (window_state->HasRestoreBounds() &&
441 window_state->IsNormalStateType() &&
442 previous_state_type == WINDOW_STATE_TYPE_DOCKED) {
443 UpdateBoundsFromState(window_state, previous_state_type);
444
437 } 445 }
438 446
439 // When restoring from a minimized state, we want to restore to the previous 447 // This Docked/Snapped hack is due to the issue that IsDocked returns
440 // bounds. However, we want to maintain the restore bounds. (The restore 448 // true for dragging window. TODO(oshima): Make docked window a state
441 // bounds are set if a user maximized the window in one axis by double 449 // and remove this hack.
varkha 2014/09/29 18:59:28 Maybe rephrase a bit now that the docked state is
dtapuska 2014/09/29 20:59:56 Done.
442 // clicking the window border for example). 450 if (window_state->IsSnapped() ||
443 gfx::Rect restore_bounds_in_screen; 451 (!window_state->IsDocked() && !IsPanel(window_state->window()))) {
444 if (previous_state_type == WINDOW_STATE_TYPE_MINIMIZED && 452 // When restoring from a minimized state, we want to restore to the
445 window_state->IsNormalStateType() && 453 // previous bounds. However, we want to maintain the restore bounds.
446 window_state->HasRestoreBounds() && 454 // (The restore bounds are set if a user maximized the window in one
447 !window_state->unminimize_to_restore_bounds()) { 455 // axis by double clicking the window border for example).
448 restore_bounds_in_screen = window_state->GetRestoreBoundsInScreen(); 456 gfx::Rect restore_bounds_in_screen;
449 window_state->SaveCurrentBoundsForRestore(); 457 if (previous_state_type == WINDOW_STATE_TYPE_MINIMIZED &&
458 window_state->IsNormalStateType() &&
459 window_state->HasRestoreBounds() &&
460 !window_state->unminimize_to_restore_bounds()) {
461 restore_bounds_in_screen = window_state->GetRestoreBoundsInScreen();
462 window_state->SaveCurrentBoundsForRestore();
463 }
464
465 if (window_state->IsMaximizedOrFullscreen())
466 MoveToDisplayForRestore(window_state);
467
468 UpdateBoundsFromState(window_state, previous_state_type);
469
470 // Normal state should have no restore bounds unless it's
471 // unminimized.
472 if (!restore_bounds_in_screen.IsEmpty())
473 window_state->SetRestoreBoundsInScreen(restore_bounds_in_screen);
474 else if (window_state->IsNormalStateType())
475 window_state->ClearRestoreBounds();
450 } 476 }
451
452 if (window_state->IsMaximizedOrFullscreen())
453 MoveToDisplayForRestore(window_state);
454
455 UpdateBoundsFromState(window_state, previous_state_type);
456
457 // Normal state should have no restore bounds unless it's
458 // unminimzied.
459 if (!restore_bounds_in_screen.IsEmpty())
460 window_state->SetRestoreBoundsInScreen(restore_bounds_in_screen);
461 else if (window_state->IsNormalStateType())
462 window_state->ClearRestoreBounds();
463 } 477 }
464 window_state->NotifyPostStateTypeChange(previous_state_type); 478 window_state->NotifyPostStateTypeChange(previous_state_type);
465 } 479 }
466 480
467 void DefaultState::ReenterToCurrentState( 481 void DefaultState::ReenterToCurrentState(
468 WindowState* window_state, 482 WindowState* window_state,
469 WindowState::State* state_in_previous_mode) { 483 WindowState::State* state_in_previous_mode) {
470 WindowStateType previous_state_type = state_in_previous_mode->GetType(); 484 WindowStateType previous_state_type = state_in_previous_mode->GetType();
471 if (previous_state_type == wm::WINDOW_STATE_TYPE_FULLSCREEN) { 485 if (previous_state_type == wm::WINDOW_STATE_TYPE_FULLSCREEN) {
472 // A state change should not move a window out of full screen since full 486 // A state change should not move a window out of full screen since full
(...skipping 27 matching lines...) Expand all
500 WindowStateType previous_state_type) { 514 WindowStateType previous_state_type) {
501 aura::Window* window = window_state->window(); 515 aura::Window* window = window_state->window();
502 gfx::Rect bounds_in_parent; 516 gfx::Rect bounds_in_parent;
503 switch (state_type_) { 517 switch (state_type_) {
504 case WINDOW_STATE_TYPE_LEFT_SNAPPED: 518 case WINDOW_STATE_TYPE_LEFT_SNAPPED:
505 case WINDOW_STATE_TYPE_RIGHT_SNAPPED: 519 case WINDOW_STATE_TYPE_RIGHT_SNAPPED:
506 bounds_in_parent = state_type_ == WINDOW_STATE_TYPE_LEFT_SNAPPED ? 520 bounds_in_parent = state_type_ == WINDOW_STATE_TYPE_LEFT_SNAPPED ?
507 GetDefaultLeftSnappedWindowBoundsInParent(window_state->window()) : 521 GetDefaultLeftSnappedWindowBoundsInParent(window_state->window()) :
508 GetDefaultRightSnappedWindowBoundsInParent(window_state->window()); 522 GetDefaultRightSnappedWindowBoundsInParent(window_state->window());
509 break; 523 break;
524 case WINDOW_STATE_TYPE_DOCKED:
510 case WINDOW_STATE_TYPE_DEFAULT: 525 case WINDOW_STATE_TYPE_DEFAULT:
511 case WINDOW_STATE_TYPE_NORMAL: { 526 case WINDOW_STATE_TYPE_NORMAL: {
512 gfx::Rect work_area_in_parent = 527 gfx::Rect work_area_in_parent =
513 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window()); 528 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window());
514 if (window_state->HasRestoreBounds()) { 529 if (window_state->HasRestoreBounds()) {
515 bounds_in_parent = window_state->GetRestoreBoundsInParent(); 530 bounds_in_parent = window_state->GetRestoreBoundsInParent();
516 // Check if the |window|'s restored size is bigger than the working area 531 // Check if the |window|'s restored size is bigger than the working area
517 // This may happen if a window was resized to maximized bounds or if the 532 // This may happen if a window was resized to maximized bounds or if the
518 // display resolution changed while the window was maximized. 533 // display resolution changed while the window was maximized.
519 if (previous_state_type == WINDOW_STATE_TYPE_MAXIMIZED && 534 if (previous_state_type == WINDOW_STATE_TYPE_MAXIMIZED &&
(...skipping 13 matching lines...) Expand all
533 break; 548 break;
534 } 549 }
535 case WINDOW_STATE_TYPE_MAXIMIZED: 550 case WINDOW_STATE_TYPE_MAXIMIZED:
536 bounds_in_parent = ScreenUtil::GetMaximizedWindowBoundsInParent(window); 551 bounds_in_parent = ScreenUtil::GetMaximizedWindowBoundsInParent(window);
537 break; 552 break;
538 553
539 case WINDOW_STATE_TYPE_FULLSCREEN: 554 case WINDOW_STATE_TYPE_FULLSCREEN:
540 bounds_in_parent = ScreenUtil::GetDisplayBoundsInParent(window); 555 bounds_in_parent = ScreenUtil::GetDisplayBoundsInParent(window);
541 break; 556 break;
542 557
558 case WINDOW_STATE_TYPE_DOCKED_MINIMIZED:
543 case WINDOW_STATE_TYPE_MINIMIZED: 559 case WINDOW_STATE_TYPE_MINIMIZED:
544 break; 560 break;
545 case WINDOW_STATE_TYPE_INACTIVE: 561 case WINDOW_STATE_TYPE_INACTIVE:
546 case WINDOW_STATE_TYPE_END: 562 case WINDOW_STATE_TYPE_END:
547 case WINDOW_STATE_TYPE_AUTO_POSITIONED: 563 case WINDOW_STATE_TYPE_AUTO_POSITIONED:
548 return; 564 return;
549 } 565 }
550 566
551 if (state_type_ != WINDOW_STATE_TYPE_MINIMIZED) { 567 if (!window_state->IsMinimized()) {
552 if (previous_state_type == WINDOW_STATE_TYPE_MINIMIZED || 568 if (previous_state_type == WINDOW_STATE_TYPE_MINIMIZED ||
569 previous_state_type == WINDOW_STATE_TYPE_DOCKED_MINIMIZED ||
varkha 2014/09/29 18:59:28 nit: consider a variable or function to compare to
dtapuska 2014/09/29 20:59:56 Done.
553 window_state->IsFullscreen()) { 570 window_state->IsFullscreen()) {
554 window_state->SetBoundsDirect(bounds_in_parent); 571 window_state->SetBoundsDirect(bounds_in_parent);
555 } else if (window_state->IsMaximized() || 572 } else if (window_state->IsMaximized() ||
556 IsMaximizedOrFullscreenWindowStateType(previous_state_type)) { 573 IsMaximizedOrFullscreenWindowStateType(previous_state_type)) {
557 window_state->SetBoundsDirectCrossFade(bounds_in_parent); 574 window_state->SetBoundsDirectCrossFade(bounds_in_parent);
558 } else if (window_state->is_dragged()) { 575 } else if (window_state->is_dragged()) {
559 // SetBoundsDirectAnimated does not work when the window gets reparented. 576 // SetBoundsDirectAnimated does not work when the window gets reparented.
560 // TODO(oshima): Consider fixing it and reenable the animation. 577 // TODO(oshima): Consider fixing it and reenable the animation.
561 window_state->SetBoundsDirect(bounds_in_parent); 578 window_state->SetBoundsDirect(bounds_in_parent);
562 } else { 579 } else {
563 window_state->SetBoundsDirectAnimated(bounds_in_parent); 580 window_state->SetBoundsDirectAnimated(bounds_in_parent);
564 } 581 }
565 } 582 }
566 583
567 if (window_state->IsMinimized()) { 584 if (window_state->IsMinimized()) {
568 // Save the previous show state so that we can correctly restore it. 585 // Save the previous show state so that we can correctly restore it.
569 window_state->window()->SetProperty(aura::client::kRestoreShowStateKey, 586 window_state->window()->SetProperty(aura::client::kRestoreShowStateKey,
570 ToWindowShowState(previous_state_type)); 587 ToWindowShowState(previous_state_type));
571 ::wm::SetWindowVisibilityAnimationType( 588 ::wm::SetWindowVisibilityAnimationType(
572 window_state->window(), WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE); 589 window_state->window(), WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
573 590
574 // Hide the window. 591 // Hide the window.
575 window_state->window()->Hide(); 592 window_state->window()->Hide();
576 // Activate another window. 593 // Activate another window.
577 if (window_state->IsActive()) 594 if (window_state->IsActive())
578 window_state->Deactivate(); 595 window_state->Deactivate();
579 } else if ((window_state->window()->TargetVisibility() || 596 } else if ((window_state->window()->TargetVisibility() ||
580 previous_state_type == WINDOW_STATE_TYPE_MINIMIZED) && 597 (previous_state_type == WINDOW_STATE_TYPE_MINIMIZED ||
598 previous_state_type == WINDOW_STATE_TYPE_DOCKED_MINIMIZED)) &&
581 !window_state->window()->layer()->visible()) { 599 !window_state->window()->layer()->visible()) {
582 // The layer may be hidden if the window was previously minimized. Make 600 // The layer may be hidden if the window was previously minimized. Make
583 // sure it's visible. 601 // sure it's visible.
584 window_state->window()->Show(); 602 window_state->window()->Show();
585 if (previous_state_type == WINDOW_STATE_TYPE_MINIMIZED && 603 if ((previous_state_type == WINDOW_STATE_TYPE_MINIMIZED ||
604 previous_state_type == WINDOW_STATE_TYPE_DOCKED_MINIMIZED) &&
586 !window_state->IsMaximizedOrFullscreen()) { 605 !window_state->IsMaximizedOrFullscreen()) {
587 window_state->set_unminimize_to_restore_bounds(false); 606 window_state->set_unminimize_to_restore_bounds(false);
588 } 607 }
589 } 608 }
590 } 609 }
591 610
592 // static 611 // static
593 void DefaultState::CenterWindow(WindowState* window_state) { 612 void DefaultState::CenterWindow(WindowState* window_state) {
594 if (!window_state->IsNormalOrSnapped()) 613 if (!window_state->IsNormalOrSnapped())
595 return; 614 return;
(...skipping 12 matching lines...) Expand all
608 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window); 627 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window);
609 center_in_parent.ClampToCenteredSize(window->bounds().size()); 628 center_in_parent.ClampToCenteredSize(window->bounds().size());
610 window_state->SetBoundsDirectAnimated(center_in_parent); 629 window_state->SetBoundsDirectAnimated(center_in_parent);
611 } 630 }
612 // Centering window is treated as if a user moved and resized the window. 631 // Centering window is treated as if a user moved and resized the window.
613 window_state->set_bounds_changed_by_user(true); 632 window_state->set_bounds_changed_by_user(true);
614 } 633 }
615 634
616 } // namespace wm 635 } // namespace wm
617 } // namespace ash 636 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698