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

Unified Diff: ash/common/wm/window_cycle_controller.cc

Issue 2668693006: Exclude a couple types of windows from CrOS Alt+Tab. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/window_cycle_controller.cc
diff --git a/ash/common/wm/window_cycle_controller.cc b/ash/common/wm/window_cycle_controller.cc
index 2b8ccc9ddf1efc592056e199d1d62a28d136cbfc..686290e54064664a3af0ddb3f256598b5223de62 100644
--- a/ash/common/wm/window_cycle_controller.cc
+++ b/ash/common/wm/window_cycle_controller.cc
@@ -9,6 +9,7 @@
#include "ash/common/wm/mru_window_tracker.h"
#include "ash/common/wm/window_cycle_event_filter.h"
#include "ash/common/wm/window_cycle_list.h"
+#include "ash/common/wm/window_state.h"
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window.h"
#include "ash/public/cpp/shell_window_ids.h"
@@ -54,18 +55,24 @@ void WindowCycleController::HandleCycleWindow(Direction direction) {
void WindowCycleController::StartCycling() {
MruWindowTracker::WindowList window_list =
WmShell::Get()->mru_window_tracker()->BuildMruWindowList();
- // Exclude the AppList window, which will hide as soon as cycling starts
- // anyway. It doesn't make sense to count it as a "switchable" window, yet
- // a lot of code relies on the MRU list returning the app window. If we
- // don't manually remove it, the window cycling UI won't crash or misbehave,
- // but there will be a flicker as the target window changes.
+ // Exclude windows:
+ // - non user positionable windows, such as extension popups.
+ // - windows being dragged
+ // - the AppList window, which will hide as soon as cycling starts
+ // anyway. It doesn't make sense to count it as a "switchable" window, yet
+ // a lot of code relies on the MRU list returning the app window. If we
+ // don't manually remove it, the window cycling UI won't crash or misbehave,
+ // but there will be a flicker as the target window changes. Also exclude
+ // unselectable windows such as extension popups.
+ auto window_is_ineligible = [](WmWindow* window) {
+ wm::WindowState* state = window->GetWindowState();
+ return !state->IsUserPositionable() || state->is_dragged() ||
+ window->GetRootWindow()
+ ->GetChildByShellWindowId(kShellWindowId_AppListContainer)
+ ->Contains(window);
+ };
window_list.erase(std::remove_if(window_list.begin(), window_list.end(),
- [](WmWindow* window) {
- return window->GetRootWindow()
- ->GetChildByShellWindowId(
- kShellWindowId_AppListContainer)
- ->Contains(window);
- }),
+ window_is_ineligible),
window_list.end());
active_window_before_window_cycle_ = GetActiveWindow(window_list);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698