| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_GRID_H_ | 5 #ifndef ASH_WM_OVERVIEW_WINDOW_GRID_H_ |
| 6 #define ASH_WM_OVERVIEW_WINDOW_GRID_H_ | 6 #define ASH_WM_OVERVIEW_WINDOW_GRID_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/wm/overview/window_selector.h" | 10 #include "ash/wm/overview/window_selector.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 const std::vector<aura::Window*>& window_list, | 50 const std::vector<aura::Window*>& window_list, |
| 51 WindowSelector* window_selector); | 51 WindowSelector* window_selector); |
| 52 virtual ~WindowGrid(); | 52 virtual ~WindowGrid(); |
| 53 | 53 |
| 54 // Positions all the windows in the grid. | 54 // Positions all the windows in the grid. |
| 55 void PositionWindows(bool animate); | 55 void PositionWindows(bool animate); |
| 56 | 56 |
| 57 // Updates |selected_index_| according to the specified |direction| and calls | 57 // Updates |selected_index_| according to the specified |direction| and calls |
| 58 // MoveSelectionWidget(). Returns |true| if the new selection index is out of | 58 // MoveSelectionWidget(). Returns |true| if the new selection index is out of |
| 59 // this window grid bounds. | 59 // this window grid bounds. |
| 60 bool Move(WindowSelector::Direction direction); | 60 bool Move(WindowSelector::Direction direction, bool animate); |
| 61 | 61 |
| 62 // Returns the target selected window, or NULL if there is none selected. | 62 // Returns the target selected window, or NULL if there is none selected. |
| 63 WindowSelectorItem* SelectedWindow() const; | 63 WindowSelectorItem* SelectedWindow() const; |
| 64 | 64 |
| 65 // Returns true if a window is contained in any of the WindowSelectorItems | 65 // Returns true if a window is contained in any of the WindowSelectorItems |
| 66 // this grid owns. | 66 // this grid owns. |
| 67 bool Contains(const aura::Window* window) const; | 67 bool Contains(const aura::Window* window) const; |
| 68 | 68 |
| 69 // Dims the items whose titles do not contain |pattern| and prevents their |
| 70 // selection. The pattern has its accents removed and is converted to |
| 71 // lowercase in a l10n sensitive context. |
| 72 // If |pattern| is empty, no item is dimmed. |
| 73 void FilterItems(const base::string16& pattern); |
| 74 |
| 69 // Returns true if the grid has no more windows. | 75 // Returns true if the grid has no more windows. |
| 70 bool empty() const { return window_list_.empty(); } | 76 bool empty() const { return window_list_.empty(); } |
| 71 | 77 |
| 72 // Returns how many window selector items are in the grid. | 78 // Returns how many window selector items are in the grid. |
| 73 size_t size() const { return window_list_.size(); } | 79 size_t size() const { return window_list_.size(); } |
| 74 | 80 |
| 75 // Returns true if the selection widget is active. | 81 // Returns true if the selection widget is active. |
| 76 bool is_selecting() const { return selection_widget_ != NULL; } | 82 bool is_selecting() const { return selection_widget_ != NULL; } |
| 77 | 83 |
| 78 // Returns the root window in which the grid displays the windows. | 84 // Returns the root window in which the grid displays the windows. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 91 | 97 |
| 92 private: | 98 private: |
| 93 friend class WindowSelectorTest; | 99 friend class WindowSelectorTest; |
| 94 | 100 |
| 95 // Internal function to initialize the selection widget. | 101 // Internal function to initialize the selection widget. |
| 96 void InitSelectionWidget(WindowSelector::Direction direction); | 102 void InitSelectionWidget(WindowSelector::Direction direction); |
| 97 | 103 |
| 98 // Moves the selection widget to the specified |direction|. | 104 // Moves the selection widget to the specified |direction|. |
| 99 void MoveSelectionWidget(WindowSelector::Direction direction, | 105 void MoveSelectionWidget(WindowSelector::Direction direction, |
| 100 bool recreate_selection_widget, | 106 bool recreate_selection_widget, |
| 101 bool out_of_bounds); | 107 bool out_of_bounds, |
| 108 bool animate); |
| 102 | 109 |
| 103 // Moves the selection widget to the targeted window. | 110 // Moves the selection widget to the targeted window. |
| 104 void MoveSelectionWidgetToTarget(bool animate); | 111 void MoveSelectionWidgetToTarget(bool animate); |
| 105 | 112 |
| 106 // Returns the target bounds of the currently selected item. | 113 // Returns the target bounds of the currently selected item. |
| 107 const gfx::Rect GetSelectionBounds() const; | 114 const gfx::Rect GetSelectionBounds() const; |
| 108 | 115 |
| 109 // Root window the grid is in. | 116 // Root window the grid is in. |
| 110 aura::Window* root_window_; | 117 aura::Window* root_window_; |
| 111 | 118 |
| 112 // Pointer to the window selector that spawned this grid. | 119 // Pointer to the window selector that spawned this grid. |
| 113 WindowSelector* window_selector_; | 120 WindowSelector* window_selector_; |
| 114 | 121 |
| 115 // Vector containing all the windows in this grid. | 122 // Vector containing all the windows in this grid. |
| 116 ScopedVector<WindowSelectorItem> window_list_; | 123 ScopedVector<WindowSelectorItem> window_list_; |
| 117 | 124 |
| 118 // Vector containing the observed windows. | 125 // Vector containing the observed windows. |
| 119 std::set<aura::Window*> observed_windows_; | 126 std::set<aura::Window*> observed_windows_; |
| 120 | 127 |
| 121 // Widget that indicates to the user which is the selected window. | 128 // Widget that indicates to the user which is the selected window. |
| 122 scoped_ptr<views::Widget> selection_widget_; | 129 scoped_ptr<views::Widget> selection_widget_; |
| 123 | 130 |
| 124 // Current selected window position. | 131 // Current selected window position. |
| 125 size_t selected_index_; | 132 size_t selected_index_; |
| 126 | 133 |
| 134 // Indicates if there is at least one undimmed item in the overview. |
| 135 bool has_active_item_; |
| 136 |
| 127 // Number of columns in the grid. | 137 // Number of columns in the grid. |
| 128 size_t num_columns_; | 138 size_t num_columns_; |
| 129 | 139 |
| 130 DISALLOW_COPY_AND_ASSIGN(WindowGrid); | 140 DISALLOW_COPY_AND_ASSIGN(WindowGrid); |
| 131 }; | 141 }; |
| 132 | 142 |
| 133 } // namespace ash | 143 } // namespace ash |
| 134 | 144 |
| 135 #endif // ASH_WM_OVERVIEW_WINDOW_GRID_H_ | 145 #endif // ASH_WM_OVERVIEW_WINDOW_GRID_H_ |
| OLD | NEW |