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

Side by Side Diff: ash/common/wm_window.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 | « ash/common/wm_window.h ('k') | ash/mus/top_level_window_factory_unittest.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_window.h" 5 #include "ash/common/wm_window.h"
6 6
7 #include "ash/aura/aura_layout_manager_adapter.h" 7 #include "ash/aura/aura_layout_manager_adapter.h"
8 #include "ash/aura/wm_shell_aura.h" 8 #include "ash/aura/wm_shell_aura.h"
9 #include "ash/common/ash_constants.h" 9 #include "ash/common/ash_constants.h"
10 #include "ash/common/shelf/shelf_item_types.h" 10 #include "ash/common/shelf/shelf_item_types.h"
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 } 602 }
603 603
604 void WmWindow::SetShowState(ui::WindowShowState show_state) { 604 void WmWindow::SetShowState(ui::WindowShowState show_state) {
605 window_->SetProperty(aura::client::kShowStateKey, show_state); 605 window_->SetProperty(aura::client::kShowStateKey, show_state);
606 } 606 }
607 607
608 ui::WindowShowState WmWindow::GetShowState() const { 608 ui::WindowShowState WmWindow::GetShowState() const {
609 return window_->GetProperty(aura::client::kShowStateKey); 609 return window_->GetProperty(aura::client::kShowStateKey);
610 } 610 }
611 611
612 void WmWindow::SetRestoreShowState(ui::WindowShowState show_state) { 612 void WmWindow::SetPreMinimizedShowState(ui::WindowShowState show_state) {
613 window_->SetProperty(aura::client::kRestoreShowStateKey, show_state); 613 window_->SetProperty(aura::client::kPreMinimizedShowStateKey, show_state);
614 }
615
616 ui::WindowShowState WmWindow::GetPreMinimizedShowState() const {
617 return window_->GetProperty(aura::client::kPreMinimizedShowStateKey);
618 }
619
620 void WmWindow::SetPreFullscreenShowState(ui::WindowShowState show_state) {
621 // We should never store the ui::SHOW_STATE_MINIMIZED as the show state before
622 // fullscreen.
623 DCHECK_NE(show_state, ui::SHOW_STATE_MINIMIZED);
624 window_->SetProperty(aura::client::kPreFullscreenShowStateKey, show_state);
614 } 625 }
615 626
616 void WmWindow::SetRestoreOverrides(const gfx::Rect& bounds_override, 627 void WmWindow::SetRestoreOverrides(const gfx::Rect& bounds_override,
617 ui::WindowShowState window_state_override) { 628 ui::WindowShowState window_state_override) {
618 if (bounds_override.IsEmpty()) { 629 if (bounds_override.IsEmpty()) {
619 window_->ClearProperty(kRestoreShowStateOverrideKey); 630 window_->ClearProperty(kRestoreShowStateOverrideKey);
620 window_->ClearProperty(kRestoreBoundsOverrideKey); 631 window_->ClearProperty(kRestoreBoundsOverrideKey);
621 return; 632 return;
622 } 633 }
623 window_->SetProperty(kRestoreShowStateOverrideKey, window_state_override); 634 window_->SetProperty(kRestoreShowStateOverrideKey, window_state_override);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 } 758 }
748 759
749 void WmWindow::Activate() { 760 void WmWindow::Activate() {
750 wm::ActivateWindow(window_); 761 wm::ActivateWindow(window_);
751 } 762 }
752 763
753 void WmWindow::Deactivate() { 764 void WmWindow::Deactivate() {
754 wm::DeactivateWindow(window_); 765 wm::DeactivateWindow(window_);
755 } 766 }
756 767
757 void WmWindow::SetFullscreen() { 768 void WmWindow::SetFullscreen(bool fullscreen) {
758 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 769 if (fullscreen) {
770 window_->SetProperty(aura::client::kShowStateKey,
771 ui::SHOW_STATE_FULLSCREEN);
772 } else {
773 auto state = window_->GetProperty(aura::client::kPreFullscreenShowStateKey);
774 DCHECK_NE(state, ui::SHOW_STATE_MINIMIZED);
775 window_->SetProperty(aura::client::kShowStateKey, state);
776 window_->ClearProperty(aura::client::kPreFullscreenShowStateKey);
777 }
759 } 778 }
760 779
761 void WmWindow::Maximize() { 780 void WmWindow::Maximize() {
762 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 781 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
763 } 782 }
764 783
765 void WmWindow::Minimize() { 784 void WmWindow::Minimize() {
766 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); 785 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
767 } 786 }
768 787
769 void WmWindow::Unminimize() { 788 void WmWindow::Unminimize() {
770 window_->SetProperty( 789 window_->SetProperty(
771 aura::client::kShowStateKey, 790 aura::client::kShowStateKey,
772 window_->GetProperty(aura::client::kRestoreShowStateKey)); 791 window_->GetProperty(aura::client::kPreMinimizedShowStateKey));
773 window_->ClearProperty(aura::client::kRestoreShowStateKey); 792 window_->ClearProperty(aura::client::kPreMinimizedShowStateKey);
774 } 793 }
775 794
776 std::vector<WmWindow*> WmWindow::GetChildren() { 795 std::vector<WmWindow*> WmWindow::GetChildren() {
777 return FromAuraWindows(window_->children()); 796 return FromAuraWindows(window_->children());
778 } 797 }
779 798
780 WmWindow* WmWindow::GetChildByShellWindowId(int id) { 799 WmWindow* WmWindow::GetChildByShellWindowId(int id) {
781 return Get(window_->GetChildById(id)); 800 return Get(window_->GetChildById(id));
782 } 801 }
783 802
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 observer.OnTransientChildAdded(this, Get(transient)); 1012 observer.OnTransientChildAdded(this, Get(transient));
994 } 1013 }
995 1014
996 void WmWindow::OnTransientChildRemoved(aura::Window* window, 1015 void WmWindow::OnTransientChildRemoved(aura::Window* window,
997 aura::Window* transient) { 1016 aura::Window* transient) {
998 for (auto& observer : transient_observers_) 1017 for (auto& observer : transient_observers_)
999 observer.OnTransientChildRemoved(this, Get(transient)); 1018 observer.OnTransientChildRemoved(this, Get(transient));
1000 } 1019 }
1001 1020
1002 } // namespace ash 1021 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm_window.h ('k') | ash/mus/top_level_window_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698