| OLD | NEW |
| 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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::SetPreMinimizedShowState(ui::WindowShowState show_state) { | 612 void WmWindow::SetPreMinimizedShowState(ui::WindowShowState show_state) { |
| 613 DCHECK_NE(show_state, ui::SHOW_STATE_PREVIOUS); |
| 613 window_->SetProperty(aura::client::kPreMinimizedShowStateKey, show_state); | 614 window_->SetProperty(aura::client::kPreMinimizedShowStateKey, show_state); |
| 614 } | 615 } |
| 615 | 616 |
| 616 ui::WindowShowState WmWindow::GetPreMinimizedShowState() const { | 617 ui::WindowShowState WmWindow::GetPreMinimizedShowState() const { |
| 617 return window_->GetProperty(aura::client::kPreMinimizedShowStateKey); | 618 return window_->GetProperty(aura::client::kPreMinimizedShowStateKey); |
| 618 } | 619 } |
| 619 | 620 |
| 620 void WmWindow::SetPreFullscreenShowState(ui::WindowShowState show_state) { | 621 void WmWindow::SetPreFullscreenShowState(ui::WindowShowState show_state) { |
| 621 // We should never store the ui::SHOW_STATE_MINIMIZED as the show state before | 622 // We should never store the ui::SHOW_STATE_MINIMIZED as the show state before |
| 622 // fullscreen. | 623 // fullscreen. |
| 623 DCHECK_NE(show_state, ui::SHOW_STATE_MINIMIZED); | 624 DCHECK_NE(show_state, ui::SHOW_STATE_MINIMIZED); |
| 625 DCHECK_NE(show_state, ui::SHOW_STATE_PREVIOUS); |
| 624 window_->SetProperty(aura::client::kPreFullscreenShowStateKey, show_state); | 626 window_->SetProperty(aura::client::kPreFullscreenShowStateKey, show_state); |
| 625 } | 627 } |
| 626 | 628 |
| 627 void WmWindow::SetRestoreOverrides(const gfx::Rect& bounds_override, | 629 void WmWindow::SetRestoreOverrides(const gfx::Rect& bounds_override, |
| 628 ui::WindowShowState window_state_override) { | 630 ui::WindowShowState window_state_override) { |
| 629 if (bounds_override.IsEmpty()) { | 631 if (bounds_override.IsEmpty()) { |
| 630 window_->ClearProperty(kRestoreShowStateOverrideKey); | 632 window_->ClearProperty(kRestoreShowStateOverrideKey); |
| 631 window_->ClearProperty(kRestoreBoundsOverrideKey); | 633 window_->ClearProperty(kRestoreBoundsOverrideKey); |
| 632 return; | 634 return; |
| 633 } | 635 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 wm::DeactivateWindow(window_); | 767 wm::DeactivateWindow(window_); |
| 766 } | 768 } |
| 767 | 769 |
| 768 void WmWindow::SetFullscreen(bool fullscreen) { | 770 void WmWindow::SetFullscreen(bool fullscreen) { |
| 769 if (fullscreen) { | 771 if (fullscreen) { |
| 770 window_->SetProperty(aura::client::kShowStateKey, | 772 window_->SetProperty(aura::client::kShowStateKey, |
| 771 ui::SHOW_STATE_FULLSCREEN); | 773 ui::SHOW_STATE_FULLSCREEN); |
| 772 } else { | 774 } else { |
| 773 auto state = window_->GetProperty(aura::client::kPreFullscreenShowStateKey); | 775 auto state = window_->GetProperty(aura::client::kPreFullscreenShowStateKey); |
| 774 DCHECK_NE(state, ui::SHOW_STATE_MINIMIZED); | 776 DCHECK_NE(state, ui::SHOW_STATE_MINIMIZED); |
| 777 DCHECK_NE(state, ui::SHOW_STATE_PREVIOUS); |
| 775 window_->SetProperty(aura::client::kShowStateKey, state); | 778 window_->SetProperty(aura::client::kShowStateKey, state); |
| 776 window_->ClearProperty(aura::client::kPreFullscreenShowStateKey); | 779 window_->ClearProperty(aura::client::kPreFullscreenShowStateKey); |
| 777 } | 780 } |
| 778 } | 781 } |
| 779 | 782 |
| 780 void WmWindow::Maximize() { | 783 void WmWindow::Maximize() { |
| 781 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 784 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 782 } | 785 } |
| 783 | 786 |
| 784 void WmWindow::Minimize() { | 787 void WmWindow::Minimize() { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 | 938 |
| 936 void WmWindow::OnWindowStackingChanged(aura::Window* window) { | 939 void WmWindow::OnWindowStackingChanged(aura::Window* window) { |
| 937 for (auto& observer : observers_) | 940 for (auto& observer : observers_) |
| 938 observer.OnWindowStackingChanged(this); | 941 observer.OnWindowStackingChanged(this); |
| 939 } | 942 } |
| 940 | 943 |
| 941 void WmWindow::OnWindowPropertyChanged(aura::Window* window, | 944 void WmWindow::OnWindowPropertyChanged(aura::Window* window, |
| 942 const void* key, | 945 const void* key, |
| 943 intptr_t old) { | 946 intptr_t old) { |
| 944 if (key == aura::client::kShowStateKey) { | 947 if (key == aura::client::kShowStateKey) { |
| 945 ash::wm::GetWindowState(window_)->OnWindowShowStateChanged(); | 948 ui::WindowShowState state = GetShowState(); |
| 949 if (state == ui::SHOW_STATE_PREVIOUS) { |
| 950 ui::WindowShowState old_state = static_cast<ui::WindowShowState>(old); |
| 951 if (old_state == ui::SHOW_STATE_FULLSCREEN) { |
| 952 SetFullscreen(false); |
| 953 } else if (old_state == ui::SHOW_STATE_MINIMIZED) { |
| 954 Unminimize(); |
| 955 } else { |
| 956 NOTREACHED(); |
| 957 } |
| 958 } else { |
| 959 ash::wm::GetWindowState(window_)->OnWindowShowStateChanged(); |
| 960 } |
| 946 return; | 961 return; |
| 947 } | 962 } |
| 948 WmWindowProperty wm_property; | 963 WmWindowProperty wm_property; |
| 949 if (key == aura::client::kAlwaysOnTopKey) { | 964 if (key == aura::client::kAlwaysOnTopKey) { |
| 950 wm_property = WmWindowProperty::ALWAYS_ON_TOP; | 965 wm_property = WmWindowProperty::ALWAYS_ON_TOP; |
| 951 } else if (key == aura::client::kAppIconKey) { | 966 } else if (key == aura::client::kAppIconKey) { |
| 952 wm_property = WmWindowProperty::APP_ICON; | 967 wm_property = WmWindowProperty::APP_ICON; |
| 953 } else if (key == aura::client::kDrawAttentionKey) { | 968 } else if (key == aura::client::kDrawAttentionKey) { |
| 954 wm_property = WmWindowProperty::DRAW_ATTENTION; | 969 wm_property = WmWindowProperty::DRAW_ATTENTION; |
| 955 } else if (key == aura::client::kModalKey) { | 970 } else if (key == aura::client::kModalKey) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 observer.OnTransientChildAdded(this, Get(transient)); | 1027 observer.OnTransientChildAdded(this, Get(transient)); |
| 1013 } | 1028 } |
| 1014 | 1029 |
| 1015 void WmWindow::OnTransientChildRemoved(aura::Window* window, | 1030 void WmWindow::OnTransientChildRemoved(aura::Window* window, |
| 1016 aura::Window* transient) { | 1031 aura::Window* transient) { |
| 1017 for (auto& observer : transient_observers_) | 1032 for (auto& observer : transient_observers_) |
| 1018 observer.OnTransientChildRemoved(this, Get(transient)); | 1033 observer.OnTransientChildRemoved(this, Get(transient)); |
| 1019 } | 1034 } |
| 1020 | 1035 |
| 1021 } // namespace ash | 1036 } // namespace ash |
| OLD | NEW |