| 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 <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 14 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 15 #include "ui/aura/client/activation_change_observer.h" | 16 #include "ui/aura/client/activation_change_observer.h" |
| 16 #include "ui/aura/window_observer.h" | 17 #include "ui/aura/window_observer.h" |
| 17 | 18 |
| 18 namespace aura { | 19 namespace aura { |
| 19 class RootWindow; | 20 class RootWindow; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace ui { | 23 namespace ui { |
| 23 class EventHandler; | 24 class EventHandler; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace ash { | 27 namespace ash { |
| 27 | 28 |
| 28 namespace internal { | 29 namespace internal { |
| 29 class WindowSelectorTest; | 30 class WindowSelectorTest; |
| 30 } | 31 } |
| 31 | 32 |
| 32 class WindowOverview; | 33 class WindowOverview; |
| 33 class WindowSelectorDelegate; | 34 class WindowSelectorDelegate; |
| 34 class WindowSelectorWindow; | 35 class WindowSelectorItem; |
| 35 | 36 |
| 36 // The WindowSelector allows selecting a window by alt-tabbing (CYCLE mode) or | 37 // The WindowSelector allows selecting a window by alt-tabbing (CYCLE mode) or |
| 37 // by clicking or tapping on it (OVERVIEW mode). A WindowOverview will be shown | 38 // by clicking or tapping on it (OVERVIEW mode). A WindowOverview will be shown |
| 38 // in OVERVIEW mode or if the user lingers on a window while alt tabbing. | 39 // in OVERVIEW mode or if the user lingers on a window while alt tabbing. |
| 39 class ASH_EXPORT WindowSelector | 40 class ASH_EXPORT WindowSelector |
| 40 : public aura::WindowObserver, | 41 : public aura::WindowObserver, |
| 41 public aura::client::ActivationChangeObserver { | 42 public aura::client::ActivationChangeObserver { |
| 42 public: | 43 public: |
| 43 enum Direction { | 44 enum Direction { |
| 44 FORWARD, | 45 FORWARD, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // Begins positioning windows such that all windows are visible on the screen. | 88 // Begins positioning windows such that all windows are visible on the screen. |
| 88 void StartOverview(); | 89 void StartOverview(); |
| 89 | 90 |
| 90 // Stores the currently focused window and removes focus from it. | 91 // Stores the currently focused window and removes focus from it. |
| 91 void RemoveFocusAndSetRestoreWindow(); | 92 void RemoveFocusAndSetRestoreWindow(); |
| 92 | 93 |
| 93 // Resets the stored window from RemoveFocusAndSetRestoreWindow to NULL. If | 94 // Resets the stored window from RemoveFocusAndSetRestoreWindow to NULL. If |
| 94 // |focus|, restores focus to the stored window. | 95 // |focus|, restores focus to the stored window. |
| 95 void ResetFocusRestoreWindow(bool focus); | 96 void ResetFocusRestoreWindow(bool focus); |
| 96 | 97 |
| 97 // The collection of windows in the overview wrapped by a helper class which | 98 // The collection of items in the overview wrapped by a helper class which |
| 98 // restores their state and helps transform them to other root windows. | 99 // restores their state and helps transform them to other root windows. |
| 99 ScopedVector<WindowSelectorWindow> windows_; | 100 ScopedVector<WindowSelectorItem> windows_; |
| 101 |
| 102 // Tracks observed windows. |
| 103 std::set<aura::Window*> observed_windows_; |
| 100 | 104 |
| 101 // The window selection mode. | 105 // The window selection mode. |
| 102 Mode mode_; | 106 Mode mode_; |
| 103 | 107 |
| 104 // An event handler listening for the release of the alt key during alt-tab | 108 // An event handler listening for the release of the alt key during alt-tab |
| 105 // cycling. | 109 // cycling. |
| 106 scoped_ptr<ui::EventHandler> event_handler_; | 110 scoped_ptr<ui::EventHandler> event_handler_; |
| 107 | 111 |
| 108 base::DelayTimer<WindowSelector> start_overview_timer_; | 112 base::DelayTimer<WindowSelector> start_overview_timer_; |
| 109 scoped_ptr<WindowOverview> window_overview_; | 113 scoped_ptr<WindowOverview> window_overview_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 122 // True when restoring focus to the window. This is used to prevent handling | 126 // True when restoring focus to the window. This is used to prevent handling |
| 123 // the resulting activation. | 127 // the resulting activation. |
| 124 bool restoring_focus_; | 128 bool restoring_focus_; |
| 125 | 129 |
| 126 DISALLOW_COPY_AND_ASSIGN(WindowSelector); | 130 DISALLOW_COPY_AND_ASSIGN(WindowSelector); |
| 127 }; | 131 }; |
| 128 | 132 |
| 129 } // namespace ash | 133 } // namespace ash |
| 130 | 134 |
| 131 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ | 135 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ |
| OLD | NEW |