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 |
11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.h" |
14 #include "ui/wm/public/activation_change_observer.h" | 14 #include "ui/wm/public/activation_change_observer.h" |
15 | 15 |
16 namespace aura { | |
17 class Window; | |
msw
2017/05/23 22:50:24
optional nit: not needed (per window_observer.h &
varkha
2017/05/24 15:29:15
Done.
| |
18 } | |
19 | |
16 namespace ash { | 20 namespace ash { |
17 | 21 |
18 class WmWindow; | |
19 | |
20 // Maintains a most recently used list of windows. This is used for window | 22 // Maintains a most recently used list of windows. This is used for window |
21 // cycling using Alt+Tab and overview mode. | 23 // cycling using Alt+Tab and overview mode. |
22 class ASH_EXPORT MruWindowTracker | 24 class ASH_EXPORT MruWindowTracker |
23 : public aura::client::ActivationChangeObserver, | 25 : public aura::client::ActivationChangeObserver, |
24 public aura::WindowObserver { | 26 public aura::WindowObserver { |
25 public: | 27 public: |
26 using WindowList = std::vector<WmWindow*>; | 28 using WindowList = std::vector<aura::Window*>; |
msw
2017/05/23 22:50:24
optional nit: use aura::Window::Windows
varkha
2017/05/24 15:29:15
aura::Window is only forward defined at this point
| |
27 | 29 |
28 MruWindowTracker(); | 30 MruWindowTracker(); |
29 ~MruWindowTracker() override; | 31 ~MruWindowTracker() override; |
30 | 32 |
31 // Returns the set of windows which can be cycled through using the tracked | 33 // Returns the set of windows which can be cycled through using the tracked |
32 // list of most recently used windows. | 34 // list of most recently used windows. |
33 WindowList BuildMruWindowList() const; | 35 WindowList BuildMruWindowList() const; |
34 | 36 |
35 // This does the same thing as the above, but ignores the system modal dialog | 37 // This does the same thing as the above, but ignores the system modal dialog |
36 // state and hence the returned list could contain more windows if a system | 38 // state and hence the returned list could contain more windows if a system |
37 // modal dialog window is present. | 39 // modal dialog window is present. |
38 WindowList BuildWindowListIgnoreModal() const; | 40 WindowList BuildWindowListIgnoreModal() const; |
39 | 41 |
40 // Starts or stops ignoring window activations. If no longer ignoring | 42 // Starts or stops ignoring window activations. If no longer ignoring |
41 // activations the currently active window is moved to the front of the | 43 // activations the currently active window is moved to the front of the |
42 // MRU window list. Used by WindowCycleList to avoid adding all cycled | 44 // MRU window list. Used by WindowCycleList to avoid adding all cycled |
43 // windows to the front of the MRU window list. | 45 // windows to the front of the MRU window list. |
44 void SetIgnoreActivations(bool ignore); | 46 void SetIgnoreActivations(bool ignore); |
45 | 47 |
46 private: | 48 private: |
47 // Updates the mru_windows_ list to insert/move |active_window| at/to the | 49 // Updates the mru_windows_ list to insert/move |active_window| at/to the |
48 // front. | 50 // front. |
49 void SetActiveWindow(WmWindow* active_window); | 51 void SetActiveWindow(aura::Window* active_window); |
50 | 52 |
51 // Overridden from aura::client::ActivationChangeObserver: | 53 // Overridden from aura::client::ActivationChangeObserver: |
52 void OnWindowActivated(ActivationReason reason, | 54 void OnWindowActivated(ActivationReason reason, |
53 aura::Window* gained_active, | 55 aura::Window* gained_active, |
54 aura::Window* lost_active) override; | 56 aura::Window* lost_active) override; |
55 | 57 |
56 // Overridden from aura::WindowObserver: | 58 // Overridden from aura::WindowObserver: |
57 void OnWindowDestroyed(aura::Window* window) override; | 59 void OnWindowDestroyed(aura::Window* window) override; |
58 | 60 |
59 // List of windows that have been activated in containers that we cycle | 61 // List of windows that have been activated in containers that we cycle |
60 // through, sorted by most recently used. | 62 // through, sorted by most recently used. |
61 std::list<WmWindow*> mru_windows_; | 63 std::list<aura::Window*> mru_windows_; |
62 | 64 |
63 bool ignore_window_activations_; | 65 bool ignore_window_activations_; |
64 | 66 |
65 DISALLOW_COPY_AND_ASSIGN(MruWindowTracker); | 67 DISALLOW_COPY_AND_ASSIGN(MruWindowTracker); |
66 }; | 68 }; |
67 | 69 |
68 } // namespace ash | 70 } // namespace ash |
69 | 71 |
70 #endif // ASH_WM_MRU_WINDOW_TRACKER_H_ | 72 #endif // ASH_WM_MRU_WINDOW_TRACKER_H_ |
OLD | NEW |