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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <set> | 12 #include <set> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "ash/ash_export.h" | 15 #include "ash/ash_export.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "ui/aura/window_observer.h" | 18 #include "ui/aura/window_observer.h" |
19 #include "ui/display/display_observer.h" | 19 #include "ui/display/display_observer.h" |
20 #include "ui/gfx/image/image_skia.h" | 20 #include "ui/gfx/image/image_skia.h" |
21 #include "ui/views/controls/textfield/textfield_controller.h" | 21 #include "ui/views/controls/textfield/textfield_controller.h" |
22 #include "ui/wm/public/activation_change_observer.h" | 22 #include "ui/wm/public/activation_change_observer.h" |
23 | 23 |
24 namespace aura { | |
25 class Window; | |
msw
2017/05/23 22:50:25
nit: not needed (window_observer.h)
varkha
2017/05/24 15:29:15
Done.
| |
26 } | |
27 | |
24 namespace views { | 28 namespace views { |
25 class Textfield; | 29 class Textfield; |
26 class Widget; | 30 class Widget; |
27 } | 31 } |
28 | 32 |
29 namespace ash { | 33 namespace ash { |
30 class WindowSelectorDelegate; | 34 class WindowSelectorDelegate; |
31 class WindowSelectorItem; | 35 class WindowSelectorItem; |
32 class WindowSelectorTest; | 36 class WindowSelectorTest; |
33 class WindowGrid; | 37 class WindowGrid; |
34 class WmWindow; | |
35 | 38 |
36 // The WindowSelector shows a grid of all of your windows, allowing to select | 39 // The WindowSelector shows a grid of all of your windows, allowing to select |
37 // one by clicking or tapping on it. | 40 // one by clicking or tapping on it. |
38 class ASH_EXPORT WindowSelector : public display::DisplayObserver, | 41 class ASH_EXPORT WindowSelector : public display::DisplayObserver, |
39 public aura::WindowObserver, | 42 public aura::WindowObserver, |
40 public aura::client::ActivationChangeObserver, | 43 public aura::client::ActivationChangeObserver, |
41 public views::TextfieldController { | 44 public views::TextfieldController { |
42 public: | 45 public: |
43 // Returns true if the window can be selected in overview mode. | 46 // Returns true if the window can be selected in overview mode. |
44 static bool IsSelectable(WmWindow* window); | 47 static bool IsSelectable(aura::Window* window); |
45 | 48 |
46 enum Direction { LEFT, UP, RIGHT, DOWN }; | 49 enum Direction { LEFT, UP, RIGHT, DOWN }; |
47 | 50 |
48 using WindowList = std::vector<WmWindow*>; | 51 using WindowList = std::vector<aura::Window*>; |
msw
2017/05/23 22:50:25
ditto optional nit
varkha
2017/05/24 15:29:15
Worth include aura/window.h?
| |
49 | 52 |
50 explicit WindowSelector(WindowSelectorDelegate* delegate); | 53 explicit WindowSelector(WindowSelectorDelegate* delegate); |
51 ~WindowSelector() override; | 54 ~WindowSelector() override; |
52 | 55 |
53 // Initialize with the windows that can be selected. | 56 // Initialize with the windows that can be selected. |
54 void Init(const WindowList& windows); | 57 void Init(const WindowList& windows); |
55 | 58 |
56 // Perform cleanup that cannot be done in the destructor. | 59 // Perform cleanup that cannot be done in the destructor. |
57 void Shutdown(); | 60 void Shutdown(); |
58 | 61 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 | 108 |
106 // views::TextfieldController: | 109 // views::TextfieldController: |
107 void ContentsChanged(views::Textfield* sender, | 110 void ContentsChanged(views::Textfield* sender, |
108 const base::string16& new_contents) override; | 111 const base::string16& new_contents) override; |
109 bool HandleKeyEvent(views::Textfield* sender, | 112 bool HandleKeyEvent(views::Textfield* sender, |
110 const ui::KeyEvent& key_event) override; | 113 const ui::KeyEvent& key_event) override; |
111 | 114 |
112 private: | 115 private: |
113 friend class WindowSelectorTest; | 116 friend class WindowSelectorTest; |
114 | 117 |
115 // Returns the WmWindow for |text_filter_widget_|. | 118 // Returns the aura::Window for |text_filter_widget_|. |
116 WmWindow* GetTextFilterWidgetWindow(); | 119 aura::Window* GetTextFilterWidgetWindow(); |
117 | 120 |
118 // Position all of the windows in the overview. | 121 // Position all of the windows in the overview. |
119 void PositionWindows(bool animate); | 122 void PositionWindows(bool animate); |
120 | 123 |
121 // Repositions and resizes |text_filter_widget_| on | 124 // Repositions and resizes |text_filter_widget_| on |
122 // DisplayMetricsChanged event. | 125 // DisplayMetricsChanged event. |
123 void RepositionTextFilterOnDisplayMetricsChange(); | 126 void RepositionTextFilterOnDisplayMetricsChange(); |
124 | 127 |
125 // |focus|, restores focus to the stored window. | 128 // |focus|, restores focus to the stored window. |
126 void ResetFocusRestoreWindow(bool focus); | 129 void ResetFocusRestoreWindow(bool focus); |
127 | 130 |
128 // Helper function that moves the selection widget to |direction| on the | 131 // Helper function that moves the selection widget to |direction| on the |
129 // corresponding window grid. | 132 // corresponding window grid. |
130 void Move(Direction direction, bool animate); | 133 void Move(Direction direction, bool animate); |
131 | 134 |
132 // Removes all observers that were registered during construction and/or | 135 // Removes all observers that were registered during construction and/or |
133 // initialization. | 136 // initialization. |
134 void RemoveAllObservers(); | 137 void RemoveAllObservers(); |
135 | 138 |
136 // Tracks observed windows. | 139 // Tracks observed windows. |
137 std::set<WmWindow*> observed_windows_; | 140 std::set<aura::Window*> observed_windows_; |
138 | 141 |
139 // Weak pointer to the selector delegate which will be called when a | 142 // Weak pointer to the selector delegate which will be called when a |
140 // selection is made. | 143 // selection is made. |
141 WindowSelectorDelegate* delegate_; | 144 WindowSelectorDelegate* delegate_; |
142 | 145 |
143 // A weak pointer to the window which was focused on beginning window | 146 // A weak pointer to the window which was focused on beginning window |
144 // selection. If window selection is canceled the focus should be restored to | 147 // selection. If window selection is canceled the focus should be restored to |
145 // this window. | 148 // this window. |
146 WmWindow* restore_focus_window_; | 149 aura::Window* restore_focus_window_; |
147 | 150 |
148 // True when performing operations that may cause window activations. This is | 151 // True when performing operations that may cause window activations. This is |
149 // used to prevent handling the resulting expected activation. | 152 // used to prevent handling the resulting expected activation. |
150 bool ignore_activations_; | 153 bool ignore_activations_; |
151 | 154 |
152 // List of all the window overview grids, one for each root window. | 155 // List of all the window overview grids, one for each root window. |
153 std::vector<std::unique_ptr<WindowGrid>> grid_list_; | 156 std::vector<std::unique_ptr<WindowGrid>> grid_list_; |
154 | 157 |
155 // Tracks the index of the root window the selection widget is in. | 158 // Tracks the index of the root window the selection widget is in. |
156 size_t selected_grid_index_; | 159 size_t selected_grid_index_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 int text_filter_bottom_; | 196 int text_filter_bottom_; |
194 | 197 |
195 bool is_shut_down_ = false; | 198 bool is_shut_down_ = false; |
196 | 199 |
197 DISALLOW_COPY_AND_ASSIGN(WindowSelector); | 200 DISALLOW_COPY_AND_ASSIGN(WindowSelector); |
198 }; | 201 }; |
199 | 202 |
200 } // namespace ash | 203 } // namespace ash |
201 | 204 |
202 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ | 205 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ |
OLD | NEW |