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

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

Issue 2622053004: ash: Restore previous show state after exiting fullscreen. (Closed)
Patch Set: Rebase Created 3 years, 11 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 | « no previous file | ash/common/wm/window_state_util.cc » ('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/default_state.h" 5 #include "ash/common/wm/default_state.h"
6 6
7 #include "ash/common/ash_switches.h" 7 #include "ash/common/ash_switches.h"
8 #include "ash/common/wm/dock/docked_window_layout_manager.h" 8 #include "ash/common/wm/dock/docked_window_layout_manager.h"
9 #include "ash/common/wm/window_animation_types.h" 9 #include "ash/common/wm/window_animation_types.h"
10 #include "ash/common/wm/window_parenting_utils.h" 10 #include "ash/common/wm/window_parenting_utils.h"
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 window_state->SetBoundsDirectCrossFade(bounds_in_parent); 760 window_state->SetBoundsDirectCrossFade(bounds_in_parent);
761 } else if (window_state->is_dragged()) { 761 } else if (window_state->is_dragged()) {
762 // SetBoundsDirectAnimated does not work when the window gets reparented. 762 // SetBoundsDirectAnimated does not work when the window gets reparented.
763 // TODO(oshima): Consider fixing it and reenable the animation. 763 // TODO(oshima): Consider fixing it and reenable the animation.
764 window_state->SetBoundsDirect(bounds_in_parent); 764 window_state->SetBoundsDirect(bounds_in_parent);
765 } else { 765 } else {
766 window_state->SetBoundsDirectAnimated(bounds_in_parent); 766 window_state->SetBoundsDirectAnimated(bounds_in_parent);
767 } 767 }
768 } 768 }
769 769
770 if (window_state->IsFullscreen()) {
771 // Save the previous show state so that we can correctly restore it after
772 // exiting the fullscreen mode.
773 auto previous_ui_state_type = ToWindowShowState(previous_state_type);
774 if (previous_ui_state_type == ui::SHOW_STATE_MINIMIZED) {
775 // If the previous show state is ui::SHOW_STATE_MINIMIZED, we will use
776 // the show state before the window was minimized. But if the window
777 // was fullscreen before it was minimized, we will keep the
778 // PreFullscreenShowStat unchanged.
779 previous_ui_state_type = window->GetPreMinimizedShowState();
780 if (previous_ui_state_type != ui::SHOW_STATE_FULLSCREEN)
781 window->SetPreFullscreenShowState(previous_ui_state_type);
782 } else {
783 window->SetPreFullscreenShowState(previous_ui_state_type);
784 }
785 }
786
770 if (window_state->IsMinimized()) { 787 if (window_state->IsMinimized()) {
771 // Save the previous show state so that we can correctly restore it. 788 // Save the previous show state so that we can correctly restore it after
772 window->SetRestoreShowState(ToWindowShowState(previous_state_type)); 789 // exiting the minimized mode.
790 window->SetPreMinimizedShowState(ToWindowShowState(previous_state_type));
773 window->SetVisibilityAnimationType( 791 window->SetVisibilityAnimationType(
774 WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE); 792 WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
775 793
776 // Hide the window. 794 // Hide the window.
777 window->Hide(); 795 window->Hide();
778 // Activate another window. 796 // Activate another window.
779 if (window_state->IsActive()) 797 if (window_state->IsActive())
780 window_state->Deactivate(); 798 window_state->Deactivate();
781 } else if ((window->GetTargetVisibility() || 799 } else if ((window->GetTargetVisibility() ||
782 IsMinimizedWindowState(previous_state_type)) && 800 IsMinimizedWindowState(previous_state_type)) &&
(...skipping 25 matching lines...) Expand all
808 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); 826 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window);
809 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); 827 center_in_parent.ClampToCenteredSize(window->GetBounds().size());
810 window_state->SetBoundsDirectAnimated(center_in_parent); 828 window_state->SetBoundsDirectAnimated(center_in_parent);
811 } 829 }
812 // Centering window is treated as if a user moved and resized the window. 830 // Centering window is treated as if a user moved and resized the window.
813 window_state->set_bounds_changed_by_user(true); 831 window_state->set_bounds_changed_by_user(true);
814 } 832 }
815 833
816 } // namespace wm 834 } // namespace wm
817 } // namespace ash 835 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/wm/window_state_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698