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/shell_port.h" | 5 #include "ash/shell_port.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/accelerators/accelerator_controller.h" | 9 #include "ash/accelerators/accelerator_controller.h" |
10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
11 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
12 #include "ash/session/session_controller.h" | 12 #include "ash/session/session_controller.h" |
13 #include "ash/shelf/app_list_shelf_item_delegate.h" | 13 #include "ash/shelf/app_list_shelf_item_delegate.h" |
14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
15 #include "ash/shell_delegate.h" | 15 #include "ash/shell_delegate.h" |
16 #include "ash/wm/root_window_finder.h" | 16 #include "ash/wm/root_window_finder.h" |
17 #include "ash/wm/system_modal_container_layout_manager.h" | 17 #include "ash/wm/system_modal_container_layout_manager.h" |
18 #include "ash/wm_window.h" | |
19 #include "base/bind.h" | 18 #include "base/bind.h" |
20 #include "base/logging.h" | 19 #include "base/logging.h" |
21 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
| 21 #include "ui/aura/client/aura_constants.h" |
| 22 #include "ui/aura/window.h" |
22 #include "ui/display/display.h" | 23 #include "ui/display/display.h" |
23 | 24 |
24 namespace ash { | 25 namespace ash { |
25 | 26 |
26 // static | 27 // static |
27 ShellPort* ShellPort::instance_ = nullptr; | 28 ShellPort* ShellPort::instance_ = nullptr; |
28 | 29 |
29 ShellPort::~ShellPort() { | 30 ShellPort::~ShellPort() { |
30 DCHECK_EQ(this, instance_); | 31 DCHECK_EQ(this, instance_); |
31 instance_ = nullptr; | 32 instance_ = nullptr; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 bool ShellPort::IsForceMaximizeOnFirstRun() { | 73 bool ShellPort::IsForceMaximizeOnFirstRun() { |
73 return Shell::Get()->shell_delegate()->IsForceMaximizeOnFirstRun(); | 74 return Shell::Get()->shell_delegate()->IsForceMaximizeOnFirstRun(); |
74 } | 75 } |
75 | 76 |
76 bool ShellPort::IsSystemModalWindowOpen() { | 77 bool ShellPort::IsSystemModalWindowOpen() { |
77 if (simulate_modal_window_open_for_testing_) | 78 if (simulate_modal_window_open_for_testing_) |
78 return true; | 79 return true; |
79 | 80 |
80 // Traverse all system modal containers, and find its direct child window | 81 // Traverse all system modal containers, and find its direct child window |
81 // with "SystemModal" setting, and visible. | 82 // with "SystemModal" setting, and visible. |
82 for (WmWindow* root : GetAllRootWindows()) { | 83 for (aura::Window* root : GetAllRootWindows()) { |
83 WmWindow* system_modal = | 84 aura::Window* system_modal = |
84 root->GetChildByShellWindowId(kShellWindowId_SystemModalContainer); | 85 root->GetChildById(kShellWindowId_SystemModalContainer); |
85 if (!system_modal) | 86 if (!system_modal) |
86 continue; | 87 continue; |
87 for (const WmWindow* child : system_modal->GetChildren()) { | 88 for (const aura::Window* child : system_modal->children()) { |
88 if (child->IsSystemModal() && child->GetTargetVisibility()) { | 89 if (child->GetProperty(aura::client::kModalKey) == |
| 90 ui::MODAL_TYPE_SYSTEM && |
| 91 child->layer()->GetTargetVisibility()) { |
89 return true; | 92 return true; |
90 } | 93 } |
91 } | 94 } |
92 } | 95 } |
93 return false; | 96 return false; |
94 } | 97 } |
95 | 98 |
96 void ShellPort::CreateModalBackground(aura::Window* window) { | 99 void ShellPort::CreateModalBackground(aura::Window* window) { |
97 for (aura::Window* root_window : Shell::GetAllRootWindows()) { | 100 for (aura::Window* root_window : Shell::GetAllRootWindows()) { |
98 RootWindowController::ForWindow(root_window) | 101 RootWindowController::ForWindow(root_window) |
(...skipping 12 matching lines...) Expand all Loading... |
111 } | 114 } |
112 } | 115 } |
113 for (aura::Window* root_window : root_windows) { | 116 for (aura::Window* root_window : root_windows) { |
114 RootWindowController::ForWindow(root_window) | 117 RootWindowController::ForWindow(root_window) |
115 ->GetSystemModalLayoutManager(removed) | 118 ->GetSystemModalLayoutManager(removed) |
116 ->DestroyModalBackground(); | 119 ->DestroyModalBackground(); |
117 } | 120 } |
118 } | 121 } |
119 | 122 |
120 } // namespace ash | 123 } // namespace ash |
OLD | NEW |