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..9ee17b73f0ee10fcf5e2e0946e7f27c8b61ff72e |
--- /dev/null |
+++ b/ash/wm/overview/window_grid.h |
@@ -0,0 +1,79 @@ |
+// 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 { |
+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(); |
+ |
+ // Moves the selection widget to the specified |direction|. Returns false if, |
+ // after moving, the widget is out of bounds. |
+ bool Move(WindowSelector::Direction direction); |
+ |
+ // Positions all the windows in the grid. If a window pointer is invalid, the |
tdanderson
2014/05/28 16:01:19
Just reading this header file and not looking into
Nina
2014/05/29 17:12:24
I'll consider that for future changes. I removed t
|
+ // behavior is undefined. |
+ void PositionWindows(bool animate); |
+ |
+ // Removes |window| from the grid, if present. Returns true if this was the |
+ // case, false if |window| was not found. |
tdanderson
2014/05/28 16:01:19
This comment needs to be updated since RemoveWindo
Nina
2014/05/29 17:12:24
Done.
|
+ 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. |
+ bool empty() { return window_list_.empty(); } |
+ |
+ private: |
+ // 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); |
+ |
+ const gfx::Rect GetSelectionBounds() const; |
tdanderson
2014/05/28 16:01:19
Add documentation for this.
Nina
2014/05/29 17:12:24
Done.
|
+ |
+ // 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 the user which is the selected window. |
tdanderson
2014/05/28 16:01:19
to the user
Nina
2014/05/29 17:12:24
Done.
|
+ scoped_ptr<views::Widget> selection_widget_; |
+ |
+ // Current selected window position. |
+ size_t selected_index_; |
+ |
+ // Grid size. |
+ size_t rows_; |
tdanderson
2014/05/28 16:01:19
I would prefer num_rows_ and num_columns_ to make
Nina
2014/05/29 17:12:24
Done.
|
+ size_t columns_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(WindowGrid); |
+}; |
+ |
+} // namespace ash |
+ |
+#endif // ASH_WM_OVERVIEW_WINDOW_GRID_H_ |