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

Unified Diff: ash/wm/overview/window_selector.h

Issue 251103005: Added arrow key navigation to Overview Mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replaced unittest by a better one, fixed lints, minor tweaks. Created 6 years, 6 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
Index: ash/wm/overview/window_selector.h
diff --git a/ash/wm/overview/window_selector.h b/ash/wm/overview/window_selector.h
index 158df2cf7ea2604ca31d8d3354c5573b23f5101e..5ef010a07c2ca5d4b4890b9d13c81947258ee9bb 100644
--- a/ash/wm/overview/window_selector.h
+++ b/ash/wm/overview/window_selector.h
@@ -36,6 +36,7 @@ namespace ash {
class WindowSelectorDelegate;
class WindowSelectorItem;
class WindowSelectorTest;
+class WindowGrid;
// The WindowSelector shows a grid of all of your windows, allowing to select
// one by clicking or tapping on it.
@@ -45,6 +46,13 @@ class ASH_EXPORT WindowSelector
public aura::WindowObserver,
public aura::client::ActivationChangeObserver {
public:
+ enum Direction {
+ RIGHT,
+ DOWN,
+ LEFT,
+ UP
+ };
+
typedef std::vector<aura::Window*> WindowList;
typedef ScopedVector<WindowSelectorItem> WindowSelectorItemList;
@@ -55,6 +63,9 @@ class ASH_EXPORT WindowSelector
// Cancels window selection.
void CancelSelection();
+ // Called when the last window selector item from a grid is deleted.
+ void OnGridEmpty(WindowGrid* grid);
+
// ui::EventHandler:
virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
@@ -66,9 +77,6 @@ class ASH_EXPORT WindowSelector
// aura::WindowObserver:
virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE;
- virtual void OnWindowBoundsChanged(aura::Window* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) OVERRIDE;
virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
// aura::client::ActivationChangeObserver:
@@ -84,25 +92,23 @@ class ASH_EXPORT WindowSelector
// Begins positioning windows such that all windows are visible on the screen.
void StartOverview();
- // Returns true if a window is contained in the overview, and therefore should
- // not be hidden prior to entering overview mode.
- bool Contains(const aura::Window* window);
-
- // Position all of the windows based on the current selection mode.
+ // Position all of the windows in the overview.
void PositionWindows(bool animate);
- // Position all of the windows from |root_window| on |root_window|.
- void PositionWindowsFromRoot(aura::Window* root_window, bool animate);
- // Resets the stored window from RemoveFocusAndSetRestoreWindow to NULL. If
- // Hide and track all hidden windows not in overview.
+ // Creates the WindowGrid objects and populates them with the current windows.
+ void CreateWindowGrids();
+
+ // Hide and track all hidden windows not in the overview item list.
void HideAndTrackNonOverviewWindows();
// |focus|, restores focus to the stored window.
void ResetFocusRestoreWindow(bool focus);
- // The collection of items in the overview wrapped by a helper class which
- // restores their state and helps transform them to other root windows.
- ScopedVector<WindowSelectorItem> windows_;
+ // Helper function that moves the selection widget to |direction| on the
+ // corresponding window grid.
+ void Move(Direction direction);
+
+ // Returns the WindowSelectorItem
// Tracks observed windows.
std::set<aura::Window*> observed_windows_;
@@ -120,6 +126,9 @@ class ASH_EXPORT WindowSelector
// used to prevent handling the resulting expected activation.
bool ignore_activations_;
+ // List of all the window overview grids, one for each root window.
+ ScopedVector<WindowGrid> grid_list_;
+
// The time when overview was started.
base::Time overview_start_time_;
@@ -127,6 +136,9 @@ class ASH_EXPORT WindowSelector
// overview.
aura::WindowTracker hidden_windows_;
+ // Tracks the index of the root window the selection widget is in.
+ size_t selected_grid_index_;
+
DISALLOW_COPY_AND_ASSIGN(WindowSelector);
};

Powered by Google App Engine
This is Rietveld 408576698