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); |