Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: ash/wm/system_modal_container_layout_manager.cc

Issue 2111443002: mash: Migrate SessionStateDelegate access to WmShell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "ash/common/wm_shell.h"
11 #include "ash/shell.h" 12 #include "ash/shell.h"
12 #include "ash/wm/dim_window.h" 13 #include "ash/wm/dim_window.h"
13 #include "ash/wm/window_util.h" 14 #include "ash/wm/window_util.h"
14 #include "base/stl_util.h" 15 #include "base/stl_util.h"
15 #include "ui/aura/client/aura_constants.h" 16 #include "ui/aura/client/aura_constants.h"
16 #include "ui/aura/client/capture_client.h" 17 #include "ui/aura/client/capture_client.h"
17 #include "ui/aura/window.h" 18 #include "ui/aura/window.h"
18 #include "ui/aura/window_property.h" 19 #include "ui/aura/window_property.h"
19 #include "ui/compositor/layer.h" 20 #include "ui/compositor/layer.h"
20 #include "ui/keyboard/keyboard_controller.h" 21 #include "ui/keyboard/keyboard_controller.h"
(...skipping 28 matching lines...) Expand all
49 PositionDialogsAfterWorkAreaResize(); 50 PositionDialogsAfterWorkAreaResize();
50 } 51 }
51 52
52 void SystemModalContainerLayoutManager::OnWindowAddedToLayout( 53 void SystemModalContainerLayoutManager::OnWindowAddedToLayout(
53 aura::Window* child) { 54 aura::Window* child) {
54 DCHECK(child == modal_background_ || 55 DCHECK(child == modal_background_ ||
55 child->type() == ui::wm::WINDOW_TYPE_NORMAL || 56 child->type() == ui::wm::WINDOW_TYPE_NORMAL ||
56 child->type() == ui::wm::WINDOW_TYPE_POPUP); 57 child->type() == ui::wm::WINDOW_TYPE_POPUP);
57 DCHECK( 58 DCHECK(
58 container_->id() != kShellWindowId_LockSystemModalContainer || 59 container_->id() != kShellWindowId_LockSystemModalContainer ||
59 Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked()); 60 WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked());
60 // Since this is for SystemModal, there is no goodd reason to add 61 // Since this is for SystemModal, there is no goodd reason to add
61 // these window other than MODAL_TYPE_NONE or MODAL_TYPE_SYSTEM. 62 // these window other than MODAL_TYPE_NONE or MODAL_TYPE_SYSTEM.
62 // DCHECK to avoid simple mistake. 63 // DCHECK to avoid simple mistake.
63 DCHECK_NE(child->GetProperty(aura::client::kModalKey), ui::MODAL_TYPE_CHILD); 64 DCHECK_NE(child->GetProperty(aura::client::kModalKey), ui::MODAL_TYPE_CHILD);
64 DCHECK_NE(child->GetProperty(aura::client::kModalKey), ui::MODAL_TYPE_WINDOW); 65 DCHECK_NE(child->GetProperty(aura::client::kModalKey), ui::MODAL_TYPE_WINDOW);
65 66
66 child->AddObserver(this); 67 child->AddObserver(this);
67 if (child->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_SYSTEM && 68 if (child->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_SYSTEM &&
68 child->IsVisible()) { 69 child->IsVisible()) {
69 AddModalWindow(child); 70 AddModalWindow(child);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 bool SystemModalContainerLayoutManager::DialogIsCentered( 268 bool SystemModalContainerLayoutManager::DialogIsCentered(
268 const gfx::Rect& window_bounds) { 269 const gfx::Rect& window_bounds) {
269 gfx::Point window_center = window_bounds.CenterPoint(); 270 gfx::Point window_center = window_bounds.CenterPoint();
270 gfx::Point container_center = GetUsableDialogArea().CenterPoint(); 271 gfx::Point container_center = GetUsableDialogArea().CenterPoint();
271 return std::abs(window_center.x() - container_center.x()) < 272 return std::abs(window_center.x() - container_center.x()) <
272 kCenterPixelDelta && 273 kCenterPixelDelta &&
273 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta; 274 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta;
274 } 275 }
275 276
276 } // namespace ash 277 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698