| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/system_modal_container_layout_manager.h" | 5 #include "ash/wm/system_modal_container_layout_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool AllRootWindowsHaveModalBackgroundsForContainer(int container_id) { | 47 bool AllRootWindowsHaveModalBackgroundsForContainer(int container_id) { |
| 48 std::vector<aura::Window*> containers = | 48 std::vector<aura::Window*> containers = |
| 49 Shell::GetContainersFromAllRootWindows(container_id, NULL); | 49 Shell::GetContainersFromAllRootWindows(container_id, NULL); |
| 50 bool has_modal_screen = !containers.empty(); | 50 bool has_modal_screen = !containers.empty(); |
| 51 for (std::vector<aura::Window*>::iterator iter = containers.begin(); | 51 for (std::vector<aura::Window*>::iterator iter = containers.begin(); |
| 52 iter != containers.end(); ++iter) { | 52 iter != containers.end(); ++iter) { |
| 53 has_modal_screen &= static_cast<SystemModalContainerLayoutManager*>( | 53 has_modal_screen &= static_cast<SystemModalContainerLayoutManager*>( |
| 54 (*iter)->layout_manager()) | 54 (*iter)->layout_manager()) |
| 55 ->has_modal_background(); | 55 ->has_window_dimmer(); |
| 56 } | 56 } |
| 57 return has_modal_screen; | 57 return has_modal_screen; |
| 58 } | 58 } |
| 59 | 59 |
| 60 bool AllRootWindowsHaveLockedModalBackgrounds() { | 60 bool AllRootWindowsHaveLockedModalBackgrounds() { |
| 61 return AllRootWindowsHaveModalBackgroundsForContainer( | 61 return AllRootWindowsHaveModalBackgroundsForContainer( |
| 62 kShellWindowId_LockSystemModalContainer); | 62 kShellWindowId_LockSystemModalContainer); |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool AllRootWindowsHaveModalBackgrounds() { | 65 bool AllRootWindowsHaveModalBackgrounds() { |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 std::unique_ptr<aura::Window> window(OpenToplevelTestWindow(false)); | 768 std::unique_ptr<aura::Window> window(OpenToplevelTestWindow(false)); |
| 769 std::unique_ptr<aura::Window> modal_window( | 769 std::unique_ptr<aura::Window> modal_window( |
| 770 views::Widget::CreateWindowWithContext(new TestWindow(true), | 770 views::Widget::CreateWindowWithContext(new TestWindow(true), |
| 771 CurrentContext()) | 771 CurrentContext()) |
| 772 ->GetNativeWindow()); | 772 ->GetNativeWindow()); |
| 773 SystemModalContainerLayoutManager* layout_manager = | 773 SystemModalContainerLayoutManager* layout_manager = |
| 774 Shell::GetPrimaryRootWindowController()->GetSystemModalLayoutManager( | 774 Shell::GetPrimaryRootWindowController()->GetSystemModalLayoutManager( |
| 775 modal_window.get()); | 775 modal_window.get()); |
| 776 | 776 |
| 777 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen()); | 777 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen()); |
| 778 EXPECT_FALSE(layout_manager->has_modal_background()); | 778 EXPECT_FALSE(layout_manager->has_window_dimmer()); |
| 779 | 779 |
| 780 modal_window->Show(); | 780 modal_window->Show(); |
| 781 EXPECT_TRUE(WmShell::Get()->IsSystemModalWindowOpen()); | 781 EXPECT_TRUE(WmShell::Get()->IsSystemModalWindowOpen()); |
| 782 EXPECT_TRUE(layout_manager->has_modal_background()); | 782 EXPECT_TRUE(layout_manager->has_window_dimmer()); |
| 783 | 783 |
| 784 modal_window->Hide(); | 784 modal_window->Hide(); |
| 785 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen()); | 785 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen()); |
| 786 EXPECT_FALSE(layout_manager->has_modal_background()); | 786 EXPECT_FALSE(layout_manager->has_window_dimmer()); |
| 787 | 787 |
| 788 modal_window->Show(); | 788 modal_window->Show(); |
| 789 EXPECT_TRUE(WmShell::Get()->IsSystemModalWindowOpen()); | 789 EXPECT_TRUE(WmShell::Get()->IsSystemModalWindowOpen()); |
| 790 EXPECT_TRUE(layout_manager->has_modal_background()); | 790 EXPECT_TRUE(layout_manager->has_window_dimmer()); |
| 791 } | 791 } |
| 792 | 792 |
| 793 namespace { | 793 namespace { |
| 794 | 794 |
| 795 class InputTestDelegate : public aura::test::TestWindowDelegate { | 795 class InputTestDelegate : public aura::test::TestWindowDelegate { |
| 796 public: | 796 public: |
| 797 InputTestDelegate() {} | 797 InputTestDelegate() {} |
| 798 ~InputTestDelegate() override {} | 798 ~InputTestDelegate() override {} |
| 799 | 799 |
| 800 void RunTest(test::AshTestBase* test_base) { | 800 void RunTest(test::AshTestBase* test_base) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 if (!SupportsMultipleDisplays()) | 884 if (!SupportsMultipleDisplays()) |
| 885 return; | 885 return; |
| 886 | 886 |
| 887 UpdateDisplay("500x500, 500x500"); | 887 UpdateDisplay("500x500, 500x500"); |
| 888 InputTestDelegate delegate; | 888 InputTestDelegate delegate; |
| 889 delegate.RunTest(this); | 889 delegate.RunTest(this); |
| 890 } | 890 } |
| 891 | 891 |
| 892 } // namespace test | 892 } // namespace test |
| 893 } // namespace ash | 893 } // namespace ash |
| OLD | NEW |