| 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_MRU_WINDOW_TRACKER_H_ | 5 #ifndef ASH_WM_MRU_WINDOW_TRACKER_H_ |
| 6 #define ASH_WM_MRU_WINDOW_TRACKER_H_ | 6 #define ASH_WM_MRU_WINDOW_TRACKER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // Maintains a most recently used list of windows. This is used for window | 27 // Maintains a most recently used list of windows. This is used for window |
| 28 // cycling using Alt+Tab and overview mode. | 28 // cycling using Alt+Tab and overview mode. |
| 29 class ASH_EXPORT MruWindowTracker | 29 class ASH_EXPORT MruWindowTracker |
| 30 : public aura::client::ActivationChangeObserver, | 30 : public aura::client::ActivationChangeObserver, |
| 31 public aura::WindowObserver { | 31 public aura::WindowObserver { |
| 32 public: | 32 public: |
| 33 typedef std::vector<aura::Window*> WindowList; | 33 typedef std::vector<aura::Window*> WindowList; |
| 34 | 34 |
| 35 explicit MruWindowTracker( | 35 explicit MruWindowTracker( |
| 36 aura::client::ActivationClient* activation_client); | 36 aura::client::ActivationClient* activation_client); |
| 37 virtual ~MruWindowTracker(); | 37 ~MruWindowTracker() override; |
| 38 | 38 |
| 39 // Returns the set of windows which can be cycled through. This method creates | 39 // Returns the set of windows which can be cycled through. This method creates |
| 40 // the vector based on the current set of windows across all valid root | 40 // the vector based on the current set of windows across all valid root |
| 41 // windows. As a result it is not necessarily the same as the set of | 41 // windows. As a result it is not necessarily the same as the set of |
| 42 // windows being iterated over. | 42 // windows being iterated over. |
| 43 // If |top_most_at_end| the window list will return in ascending (lowest | 43 // If |top_most_at_end| the window list will return in ascending (lowest |
| 44 // window in stacking order first) order instead of the default descending | 44 // window in stacking order first) order instead of the default descending |
| 45 // (top most window first) order. | 45 // (top most window first) order. |
| 46 static WindowList BuildWindowList(bool top_most_at_end); | 46 static WindowList BuildWindowList(bool top_most_at_end); |
| 47 | 47 |
| 48 // Returns the set of windows which can be cycled through using the tracked | 48 // Returns the set of windows which can be cycled through using the tracked |
| 49 // list of most recently used windows. | 49 // list of most recently used windows. |
| 50 WindowList BuildMruWindowList(); | 50 WindowList BuildMruWindowList(); |
| 51 | 51 |
| 52 // Starts or stops ignoring window activations. If no longer ignoring | 52 // Starts or stops ignoring window activations. If no longer ignoring |
| 53 // activations the currently active window is moved to the front of the | 53 // activations the currently active window is moved to the front of the |
| 54 // MRU window list. Used by WindowCycleList to avoid adding all cycled | 54 // MRU window list. Used by WindowCycleList to avoid adding all cycled |
| 55 // windows to the front of the MRU window list. | 55 // windows to the front of the MRU window list. |
| 56 void SetIgnoreActivations(bool ignore); | 56 void SetIgnoreActivations(bool ignore); |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 // Updates the mru_windows_ list to insert/move |active_window| at/to the | 59 // Updates the mru_windows_ list to insert/move |active_window| at/to the |
| 60 // front. | 60 // front. |
| 61 void SetActiveWindow(aura::Window* active_window); | 61 void SetActiveWindow(aura::Window* active_window); |
| 62 | 62 |
| 63 // Overridden from aura::client::ActivationChangeObserver: | 63 // Overridden from aura::client::ActivationChangeObserver: |
| 64 virtual void OnWindowActivated(aura::Window* gained_active, | 64 void OnWindowActivated(aura::Window* gained_active, |
| 65 aura::Window* lost_active) override; | 65 aura::Window* lost_active) override; |
| 66 | 66 |
| 67 // Overridden from WindowObserver: | 67 // Overridden from WindowObserver: |
| 68 virtual void OnWindowDestroyed(aura::Window* window) override; | 68 void OnWindowDestroyed(aura::Window* window) override; |
| 69 | 69 |
| 70 // List of windows that have been activated in containers that we cycle | 70 // List of windows that have been activated in containers that we cycle |
| 71 // through, sorted by most recently used. | 71 // through, sorted by most recently used. |
| 72 std::list<aura::Window*> mru_windows_; | 72 std::list<aura::Window*> mru_windows_; |
| 73 | 73 |
| 74 aura::client::ActivationClient* activation_client_; | 74 aura::client::ActivationClient* activation_client_; |
| 75 | 75 |
| 76 bool ignore_window_activations_; | 76 bool ignore_window_activations_; |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(MruWindowTracker); | 78 DISALLOW_COPY_AND_ASSIGN(MruWindowTracker); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 } // namespace ash | 81 } // namespace ash |
| 82 | 82 |
| 83 #endif // ASH_WM_MRU_WINDOW_TRACKER_H_ | 83 #endif // ASH_WM_MRU_WINDOW_TRACKER_H_ |
| OLD | NEW |