Index: ash/wm/activation_controller.cc |
diff --git a/ash/wm/activation_controller.cc b/ash/wm/activation_controller.cc |
index c90846ad5a5aa24b3709d03d8936c39075a0e262..9250854e3f13c1a8175fa376dceb4a7cd6df64b2 100644 |
--- a/ash/wm/activation_controller.cc |
+++ b/ash/wm/activation_controller.cc |
@@ -21,6 +21,17 @@ namespace ash { |
namespace internal { |
namespace { |
+// These are the list of container ids of containers which may contain windows |
+// that need to be activated in the order that they should be activated. |
+const int kWindowContainersCount = 5; |
sky
2012/03/02 00:20:25
Can't you use arraysize?
flackr
2012/03/02 18:09:28
Cool, thanks! Done.
|
+const int kWindowContainers[] = { |
+ kShellWindowId_LockSystemModalContainer, |
+ kShellWindowId_LockScreenContainer, |
+ kShellWindowId_SystemModalContainer, |
+ kShellWindowId_AlwaysOnTopContainer, |
flackr
2012/03/01 23:51:55
Not sure if this is right. This might be annoying
sky
2012/03/02 00:20:25
Maybe we should start in the container you're in.
flackr
2012/03/02 18:09:28
I like that idea, starting from the container you'
|
+ kShellWindowId_DefaultContainer, |
+}; |
+ |
aura::Window* GetContainer(int id) { |
return Shell::GetInstance()->GetContainer(id); |
} |
@@ -208,20 +219,29 @@ void ActivationController::ActivateNextWindow(aura::Window* window) { |
aura::Window* ActivationController::GetTopmostWindowToActivate( |
aura::Window* ignore) const { |
- const aura::Window* container = |
- default_container_for_test_ ? default_container_for_test_ : |
- GetContainer(kShellWindowId_DefaultContainer); |
- // When destructing an active window that is in a container destructed after |
- // the default container during shell shutdown, |container| would be NULL |
- // because default container is destructed at this point. |
- if (container) { |
- for (aura::Window::Windows::const_reverse_iterator i = |
- container->children().rbegin(); |
- i != container->children().rend(); |
- ++i) { |
- if (*i != ignore && CanActivateWindow(*i)) |
- return *i; |
- } |
+ if (default_container_for_test_) { |
flackr
2012/03/01 23:51:55
Currently this prevents me from testing this prope
sky
2012/03/02 00:20:25
Set it to NULL for your test?
flackr
2012/03/02 18:09:28
Right, I'll do that and use all the standard conta
flackr
2012/03/02 18:12:23
This didn't actually end up being an issue.
|
+ return GetTopmostWindowToActivateInContainer(default_container_for_test_, |
+ ignore); |
+ } |
+ |
+ aura::Window* window = NULL; |
+ for (int i = 0; !window && i < kWindowContainersCount; i++) { |
+ window = GetTopmostWindowToActivateInContainer( |
+ GetContainer(kWindowContainers[i]), |
+ ignore); |
+ } |
+ return window; |
+} |
+ |
+aura::Window* ActivationController::GetTopmostWindowToActivateInContainer( |
+ aura::Window* container, |
+ aura::Window* ignore) const { |
+ for (aura::Window::Windows::const_reverse_iterator i = |
+ container->children().rbegin(); |
+ i != container->children().rend(); |
+ ++i) { |
+ if (*i != ignore && CanActivateWindow(*i)) |
+ return *i; |
} |
return NULL; |
} |