Chromium Code Reviews| Index: ash/wm/ash_focus_rules.cc |
| diff --git a/ash/wm/ash_focus_rules.cc b/ash/wm/ash_focus_rules.cc |
| index 66fe0b22b1af60d8899462307f8b8c7d51f10508..d8ecd17f992bce90ff4d05fa8ef906e0fe0f248a 100644 |
| --- a/ash/wm/ash_focus_rules.cc |
| +++ b/ash/wm/ash_focus_rules.cc |
| @@ -4,10 +4,13 @@ |
| #include "ash/wm/ash_focus_rules.h" |
| +#include "ash/session/session_state_delegate.h" |
| #include "ash/shell.h" |
| #include "ash/shell_window_ids.h" |
| #include "ash/wm/mru_window_tracker.h" |
| #include "ash/wm/window_state.h" |
| +#include "components/user_manager/user.h" |
| +#include "components/user_manager/user_manager.h" |
| #include "ui/aura/window.h" |
| namespace ash { |
| @@ -84,6 +87,25 @@ bool AshFocusRules::SupportsChildActivation(aura::Window* window) const { |
| bool AshFocusRules::IsWindowConsideredVisibleForActivation( |
| aura::Window* window) const { |
| + // If the |window| doesn't belong to the current active user and also doesn't |
| + // show for the current active user, then it should not be activated. |
| + SessionStateDelegate* delegate = |
| + Shell::GetInstance()->session_state_delegate(); |
| + if (delegate->NumberOfLoggedInUsers() > 1) { |
| + const user_manager::UserManager* user_manager = |
| + user_manager::UserManager::Get(); |
| + const user_manager::User* active_user = |
| + user_manager ? user_manager->GetActiveUser() : NULL; |
|
oshima
2015/04/07 19:53:44
Can you use GetActiveBrowserContext and GetUserIn
xdai1
2015/04/09 17:22:40
Done.
|
| + |
| + content::BrowserContext* browser_context = |
| + delegate->GetBrowserContextForWindow(window); |
| + if ((browser_context && |
| + delegate->GetUserInfo(browser_context) != active_user) && |
| + (active_user && |
| + delegate->GetUserPresentingWindow(window) != active_user->GetUserID())) |
| + return false; |
| + } |
| + |
| if (BaseFocusRules::IsWindowConsideredVisibleForActivation(window)) |
| return true; |