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

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

Issue 2070163002: Fix "modal isn't modal in multi displays" issue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modal fix Created 4 years, 6 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"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 //////////////////////////////////////////////////////////////////////////////// 107 ////////////////////////////////////////////////////////////////////////////////
108 // SystemModalContainerLayoutManager, Keyboard::KeybaordControllerObserver 108 // SystemModalContainerLayoutManager, Keyboard::KeybaordControllerObserver
109 // implementation: 109 // implementation:
110 110
111 void SystemModalContainerLayoutManager::OnKeyboardBoundsChanging( 111 void SystemModalContainerLayoutManager::OnKeyboardBoundsChanging(
112 const gfx::Rect& new_bounds) { 112 const gfx::Rect& new_bounds) {
113 PositionDialogsAfterWorkAreaResize(); 113 PositionDialogsAfterWorkAreaResize();
114 } 114 }
115 115
116 bool SystemModalContainerLayoutManager::CanWindowReceiveEvents( 116 bool SystemModalContainerLayoutManager::IsActiveModalWindows(
117 aura::Window* window) { 117 aura::Window* window) {
118 // We could get when we're at lock screen and there is modal window at 118 return modal_window() != nullptr &&
James Cook 2016/06/16 20:31:35 For my knowledge: Do we now prefer comparing to nu
oshima 2016/06/17 00:06:12 I saw the discussion but I haven't read to the con
James Cook 2016/06/17 16:04:43 I prefer !pointer myself, just for consistency wit
119 // system modal window layer which added event filter. 119 wm::GetActivatableWindow(window) == modal_window();
120 // Now this lock modal windows layer layout manager should not block events
121 // for windows at lock layer.
122 // See SystemModalContainerLayoutManagerTest.EventFocusContainers and
123 // http://crbug.com/157469
124 if (modal_windows_.empty())
125 return true;
126 // This container can not handle events if the screen is locked and it is not
127 // above the lock screen layer (crbug.com/110920).
128 if (Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked() &&
129 container_->id() < ash::kShellWindowId_LockScreenContainer)
130 return true;
131 return wm::GetActivatableWindow(window) == modal_window();
132 } 120 }
133 121
134 bool SystemModalContainerLayoutManager::ActivateNextModalWindow() { 122 bool SystemModalContainerLayoutManager::ActivateNextModalWindow() {
135 if (modal_windows_.empty()) 123 if (modal_windows_.empty())
136 return false; 124 return false;
137 wm::ActivateWindow(modal_window()); 125 wm::ActivateWindow(modal_window());
138 return true; 126 return true;
139 } 127 }
140 128
141 void SystemModalContainerLayoutManager::CreateModalBackground() { 129 void SystemModalContainerLayoutManager::CreateModalBackground() {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 bool SystemModalContainerLayoutManager::DialogIsCentered( 241 bool SystemModalContainerLayoutManager::DialogIsCentered(
254 const gfx::Rect& window_bounds) { 242 const gfx::Rect& window_bounds) {
255 gfx::Point window_center = window_bounds.CenterPoint(); 243 gfx::Point window_center = window_bounds.CenterPoint();
256 gfx::Point container_center = GetUsableDialogArea().CenterPoint(); 244 gfx::Point container_center = GetUsableDialogArea().CenterPoint();
257 return 245 return
258 std::abs(window_center.x() - container_center.x()) < kCenterPixelDelta && 246 std::abs(window_center.x() - container_center.x()) < kCenterPixelDelta &&
259 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta; 247 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta;
260 } 248 }
261 249
262 } // namespace ash 250 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698