Aura: Convert Alt-tab to most-recently-used order

* Windows should cycle A -> B -> A for repeated Alt-tab presses.
* Holding down Alt allows cycling A -> B -> C -> D...
* Extracted cycling logic into WindowCycleController.
* Added unit tests for new behavior.

BUG=109193
TEST=aura_shell_unittests WindowCycleControllerTest

Review URL: http://codereview.chromium.org/9101010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117112 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index 3da311a7..3ece145 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -1,9 +1,15 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
 #include "ash/test/test_shell_delegate.h"
 
+#include <algorithm>
+
+#include "ash/shell.h"
+#include "ash/shell_window_ids.h"
+#include "ui/aura/window.h"
+
 namespace ash {
 namespace test {
 
@@ -32,6 +38,17 @@
   return NULL;
 }
 
+std::vector<aura::Window*> TestShellDelegate::GetCycleWindowList() const {
+  // We just use the Shell's default container of windows, so tests can be
+  // written with the usual CreateTestWindowWithId() calls. But window cycling
+  // expects the topmost window at the front of the list, so reverse the order.
+  aura::Window* default_container = Shell::GetInstance()->GetContainer(
+      internal::kShellWindowId_DefaultContainer);
+  std::vector<aura::Window*> windows = default_container->children();
+  std::reverse(windows.begin(), windows.end());
+  return windows;
+}
+
 void TestShellDelegate::LauncherItemClicked(const LauncherItem& item) {
 }