Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ | 5 #ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ |
| 6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ | 6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 } | 32 } |
| 33 | 33 |
| 34 namespace ui { | 34 namespace ui { |
| 35 class LocatedEvent; | 35 class LocatedEvent; |
| 36 } | 36 } |
| 37 | 37 |
| 38 namespace ash { | 38 namespace ash { |
| 39 class WindowSelectorDelegate; | 39 class WindowSelectorDelegate; |
| 40 class WindowSelectorItem; | 40 class WindowSelectorItem; |
| 41 class WindowSelectorTest; | 41 class WindowSelectorTest; |
| 42 class WindowGrid; | |
| 42 | 43 |
| 43 // The WindowSelector shows a grid of all of your windows, allowing to select | 44 // The WindowSelector shows a grid of all of your windows, allowing to select |
| 44 // one by clicking or tapping on it. | 45 // one by clicking or tapping on it. |
| 45 class ASH_EXPORT WindowSelector | 46 class ASH_EXPORT WindowSelector |
| 46 : public ui::EventHandler, | 47 : public ui::EventHandler, |
| 47 public gfx::DisplayObserver, | 48 public gfx::DisplayObserver, |
| 48 public aura::WindowObserver, | 49 public aura::WindowObserver, |
| 49 public aura::client::ActivationChangeObserver { | 50 public aura::client::ActivationChangeObserver { |
| 50 public: | 51 public: |
| 52 enum Direction { | |
| 53 RIGHT, | |
| 54 DOWN, | |
| 55 LEFT, | |
| 56 UP | |
| 57 }; | |
| 58 | |
| 51 typedef std::vector<aura::Window*> WindowList; | 59 typedef std::vector<aura::Window*> WindowList; |
| 52 typedef ScopedVector<WindowSelectorItem> WindowSelectorItemList; | 60 typedef ScopedVector<WindowSelectorItem> WindowSelectorItemList; |
| 53 | 61 |
| 54 WindowSelector(const WindowList& windows, | 62 WindowSelector(const WindowList& windows, |
| 55 WindowSelectorDelegate* delegate); | 63 WindowSelectorDelegate* delegate); |
| 56 virtual ~WindowSelector(); | 64 virtual ~WindowSelector(); |
| 57 | 65 |
| 58 // Choose |window| from the available windows to select. | 66 // Choose |window| from the available windows to select. |
| 59 void SelectWindow(aura::Window* window); | 67 void SelectWindow(aura::Window* window); |
| 60 | 68 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 86 virtual void OnAttemptToReactivateWindow( | 94 virtual void OnAttemptToReactivateWindow( |
| 87 aura::Window* request_active, | 95 aura::Window* request_active, |
| 88 aura::Window* actual_active) OVERRIDE; | 96 aura::Window* actual_active) OVERRIDE; |
| 89 | 97 |
| 90 private: | 98 private: |
| 91 friend class WindowSelectorTest; | 99 friend class WindowSelectorTest; |
| 92 | 100 |
| 93 // Begins positioning windows such that all windows are visible on the screen. | 101 // Begins positioning windows such that all windows are visible on the screen. |
| 94 void StartOverview(); | 102 void StartOverview(); |
| 95 | 103 |
| 96 // Position all of the windows based on the current selection mode. | 104 // Position all of the windows in the overview. |
| 97 void PositionWindows(bool animate); | 105 void PositionWindows(bool animate); |
| 98 // Position all of the windows from |root_window| on |root_window|. | 106 |
| 99 void PositionWindowsFromRoot(aura::Window* root_window, bool animate); | 107 // Creates the WindowGrid objects and populates them with the current windows. |
| 108 void CreateWindowGrids(); | |
| 100 | 109 |
| 101 // Resets the stored window from RemoveFocusAndSetRestoreWindow to NULL. If | 110 // Resets the stored window from RemoveFocusAndSetRestoreWindow to NULL. If |
| 102 // Hide and track all hidden windows not in overview. | 111 // Hide and track all hidden windows not in overview. |
| 103 void HideAndTrackNonOverviewWindows(); | 112 void HideAndTrackNonOverviewWindows(); |
| 104 | 113 |
| 105 // |focus|, restores focus to the stored window. | 114 // |focus|, restores focus to the stored window. |
| 106 void ResetFocusRestoreWindow(bool focus); | 115 void ResetFocusRestoreWindow(bool focus); |
| 107 | 116 |
| 108 // Returns the target of |event| or NULL if the event is not targeted at | 117 // Returns the target of |event| or NULL if the event is not targeted at |
| 109 // any of the windows in the selector. | 118 // any of the windows in the selector. |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 126 | 135 |
| 127 // A weak pointer to the window which was focused on beginning window | 136 // A weak pointer to the window which was focused on beginning window |
| 128 // selection. If window selection is canceled the focus should be restored to | 137 // selection. If window selection is canceled the focus should be restored to |
| 129 // this window. | 138 // this window. |
| 130 aura::Window* restore_focus_window_; | 139 aura::Window* restore_focus_window_; |
| 131 | 140 |
| 132 // True when performing operations that may cause window activations. This is | 141 // True when performing operations that may cause window activations. This is |
| 133 // used to prevent handling the resulting expected activation. | 142 // used to prevent handling the resulting expected activation. |
| 134 bool ignore_activations_; | 143 bool ignore_activations_; |
| 135 | 144 |
| 145 // List of all the window overview grids, one for each window. | |
|
tdanderson
2014/05/28 16:01:19
One for each root window?
Nina
2014/05/29 17:12:24
Yes. Modified comment.
| |
| 146 ScopedVector<WindowGrid> grid_list_; | |
| 147 | |
| 136 // The cursor client used to lock the current cursor during overview. | 148 // The cursor client used to lock the current cursor during overview. |
| 137 aura::client::CursorClient* cursor_client_; | 149 aura::client::CursorClient* cursor_client_; |
| 138 | 150 |
| 139 // The time when overview was started. | 151 // The time when overview was started. |
| 140 base::Time overview_start_time_; | 152 base::Time overview_start_time_; |
| 141 | 153 |
| 142 // Tracks windows which were hidden because they were not part of the | 154 // Tracks windows which were hidden because they were not part of the |
| 143 // overview. | 155 // overview. |
| 144 aura::WindowTracker hidden_windows_; | 156 aura::WindowTracker hidden_windows_; |
| 145 | 157 |
| 158 // Tracks the index of the root window the selection widget is in. | |
| 159 size_t root_index_; | |
| 160 | |
| 146 DISALLOW_COPY_AND_ASSIGN(WindowSelector); | 161 DISALLOW_COPY_AND_ASSIGN(WindowSelector); |
| 147 }; | 162 }; |
| 148 | 163 |
| 149 } // namespace ash | 164 } // namespace ash |
| 150 | 165 |
| 151 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ | 166 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ |
| OLD | NEW |