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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ASH_WM_OVERVIEW_WINDOW_GRID_H_
6 #define ASH_WM_OVERVIEW_WINDOW_GRID_H_
7
8 #include <vector>
9
10 #include "ash/wm/overview/window_selector.h"
11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13
14 namespace aura {
15 class Window;
16 }
17
18 namespace views {
19 class Widget;
20 }
21
22 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.
23 class WindowSelectorItem;
24
25 // Represents a grid of windows in the Overview Mode in a particular root
26 // window.
27 class WindowGrid {
28 public:
29 WindowGrid(aura::Window* root_window,
30 std::vector<WindowSelectorItem*> window_list);
31 ~WindowGrid();
32
33 // Creates the selection widget, animating it to the specified |direction|.
34 void CreateSelectionWidget(WindowSelector::Direction direction);
35
36 // Moves the selection widget to the specified |direction|. Returns true if,
37 // after moving, the widget is out of bounds.
38 bool Move(WindowSelector::Direction direction);
39
40 // Positions all the windows in the grid.
41 void PositionWindows(bool animate);
42
43 // Removes |window| from the grid, if present. If this action removes a
44 // WindowSelectorItem, return it. Otherwise, return NULL.
45 // RemoveWindow() repositions the items in the grid if necessary.
46 WindowSelectorItem* RemoveWindow(aura::Window* window);
47
48 // Returns the target selected window, or NULL if there is none selected.
49 WindowSelectorItem* SelectedWindow() const;
50
51 // 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.
52 bool empty() { return window_list_.empty(); }
flackr 2014/05/29 20:04:25 nit: const.
Nina 2014/06/02 22:04:38 Done.
53
54 // Returns true if the selection widget is active.
55 bool is_selecting() { return selection_widget_ != NULL; }
flackr 2014/05/29 20:04:25 nit: const.
Nina 2014/06/02 22:04:38 Done.
56
57 // Returns the root window in which the grid displays the windows.
58 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.
59
60 private:
61 // Internal function to initialize the selection widget.
62 void InitSelectionWidget(WindowSelector::Direction direction);
63
64 // Updates |selected_index_| according to the specified |direction|. Returns
65 // |true| if the new selection index is out of this window grid bounds.
66 bool MoveSelectedIndex(WindowSelector::Direction direction);
67
68 // Returns the target bounds of the currently selected item.
69 const gfx::Rect GetSelectionBounds() const;
70
71 // Root window the grid is in.
72 aura::Window* root_window_;
73
74 // Vector containing all the windows in this grid.
75 std::vector<WindowSelectorItem*> window_list_;
76
77 // Widget that indicates to the user which is the selected window.
78 scoped_ptr<views::Widget> selection_widget_;
79
80 // Current selected window position.
81 size_t selected_index_;
82
83 // Grid size.
84 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.
85 size_t num_columns_;
86
87 DISALLOW_COPY_AND_ASSIGN(WindowGrid);
88 };
89
90 } // namespace ash
91
92 #endif // ASH_WM_OVERVIEW_WINDOW_GRID_H_
OLDNEW
« 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