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

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

Issue 251103005: Added arrow key navigation to Overview Mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added reposition animation, shortened movement time, fixed what Terry commented. Created 6 years, 7 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_grid.h
diff --git a/ash/wm/overview/window_grid.h b/ash/wm/overview/window_grid.h
new file mode 100644
index 0000000000000000000000000000000000000000..d507a26e68d41bd48faa2d187caf87c0bfd624f0
--- /dev/null
+++ b/ash/wm/overview/window_grid.h
@@ -0,0 +1,92 @@
+// Copyright 2014 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.
+
+#ifndef ASH_WM_OVERVIEW_WINDOW_GRID_H_
+#define ASH_WM_OVERVIEW_WINDOW_GRID_H_
+
+#include <vector>
+
+#include "ash/wm/overview/window_selector.h"
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace aura {
+class Window;
+}
+
+namespace views {
+class Widget;
+}
+
+namespace ash {
flackr 2014/05/29 20:04:25 nit: blank line after non-trivial namespace block
Nina 2014/06/02 22:04:38 Done.
+class WindowSelectorItem;
+
+// Represents a grid of windows in the Overview Mode in a particular root
+// window.
+class WindowGrid {
+ public:
+ WindowGrid(aura::Window* root_window,
+ std::vector<WindowSelectorItem*> window_list);
+ ~WindowGrid();
+
+ // Creates the selection widget, animating it to the specified |direction|.
+ void CreateSelectionWidget(WindowSelector::Direction direction);
+
+ // Moves the selection widget to the specified |direction|. Returns true if,
+ // after moving, the widget is out of bounds.
+ bool Move(WindowSelector::Direction direction);
+
+ // Positions all the windows in the grid.
+ void PositionWindows(bool animate);
+
+ // Removes |window| from the grid, if present. If this action removes a
+ // WindowSelectorItem, return it. Otherwise, return NULL.
+ // RemoveWindow() repositions the items in the grid if necessary.
+ WindowSelectorItem* RemoveWindow(aura::Window* window);
+
+ // Returns the target selected window, or NULL if there is none selected.
+ WindowSelectorItem* SelectedWindow() const;
+
+ // Returns true if the grid no more windows.
flackr 2014/05/29 20:04:25 nit: s/grid no more/grid has no more
Nina 2014/06/02 22:04:38 Done.
+ bool empty() { return window_list_.empty(); }
flackr 2014/05/29 20:04:25 nit: const.
Nina 2014/06/02 22:04:38 Done.
+
+ // Returns true if the selection widget is active.
+ bool is_selecting() { return selection_widget_ != NULL; }
flackr 2014/05/29 20:04:25 nit: const.
Nina 2014/06/02 22:04:38 Done.
+
+ // Returns the root window in which the grid displays the windows.
+ const aura::Window* root_window() { return root_window_; }
flackr 2014/05/29 20:04:25 nit: const.
Nina 2014/06/02 22:04:38 Done.
+
+ private:
+ // Internal function to initialize the selection widget.
+ void InitSelectionWidget(WindowSelector::Direction direction);
+
+ // Updates |selected_index_| according to the specified |direction|. Returns
+ // |true| if the new selection index is out of this window grid bounds.
+ bool MoveSelectedIndex(WindowSelector::Direction direction);
+
+ // Returns the target bounds of the currently selected item.
+ const gfx::Rect GetSelectionBounds() const;
+
+ // Root window the grid is in.
+ aura::Window* root_window_;
+
+ // Vector containing all the windows in this grid.
+ std::vector<WindowSelectorItem*> window_list_;
+
+ // Widget that indicates to the user which is the selected window.
+ scoped_ptr<views::Widget> selection_widget_;
+
+ // Current selected window position.
+ size_t selected_index_;
+
+ // Grid size.
+ size_t num_rows_;
flackr 2014/05/29 20:04:25 Remove this from the class, it's only used once ou
Nina 2014/06/02 22:04:38 Done.
+ size_t num_columns_;
+
+ DISALLOW_COPY_AND_ASSIGN(WindowGrid);
+};
+
+} // namespace ash
+
+#endif // ASH_WM_OVERVIEW_WINDOW_GRID_H_
« no previous file with comments | « ash/ash.gyp ('k') | ash/wm/overview/window_grid.cc » ('j') | ash/wm/overview/window_grid.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698