| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_CONTROLLER_H_ | |
| 6 #define ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_CONTROLLER_H_ | |
| 7 | |
| 8 #include <list> | |
| 9 #include <memory> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "ash/ash_export.h" | |
| 13 #include "ash/common/wm/overview/window_selector.h" | |
| 14 #include "ash/common/wm/overview/window_selector_delegate.h" | |
| 15 #include "base/macros.h" | |
| 16 #include "base/time/time.h" | |
| 17 | |
| 18 namespace ash { | |
| 19 class WindowSelector; | |
| 20 class WindowSelectorTest; | |
| 21 | |
| 22 // Manages a window selector which displays an overview of all windows and | |
| 23 // allows selecting a window to activate it. | |
| 24 class ASH_EXPORT WindowSelectorController : public WindowSelectorDelegate { | |
| 25 public: | |
| 26 WindowSelectorController(); | |
| 27 ~WindowSelectorController() override; | |
| 28 | |
| 29 // Returns true if selecting windows in an overview is enabled. This is false | |
| 30 // at certain times, such as when the lock screen is visible. | |
| 31 static bool CanSelect(); | |
| 32 | |
| 33 // Attempts to toggle overview mode and returns true if successful (showing | |
| 34 // overview would be unsuccessful if there are no windows to show). | |
| 35 bool ToggleOverview(); | |
| 36 | |
| 37 // Returns true if window selection mode is active. | |
| 38 bool IsSelecting() const; | |
| 39 | |
| 40 // Moves the current selection by |increment| items. Positive values of | |
| 41 // |increment| move the selection forward, negative values move it backward. | |
| 42 void IncrementSelection(int increment); | |
| 43 | |
| 44 // Accepts current selection if any. Returns true if a selection was made, | |
| 45 // false otherwise. | |
| 46 bool AcceptSelection(); | |
| 47 | |
| 48 // Returns true if overview mode is restoring minimized windows so that they | |
| 49 // are visible during overview mode. | |
| 50 bool IsRestoringMinimizedWindows() const; | |
| 51 | |
| 52 // WindowSelectorDelegate: | |
| 53 void OnSelectionEnded() override; | |
| 54 void AddDelayedAnimationObserver( | |
| 55 std::unique_ptr<DelayedAnimationObserver> animation) override; | |
| 56 void RemoveAndDestroyAnimationObserver( | |
| 57 DelayedAnimationObserver* animation) override; | |
| 58 | |
| 59 private: | |
| 60 friend class WindowSelectorTest; | |
| 61 | |
| 62 // Dispatched when window selection begins. | |
| 63 void OnSelectionStarted(); | |
| 64 | |
| 65 // Collection of DelayedAnimationObserver objects that own widgets that may be | |
| 66 // still animating after overview mode ends. If shell needs to shut down while | |
| 67 // those animations are in progress, the animations are shut down and the | |
| 68 // widgets destroyed. | |
| 69 std::vector<std::unique_ptr<DelayedAnimationObserver>> delayed_animations_; | |
| 70 std::unique_ptr<WindowSelector> window_selector_; | |
| 71 base::Time last_selection_time_; | |
| 72 | |
| 73 DISALLOW_COPY_AND_ASSIGN(WindowSelectorController); | |
| 74 }; | |
| 75 | |
| 76 } // namespace ash | |
| 77 | |
| 78 #endif // ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_CONTROLLER_H_ | |
| OLD | NEW |