Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(996)

Side by Side Diff: ash/common/wm/mru_window_tracker.h

Issue 2736753005: Converts WmActivationObserver to aura::client::ActivationChangeObserver (Closed)
Patch Set: cleanup Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_COMMON_WM_MRU_WINDOW_TRACKER_H_ 5 #ifndef ASH_COMMON_WM_MRU_WINDOW_TRACKER_H_
6 #define ASH_COMMON_WM_MRU_WINDOW_TRACKER_H_ 6 #define ASH_COMMON_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 "ash/common/wm_activation_observer.h"
13 #include "base/macros.h" 12 #include "base/macros.h"
14 #include "ui/aura/window_observer.h" 13 #include "ui/aura/window_observer.h"
14 #include "ui/wm/public/activation_change_observer.h"
15 15
16 namespace ash { 16 namespace ash {
17 17
18 class WmWindow; 18 class WmWindow;
19 19
20 // Maintains a most recently used list of windows. This is used for window 20 // Maintains a most recently used list of windows. This is used for window
21 // cycling using Alt+Tab and overview mode. 21 // cycling using Alt+Tab and overview mode.
22 class ASH_EXPORT MruWindowTracker : public WmActivationObserver, 22 class ASH_EXPORT MruWindowTracker
23 public aura::WindowObserver { 23 : public aura::client::ActivationChangeObserver,
24 public aura::WindowObserver {
24 public: 25 public:
25 using WindowList = std::vector<WmWindow*>; 26 using WindowList = std::vector<WmWindow*>;
26 27
27 MruWindowTracker(); 28 MruWindowTracker();
28 ~MruWindowTracker() override; 29 ~MruWindowTracker() override;
29 30
30 // Returns the set of windows which can be cycled through using the tracked 31 // Returns the set of windows which can be cycled through using the tracked
31 // list of most recently used windows. 32 // list of most recently used windows.
32 WindowList BuildMruWindowList() const; 33 WindowList BuildMruWindowList() const;
33 34
34 // This does the same thing as the above, but ignores the system modal dialog 35 // This does the same thing as the above, but ignores the system modal dialog
35 // state and hence the returned list could contain more windows if a system 36 // state and hence the returned list could contain more windows if a system
36 // modal dialog window is present. 37 // modal dialog window is present.
37 WindowList BuildWindowListIgnoreModal() const; 38 WindowList BuildWindowListIgnoreModal() const;
38 39
39 // Starts or stops ignoring window activations. If no longer ignoring 40 // Starts or stops ignoring window activations. If no longer ignoring
40 // activations the currently active window is moved to the front of the 41 // activations the currently active window is moved to the front of the
41 // MRU window list. Used by WindowCycleList to avoid adding all cycled 42 // MRU window list. Used by WindowCycleList to avoid adding all cycled
42 // windows to the front of the MRU window list. 43 // windows to the front of the MRU window list.
43 void SetIgnoreActivations(bool ignore); 44 void SetIgnoreActivations(bool ignore);
44 45
45 private: 46 private:
46 // Updates the mru_windows_ list to insert/move |active_window| at/to the 47 // Updates the mru_windows_ list to insert/move |active_window| at/to the
47 // front. 48 // front.
48 void SetActiveWindow(WmWindow* active_window); 49 void SetActiveWindow(WmWindow* active_window);
49 50
50 // Overridden from WmActivationObserver: 51 // Overridden from aura::client::ActivationChangeObserver:
51 void OnWindowActivated(WmWindow* gained_active, 52 void OnWindowActivated(ActivationReason reason,
52 WmWindow* lost_active) override; 53 aura::Window* gained_active,
54 aura::Window* lost_active) override;
53 55
54 // Overridden from aura::WindowObserver: 56 // Overridden from aura::WindowObserver:
55 void OnWindowDestroyed(aura::Window* window) override; 57 void OnWindowDestroyed(aura::Window* window) override;
56 58
57 // List of windows that have been activated in containers that we cycle 59 // List of windows that have been activated in containers that we cycle
58 // through, sorted by most recently used. 60 // through, sorted by most recently used.
59 std::list<WmWindow*> mru_windows_; 61 std::list<WmWindow*> mru_windows_;
60 62
61 bool ignore_window_activations_; 63 bool ignore_window_activations_;
62 64
63 DISALLOW_COPY_AND_ASSIGN(MruWindowTracker); 65 DISALLOW_COPY_AND_ASSIGN(MruWindowTracker);
64 }; 66 };
65 67
66 } // namespace ash 68 } // namespace ash
67 69
68 #endif // ASH_COMMON_WM_MRU_WINDOW_TRACKER_H_ 70 #endif // ASH_COMMON_WM_MRU_WINDOW_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698