| 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/public/cpp/config.h" |
| 9 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
| 10 #include "ash/session/session_controller.h" | 11 #include "ash/session/session_controller.h" |
| 11 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 12 #include "ash/shell_port.h" | 13 #include "ash/shell_port.h" |
| 13 #include "ash/wm/window_dimmer.h" | 14 #include "ash/wm/window_dimmer.h" |
| 14 #include "ash/wm/window_util.h" | 15 #include "ash/wm/window_util.h" |
| 15 #include "ash/wm_window.h" | 16 #include "ash/wm_window.h" |
| 16 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 17 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
| 18 #include "ui/aura/client/aura_constants.h" | 19 #include "ui/aura/client/aura_constants.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 73 |
| 73 void SystemModalContainerLayoutManager::OnWindowResized() { | 74 void SystemModalContainerLayoutManager::OnWindowResized() { |
| 74 PositionDialogsAfterWorkAreaResize(); | 75 PositionDialogsAfterWorkAreaResize(); |
| 75 } | 76 } |
| 76 | 77 |
| 77 void SystemModalContainerLayoutManager::OnWindowAddedToLayout(WmWindow* child) { | 78 void SystemModalContainerLayoutManager::OnWindowAddedToLayout(WmWindow* child) { |
| 78 DCHECK(child->GetType() == ui::wm::WINDOW_TYPE_NORMAL || | 79 DCHECK(child->GetType() == ui::wm::WINDOW_TYPE_NORMAL || |
| 79 child->GetType() == ui::wm::WINDOW_TYPE_POPUP); | 80 child->GetType() == ui::wm::WINDOW_TYPE_POPUP); |
| 80 // TODO(mash): IsUserSessionBlocked() depends on knowing the login state. We | 81 // TODO(mash): IsUserSessionBlocked() depends on knowing the login state. We |
| 81 // need a non-stub version of SessionStateDelegate. crbug.com/648964 | 82 // need a non-stub version of SessionStateDelegate. crbug.com/648964 |
| 82 if (!ShellPort::Get()->IsRunningInMash()) { | 83 if (Shell::GetAshConfig() != Config::MASH) { |
| 83 DCHECK(container_->GetShellWindowId() != | 84 DCHECK(container_->GetShellWindowId() != |
| 84 kShellWindowId_LockSystemModalContainer || | 85 kShellWindowId_LockSystemModalContainer || |
| 85 Shell::Get()->session_controller()->IsUserSessionBlocked()); | 86 Shell::Get()->session_controller()->IsUserSessionBlocked()); |
| 86 } | 87 } |
| 87 // Since this is for SystemModal, there is no good reason to add windows | 88 // Since this is for SystemModal, there is no good reason to add windows |
| 88 // other than MODAL_TYPE_NONE or MODAL_TYPE_SYSTEM. DCHECK to avoid simple | 89 // other than MODAL_TYPE_NONE or MODAL_TYPE_SYSTEM. DCHECK to avoid simple |
| 89 // mistake. | 90 // mistake. |
| 90 DCHECK_NE(GetModalType(child), ui::MODAL_TYPE_CHILD); | 91 DCHECK_NE(GetModalType(child), ui::MODAL_TYPE_CHILD); |
| 91 DCHECK_NE(GetModalType(child), ui::MODAL_TYPE_WINDOW); | 92 DCHECK_NE(GetModalType(child), ui::MODAL_TYPE_WINDOW); |
| 92 | 93 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 bool SystemModalContainerLayoutManager::IsBoundsCentered( | 274 bool SystemModalContainerLayoutManager::IsBoundsCentered( |
| 274 const gfx::Rect& bounds) const { | 275 const gfx::Rect& bounds) const { |
| 275 gfx::Point window_center = bounds.CenterPoint(); | 276 gfx::Point window_center = bounds.CenterPoint(); |
| 276 gfx::Point container_center = GetUsableDialogArea().CenterPoint(); | 277 gfx::Point container_center = GetUsableDialogArea().CenterPoint(); |
| 277 return std::abs(window_center.x() - container_center.x()) < | 278 return std::abs(window_center.x() - container_center.x()) < |
| 278 kCenterPixelDelta && | 279 kCenterPixelDelta && |
| 279 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta; | 280 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta; |
| 280 } | 281 } |
| 281 | 282 |
| 282 } // namespace ash | 283 } // namespace ash |
| OLD | NEW |