Index: chrome/browser/ui/views/ash/chrome_shell_delegate.cc |
diff --git a/chrome/browser/ui/views/ash/chrome_shell_delegate.cc b/chrome/browser/ui/views/ash/chrome_shell_delegate.cc |
index 7982438c472d018820cfb02b592da418c26c3ae3..a4ac7172a0e2a99b685b79f6121a897354a57f0b 100644 |
--- a/chrome/browser/ui/views/ash/chrome_shell_delegate.cc |
+++ b/chrome/browser/ui/views/ash/chrome_shell_delegate.cc |
@@ -2,11 +2,15 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include <algorithm> |
sky
2012/03/21 15:26:18
This should be between 7 and 8, eg:
#include "chr
|
+ |
#include "chrome/browser/ui/views/ash/chrome_shell_delegate.h" |
#include "ash/launcher/launcher_types.h" |
+#include "ash/shell_window_ids.h" |
#include "ash/system/tray/system_tray_delegate.h" |
#include "ash/wm/partial_screenshot_view.h" |
+#include "ash/wm/window_modality_controller.h" |
#include "ash/wm/window_util.h" |
#include "base/command_line.h" |
#include "chrome/browser/ui/browser.h" |
@@ -25,17 +29,19 @@ |
#endif |
namespace { |
-// Returns a list of Aura windows from a BrowserList, using either a |
-// const_iterator or const_reverse_iterator. |
-template<typename IT> |
-std::vector<aura::Window*> GetBrowserWindows(IT begin, IT end) { |
- std::vector<aura::Window*> windows; |
- for (IT it = begin; it != end; ++it) { |
- Browser* browser = *it; |
- if (browser && browser->window()->GetNativeHandle()) |
- windows.push_back(browser->window()->GetNativeHandle()); |
- } |
- return windows; |
+// Returns if the given window should skip on the window cycle list or not. |
+bool ShouldSkipOnCycle(aura::Window* window) { |
sky
2012/03/21 15:26:18
The ActivationClient is ultimately the place that
|
+ // Skips if the window can't have a focus. |
+ if (!window->CanFocus()) |
+ return true; |
+ |
+ // Skips if the window has a modal child. |
+ aura::Window* modal_transient = ash::wm::GetWindowModalTransient(window); |
+ if (modal_transient && modal_transient != window) |
+ return true; |
+ |
+ // Otherwise, remains. |
+ return false; |
} |
} // namespace |
@@ -84,9 +90,19 @@ ChromeShellDelegate::CreateAppListViewDelegate() { |
std::vector<aura::Window*> ChromeShellDelegate::GetCycleWindowList( |
CycleSource source) const { |
- // BrowserList maintains a list of browsers sorted by activity. |
- return GetBrowserWindows(BrowserList::begin_last_active(), |
- BrowserList::end_last_active()); |
+ aura::Window* default_container = ash::Shell::GetInstance()->GetContainer( |
+ ash::internal::kShellWindowId_DefaultContainer); |
+ std::vector<aura::Window*> windows = default_container->children(); |
+ // Removes unforcusable windows. |
+ std::vector<aura::Window*>::iterator last = |
+ std::remove_if( |
sky
2012/03/21 15:26:18
indent this line 4.
|
+ windows.begin(), |
+ windows.end(), |
+ ShouldSkipOnCycle); |
+ windows.erase(last, windows.end()); |
+ // Window cycling expects the topmost window at the front of the list. |
+ std::reverse(windows.begin(), windows.end()); |
+ return windows; |
} |
void ChromeShellDelegate::StartPartialScreenshot( |