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

Unified Diff: ash/wm/ash_focus_rules.cc

Issue 1053013007: Minimized windows should not be activated by another user in multiprofile scenario. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Oshima's comments. Created 5 years, 8 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
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..50796205eef0eb2cc0498a1b6085d96029815c98 100644
--- a/ash/wm/ash_focus_rules.cc
+++ b/ash/wm/ash_focus_rules.cc
@@ -4,7 +4,9 @@
#include "ash/wm/ash_focus_rules.h"
+#include "ash/session/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_state.h"
@@ -84,6 +86,24 @@ 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) {
+ content::BrowserContext* active_browser_context =
+ Shell::GetInstance()->delegate()->GetActiveBrowserContext();
+ content::BrowserContext* owner_browser_context =
+ delegate->GetBrowserContextForWindow(window);
+ content::BrowserContext* shown_browser_context =
+ delegate->GetUserPresentingBrowserContextForWindow(window);
+
+ if (owner_browser_context && active_browser_context &&
+ owner_browser_context != active_browser_context &&
+ shown_browser_context != active_browser_context)
+ return false;
oshima 2015/04/09 17:50:48 you need {} in this case.
xdai1 2015/04/09 22:45:25 Done.
+ }
+
if (BaseFocusRules::IsWindowConsideredVisibleForActivation(window))
return true;

Powered by Google App Engine
This is Rietveld 408576698