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 |
| 11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "ui/aura/window_observer.h" | 16 #include "ui/aura/window_observer.h" |
| 17 #include "ui/aura/window_tracker.h" | 17 #include "ui/aura/window_tracker.h" |
| 18 #include "ui/events/event_handler.h" | 18 #include "ui/events/event_handler.h" |
| 19 #include "ui/gfx/display_observer.h" | 19 #include "ui/gfx/display_observer.h" |
| 20 #include "ui/views/controls/textfield/textfield_controller.h" | |
| 20 #include "ui/wm/public/activation_change_observer.h" | 21 #include "ui/wm/public/activation_change_observer.h" |
| 21 | 22 |
| 22 namespace aura { | 23 namespace aura { |
| 23 class RootWindow; | 24 class RootWindow; |
| 24 class Window; | 25 class Window; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace gfx { | 28 namespace gfx { |
| 28 class Rect; | 29 class Rect; |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace ui { | 32 namespace ui { |
| 32 class LocatedEvent; | 33 class LocatedEvent; |
| 33 } | 34 } |
| 34 | 35 |
| 36 namespace views { | |
| 37 class Textfield; | |
| 38 class Widget; | |
| 39 } | |
| 40 | |
| 35 namespace ash { | 41 namespace ash { |
| 36 class WindowSelectorDelegate; | 42 class WindowSelectorDelegate; |
| 37 class WindowSelectorItem; | 43 class WindowSelectorItem; |
| 38 class WindowSelectorTest; | 44 class WindowSelectorTest; |
| 39 class WindowGrid; | 45 class WindowGrid; |
| 40 | 46 |
| 41 // The WindowSelector shows a grid of all of your windows, allowing to select | 47 // The WindowSelector shows a grid of all of your windows, allowing to select |
| 42 // one by clicking or tapping on it. | 48 // one by clicking or tapping on it. |
| 43 class ASH_EXPORT WindowSelector | 49 class ASH_EXPORT WindowSelector |
| 44 : public ui::EventHandler, | 50 : public gfx::DisplayObserver, |
| 45 public gfx::DisplayObserver, | |
| 46 public aura::WindowObserver, | 51 public aura::WindowObserver, |
| 47 public aura::client::ActivationChangeObserver { | 52 public aura::client::ActivationChangeObserver, |
| 53 public views::TextfieldController { | |
| 48 public: | 54 public: |
| 49 enum Direction { | 55 enum Direction { |
| 50 LEFT, | 56 LEFT, |
| 51 UP, | 57 UP, |
| 52 RIGHT, | 58 RIGHT, |
| 53 DOWN | 59 DOWN |
| 54 }; | 60 }; |
| 55 | 61 |
| 56 typedef std::vector<aura::Window*> WindowList; | 62 typedef std::vector<aura::Window*> WindowList; |
| 57 typedef ScopedVector<WindowSelectorItem> WindowSelectorItemList; | 63 typedef ScopedVector<WindowSelectorItem> WindowSelectorItemList; |
| 58 | 64 |
| 59 WindowSelector(const WindowList& windows, | 65 WindowSelector(const WindowList& windows, |
| 60 WindowSelectorDelegate* delegate); | 66 WindowSelectorDelegate* delegate); |
| 61 virtual ~WindowSelector(); | 67 virtual ~WindowSelector(); |
| 62 | 68 |
| 63 // Cancels window selection. | 69 // Cancels window selection. |
| 64 void CancelSelection(); | 70 void CancelSelection(); |
| 65 | 71 |
| 66 // Called when the last window selector item from a grid is deleted. | 72 // Called when the last window selector item from a grid is deleted. |
| 67 void OnGridEmpty(WindowGrid* grid); | 73 void OnGridEmpty(WindowGrid* grid); |
| 68 | 74 |
| 69 // ui::EventHandler: | |
| 70 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | |
| 71 | |
| 72 // gfx::DisplayObserver: | 75 // gfx::DisplayObserver: |
| 73 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE; | 76 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE; |
| 74 virtual void OnDisplayRemoved(const gfx::Display& display) OVERRIDE; | 77 virtual void OnDisplayRemoved(const gfx::Display& display) OVERRIDE; |
| 75 virtual void OnDisplayMetricsChanged(const gfx::Display& display, | 78 virtual void OnDisplayMetricsChanged(const gfx::Display& display, |
| 76 uint32_t metrics) OVERRIDE; | 79 uint32_t metrics) OVERRIDE; |
| 77 | 80 |
| 78 // aura::WindowObserver: | 81 // aura::WindowObserver: |
| 79 virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE; | 82 virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE; |
| 80 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | 83 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; |
| 81 | 84 |
| 82 // aura::client::ActivationChangeObserver: | 85 // aura::client::ActivationChangeObserver: |
| 83 virtual void OnWindowActivated(aura::Window* gained_active, | 86 virtual void OnWindowActivated(aura::Window* gained_active, |
| 84 aura::Window* lost_active) OVERRIDE; | 87 aura::Window* lost_active) OVERRIDE; |
| 85 virtual void OnAttemptToReactivateWindow( | 88 virtual void OnAttemptToReactivateWindow( |
| 86 aura::Window* request_active, | 89 aura::Window* request_active, |
| 87 aura::Window* actual_active) OVERRIDE; | 90 aura::Window* actual_active) OVERRIDE; |
| 88 | 91 |
| 92 // views::TextfieldController: | |
| 93 virtual void ContentsChanged(views::Textfield* sender, | |
| 94 const base::string16& new_contents) OVERRIDE; | |
| 95 | |
|
tdanderson
2014/06/25 15:48:23
Remove blank line
Nina
2014/06/26 15:20:18
Done.
| |
| 96 virtual bool HandleKeyEvent(views::Textfield* sender, | |
| 97 const ui::KeyEvent& key_event); | |
|
tdanderson
2014/06/25 15:48:23
OVERRIDE
Nina
2014/06/26 15:20:18
Done.
| |
| 98 | |
| 89 private: | 99 private: |
| 90 friend class WindowSelectorTest; | 100 friend class WindowSelectorTest; |
| 91 | 101 |
| 92 // Begins positioning windows such that all windows are visible on the screen. | 102 // Begins positioning windows such that all windows are visible on the screen. |
| 93 void StartOverview(); | 103 void StartOverview(); |
| 94 | 104 |
| 95 // Position all of the windows in the overview. | 105 // Position all of the windows in the overview. |
| 96 void PositionWindows(bool animate); | 106 void PositionWindows(bool animate); |
| 97 | 107 |
| 98 // Hide and track all hidden windows not in the overview item list. | 108 // Hide and track all hidden windows not in the overview item list. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 // them refer to this particular overview session and are not cumulative: | 145 // them refer to this particular overview session and are not cumulative: |
| 136 // The time when overview was started. | 146 // The time when overview was started. |
| 137 base::Time overview_start_time_; | 147 base::Time overview_start_time_; |
| 138 | 148 |
| 139 // The number of arrow key presses. | 149 // The number of arrow key presses. |
| 140 size_t num_key_presses_; | 150 size_t num_key_presses_; |
| 141 | 151 |
| 142 // The number of items in the overview. | 152 // The number of items in the overview. |
| 143 size_t num_items_; | 153 size_t num_items_; |
| 144 | 154 |
| 155 // Indicates if we are showing the selection widget. | |
| 156 bool showing_selection_widget_; | |
| 157 | |
| 158 // Window text filter widget. | |
|
tdanderson
2014/06/25 15:48:23
Explain in a bit more detail what this is / what i
Nina
2014/06/26 15:20:17
Done.
| |
| 159 scoped_ptr<views::Widget> text_filter_widget_; | |
| 160 | |
| 145 DISALLOW_COPY_AND_ASSIGN(WindowSelector); | 161 DISALLOW_COPY_AND_ASSIGN(WindowSelector); |
| 146 }; | 162 }; |
| 147 | 163 |
| 148 } // namespace ash | 164 } // namespace ash |
| 149 | 165 |
| 150 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ | 166 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ |
| OLD | NEW |