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

Unified Diff: ash/wm/stacking_controller.cc

Issue 15690015: Fix crash when JS alert from background page appears during lock screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments resolved Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/shell_unittest.cc ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/stacking_controller.cc
diff --git a/ash/wm/stacking_controller.cc b/ash/wm/stacking_controller.cc
index 3802440be6da86583f1893ddfd66be6879552de9..7b3337ff780f00c010a57752733168b60e9e760e 100644
--- a/ash/wm/stacking_controller.cc
+++ b/ash/wm/stacking_controller.cc
@@ -119,22 +119,22 @@ aura::Window* StackingController::GetSystemModalContainer(
// If screen lock is not active and user session is active,
// all modal windows are placed into the normal modal container.
- if (!Shell::GetInstance()->session_state_delegate()->IsScreenLocked() &&
- Shell::GetInstance()->session_state_delegate()->
- IsActiveUserSessionStarted()) {
+ // In case of missing transient parent (it could happen for alerts from
+ // background pages) assume that the window belongs to user session.
+ SessionStateDelegate* session_state_delegate =
+ Shell::GetInstance()->session_state_delegate();
+ if ((!session_state_delegate->IsScreenLocked() &&
+ session_state_delegate->IsActiveUserSessionStarted()) ||
+ !window->transient_parent()) {
return GetContainerById(root,
internal::kShellWindowId_SystemModalContainer);
}
// Otherwise those that originate from LockScreen container and above are
// placed in the screen lock modal container.
- aura::Window* lock_container =
- GetContainerById(root, internal::kShellWindowId_LockScreenContainer);
- int lock_container_id = lock_container->id();
int window_container_id = window->transient_parent()->parent()->id();
-
aura::Window* container = NULL;
- if (window_container_id < lock_container_id) {
+ if (window_container_id < internal::kShellWindowId_LockScreenContainer) {
container = GetContainerById(
root, internal::kShellWindowId_SystemModalContainer);
} else {
« no previous file with comments | « ash/shell_unittest.cc ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698