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

Unified Diff: ash/wm/activation_controller.cc

Issue 9568045: Activate windows in topmost containers when a window is hidden. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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
« no previous file with comments | « ash/wm/activation_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « ash/wm/activation_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698