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