| 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 <cmath> | 7 #include <cmath> |
| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 //////////////////////////////////////////////////////////////////////////////// | 112 //////////////////////////////////////////////////////////////////////////////// |
| 113 // SystemModalContainerLayoutManager, Keyboard::KeybaordControllerObserver | 113 // SystemModalContainerLayoutManager, Keyboard::KeybaordControllerObserver |
| 114 // implementation: | 114 // implementation: |
| 115 | 115 |
| 116 void SystemModalContainerLayoutManager::OnKeyboardBoundsChanging( | 116 void SystemModalContainerLayoutManager::OnKeyboardBoundsChanging( |
| 117 const gfx::Rect& new_bounds) { | 117 const gfx::Rect& new_bounds) { |
| 118 PositionDialogsAfterWorkAreaResize(); | 118 PositionDialogsAfterWorkAreaResize(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool SystemModalContainerLayoutManager::CanWindowReceiveEvents( | 121 bool SystemModalContainerLayoutManager::IsPartOfActiveModalWindow( |
| 122 aura::Window* window) { | 122 aura::Window* window) { |
| 123 // We could get when we're at lock screen and there is modal window at | 123 return modal_window() && wm::GetActivatableWindow(window) == modal_window(); |
| 124 // system modal window layer which added event filter. | |
| 125 // Now this lock modal windows layer layout manager should not block events | |
| 126 // for windows at lock layer. | |
| 127 // See SystemModalContainerLayoutManagerTest.EventFocusContainers and | |
| 128 // http://crbug.com/157469 | |
| 129 if (modal_windows_.empty()) | |
| 130 return true; | |
| 131 // This container can not handle events if the screen is locked and it is not | |
| 132 // above the lock screen layer (crbug.com/110920). | |
| 133 if (Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked() && | |
| 134 container_->id() < ash::kShellWindowId_LockScreenContainer) | |
| 135 return true; | |
| 136 return wm::GetActivatableWindow(window) == modal_window(); | |
| 137 } | 124 } |
| 138 | 125 |
| 139 bool SystemModalContainerLayoutManager::ActivateNextModalWindow() { | 126 bool SystemModalContainerLayoutManager::ActivateNextModalWindow() { |
| 140 if (modal_windows_.empty()) | 127 if (modal_windows_.empty()) |
| 141 return false; | 128 return false; |
| 142 wm::ActivateWindow(modal_window()); | 129 wm::ActivateWindow(modal_window()); |
| 143 return true; | 130 return true; |
| 144 } | 131 } |
| 145 | 132 |
| 146 void SystemModalContainerLayoutManager::CreateModalBackground() { | 133 void SystemModalContainerLayoutManager::CreateModalBackground() { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 bool SystemModalContainerLayoutManager::DialogIsCentered( | 247 bool SystemModalContainerLayoutManager::DialogIsCentered( |
| 261 const gfx::Rect& window_bounds) { | 248 const gfx::Rect& window_bounds) { |
| 262 gfx::Point window_center = window_bounds.CenterPoint(); | 249 gfx::Point window_center = window_bounds.CenterPoint(); |
| 263 gfx::Point container_center = GetUsableDialogArea().CenterPoint(); | 250 gfx::Point container_center = GetUsableDialogArea().CenterPoint(); |
| 264 return | 251 return |
| 265 std::abs(window_center.x() - container_center.x()) < kCenterPixelDelta && | 252 std::abs(window_center.x() - container_center.x()) < kCenterPixelDelta && |
| 266 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta; | 253 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta; |
| 267 } | 254 } |
| 268 | 255 |
| 269 } // namespace ash | 256 } // namespace ash |
| OLD | NEW |