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 "ash/session_state_delegate.h" | 7 #include "ash/session_state_delegate.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/wm/system_modal_container_event_filter.h" | 10 #include "ash/wm/system_modal_container_event_filter.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 void SystemModalContainerLayoutManager::OnWindowAddedToLayout( | 62 void SystemModalContainerLayoutManager::OnWindowAddedToLayout( |
63 aura::Window* child) { | 63 aura::Window* child) { |
64 DCHECK((modal_background_ && child == modal_background_->GetNativeView()) || | 64 DCHECK((modal_background_ && child == modal_background_->GetNativeView()) || |
65 child->type() == aura::client::WINDOW_TYPE_NORMAL || | 65 child->type() == aura::client::WINDOW_TYPE_NORMAL || |
66 child->type() == aura::client::WINDOW_TYPE_POPUP); | 66 child->type() == aura::client::WINDOW_TYPE_POPUP); |
67 DCHECK( | 67 DCHECK( |
68 container_->id() != internal::kShellWindowId_LockSystemModalContainer || | 68 container_->id() != internal::kShellWindowId_LockSystemModalContainer || |
69 Shell::GetInstance()->session_state_delegate()->IsScreenLocked() || | 69 Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked()); |
70 !Shell::GetInstance()->session_state_delegate()-> | |
71 IsActiveUserSessionStarted()); | |
72 | 70 |
73 child->AddObserver(this); | 71 child->AddObserver(this); |
74 if (child->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_NONE) | 72 if (child->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_NONE) |
75 AddModalWindow(child); | 73 AddModalWindow(child); |
76 } | 74 } |
77 | 75 |
78 void SystemModalContainerLayoutManager::OnWillRemoveWindowFromLayout( | 76 void SystemModalContainerLayoutManager::OnWillRemoveWindowFromLayout( |
79 aura::Window* child) { | 77 aura::Window* child) { |
80 child->RemoveObserver(this); | 78 child->RemoveObserver(this); |
81 if (child->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_NONE) | 79 if (child->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_NONE) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 Shell::GetInstance()->OnModalWindowRemoved(window); | 112 Shell::GetInstance()->OnModalWindowRemoved(window); |
115 } | 113 } |
116 } | 114 } |
117 | 115 |
118 void SystemModalContainerLayoutManager::OnWindowDestroying( | 116 void SystemModalContainerLayoutManager::OnWindowDestroying( |
119 aura::Window* window) { | 117 aura::Window* window) { |
120 if (modal_background_ && modal_background_->GetNativeView() == window) | 118 if (modal_background_ && modal_background_->GetNativeView() == window) |
121 modal_background_ = NULL; | 119 modal_background_ = NULL; |
122 } | 120 } |
123 | 121 |
124 | |
125 //////////////////////////////////////////////////////////////////////////////// | |
126 // SystemModalContainerLayoutManager, | |
127 // SystemModalContainerEventFilter::Delegate implementation: | |
128 | |
129 bool SystemModalContainerLayoutManager::CanWindowReceiveEvents( | 122 bool SystemModalContainerLayoutManager::CanWindowReceiveEvents( |
130 aura::Window* window) { | 123 aura::Window* window) { |
131 // We could get when we're at lock screen and there is modal window at | 124 // We could get when we're at lock screen and there is modal window at |
132 // system modal window layer which added event filter. | 125 // system modal window layer which added event filter. |
133 // Now this lock modal windows layer layout manager should not block events | 126 // Now this lock modal windows layer layout manager should not block events |
134 // for windows at lock layer. | 127 // for windows at lock layer. |
135 // See SystemModalContainerLayoutManagerTest.EventFocusContainers and | 128 // See SystemModalContainerLayoutManagerTest.EventFocusContainers and |
136 // http://crbug.com/157469 | 129 // http://crbug.com/157469 |
137 if (modal_windows_.empty()) | 130 if (modal_windows_.empty()) |
138 return true; | 131 return true; |
139 // This container can not handle events if the screen is locked and it is not | 132 // This container can not handle events if the screen is locked and it is not |
140 // above the lock screen layer (crbug.com/110920). | 133 // above the lock screen layer (crbug.com/110920). |
141 if (Shell::GetInstance()->session_state_delegate()->IsScreenLocked() && | 134 if (Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked() && |
142 container_->id() < ash::internal::kShellWindowId_LockScreenContainer) | 135 container_->id() < ash::internal::kShellWindowId_LockScreenContainer) |
143 return true; | 136 return true; |
144 return wm::GetActivatableWindow(window) == modal_window(); | 137 return wm::GetActivatableWindow(window) == modal_window(); |
145 } | 138 } |
146 | 139 |
147 bool SystemModalContainerLayoutManager::ActivateNextModalWindow() { | 140 bool SystemModalContainerLayoutManager::ActivateNextModalWindow() { |
148 if (modal_windows_.empty()) | 141 if (modal_windows_.empty()) |
149 return false; | 142 return false; |
150 wm::ActivateWindow(modal_window()); | 143 wm::ActivateWindow(modal_window()); |
151 return true; | 144 return true; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 void SystemModalContainerLayoutManager::RemoveModalWindow( | 215 void SystemModalContainerLayoutManager::RemoveModalWindow( |
223 aura::Window* window) { | 216 aura::Window* window) { |
224 aura::Window::Windows::iterator it = | 217 aura::Window::Windows::iterator it = |
225 std::find(modal_windows_.begin(), modal_windows_.end(), window); | 218 std::find(modal_windows_.begin(), modal_windows_.end(), window); |
226 if (it != modal_windows_.end()) | 219 if (it != modal_windows_.end()) |
227 modal_windows_.erase(it); | 220 modal_windows_.erase(it); |
228 } | 221 } |
229 | 222 |
230 } // namespace internal | 223 } // namespace internal |
231 } // namespace ash | 224 } // namespace ash |
OLD | NEW |