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

Unified Diff: chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc

Issue 74363004: Switching to the correct desktop when a system modal dialog gets shown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
Index: chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc
index 2b8890cfb3e4d949d9f530fdcb5560fa28987660..cc9a66bc87e39ed0759ebaa818795c0a87774e58 100644
--- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc
+++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc
@@ -8,9 +8,11 @@
#include "apps/shell_window_registry.h"
#include "ash/ash_switches.h"
#include "ash/multi_profile_uma.h"
+#include "ash/root_window_controller.h"
#include "ash/session_state_delegate.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
+#include "ash/shell_window_ids.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/window_positioner.h"
#include "ash/wm/window_state.h"
@@ -467,6 +469,31 @@ void MultiUserWindowManagerChromeOS::SetWindowVisibility(
if (window->IsVisible() == visible)
return;
+ // Hiding a system modal dialog should not be allowed. Instead we switch to
+ // the user which is showing the system modal window.
+ if (!visible) {
+ // Get the system modal container for the window's root window.
+ ash::internal::RootWindowController* controller =
sky 2013/11/16 00:34:55 Classes in internal namespaces shouldn't be used o
Mr4D (OOO till 08-26) 2013/11/16 00:54:27 Done.
+ ash::internal::GetRootWindowController(window->GetRootWindow());
+ aura::Window* system_modal_container =
+ controller->GetContainer(
+ ash::internal::kShellWindowId_SystemModalContainer);
+ if (window->parent() == system_modal_container) {
+ // The window is system modal and we need to find the parent which owns
+ // it so that we can switch to the desktop accordingly.
+ std::string user_id = GetUserPresentingWindow(window);
+ if (user_id.empty()) {
+ aura::Window* owning_window = GetOwningWindowInTransientChain(window);
+ if (owning_window)
sky 2013/11/16 00:34:55 Should this be a DCHECK? Otherwise you know 490 is
Mr4D (OOO till 08-26) 2013/11/16 00:54:27 Done.
+ user_id = GetUserPresentingWindow(owning_window);
+ }
+ DCHECK(!user_id.empty());
+ ash::Shell::GetInstance()->session_state_delegate()->SwitchActiveUser(
+ user_id);
+ return;
+ }
+ }
+
// To avoid that these commands are recorded as any other commands, we are
// suppressing any window entry changes while this is going on.
base::AutoReset<bool> suppressor(&suppress_visibility_changes_, true);

Powered by Google App Engine
This is Rietveld 408576698