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

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

Issue 2625113004: Unify window fullscreen and minimizing implementation (Closed)
Patch Set: Fix review issue 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.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
787 if (window_state->IsMinimized()) { 770 if (window_state->IsMinimized()) {
788 // Save the previous show state so that we can correctly restore it after 771 // Save the previous show state so that we can correctly restore it after
789 // exiting the minimized mode. 772 // exiting the minimized mode.
790 window->SetPreMinimizedShowState(ToWindowShowState(previous_state_type)); 773 window->SetPreMinimizedShowState(ToWindowShowState(previous_state_type));
791 window->SetVisibilityAnimationType( 774 window->SetVisibilityAnimationType(
792 WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE); 775 WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
793 776
794 // Hide the window. 777 // Hide the window.
795 window->Hide(); 778 window->Hide();
796 // Activate another window. 779 // Activate another window.
(...skipping 29 matching lines...) Expand all
826 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); 809 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window);
827 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); 810 center_in_parent.ClampToCenteredSize(window->GetBounds().size());
828 window_state->SetBoundsDirectAnimated(center_in_parent); 811 window_state->SetBoundsDirectAnimated(center_in_parent);
829 } 812 }
830 // Centering window is treated as if a user moved and resized the window. 813 // Centering window is treated as if a user moved and resized the window.
831 window_state->set_bounds_changed_by_user(true); 814 window_state->set_bounds_changed_by_user(true);
832 } 815 }
833 816
834 } // namespace wm 817 } // namespace wm
835 } // namespace ash 818 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/wm_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698