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

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

Issue 2042913002: Converts MruWindowTracker to work with common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: not equal Created 4 years, 6 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_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 "ash/common/wm_activation_observer.h"
13 #include "ash/common/wm_window_observer.h"
12 #include "base/macros.h" 14 #include "base/macros.h"
13 #include "ui/aura/window_observer.h"
14 #include "ui/wm/public/activation_change_observer.h"
15
16 namespace aura {
17 class RootWindow;
18 class Window;
19 namespace client {
20 class ActivationClient;
21 }
22 }
23 15
24 namespace ash { 16 namespace ash {
25 17
26 namespace wm { 18 class WmWindow;
27
28 class AshFocusRules;
29
30 } // namespace wm
31
32 19
33 // 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
34 // cycling using Alt+Tab and overview mode. 21 // cycling using Alt+Tab and overview mode.
35 class ASH_EXPORT MruWindowTracker 22 class ASH_EXPORT MruWindowTracker : public WmActivationObserver,
36 : public aura::client::ActivationChangeObserver, 23 public WmWindowObserver {
37 public aura::WindowObserver {
38 public: 24 public:
39 typedef std::vector<aura::Window*> WindowList; 25 using WindowList = std::vector<WmWindow*>;
40 26
41 MruWindowTracker( 27 MruWindowTracker();
42 aura::client::ActivationClient* activation_client,
43 ash::wm::AshFocusRules* focus_rules);
44 ~MruWindowTracker() override; 28 ~MruWindowTracker() override;
45 29
46 // Returns the set of windows which can be cycled through using the tracked 30 // Returns the set of windows which can be cycled through using the tracked
47 // list of most recently used windows. 31 // list of most recently used windows.
48 WindowList BuildMruWindowList() const; 32 WindowList BuildMruWindowList() const;
49 33
50 // This does the same thing as the above, but ignores the system modal dialog 34 // This does the same thing as the above, but ignores the system modal dialog
51 // state and hence the returned list could contain more windows if a system 35 // state and hence the returned list could contain more windows if a system
52 // modal dialog window is present. 36 // modal dialog window is present.
53 WindowList BuildWindowListIgnoreModal() const; 37 WindowList BuildWindowListIgnoreModal() const;
54 38
55 // Starts or stops ignoring window activations. If no longer ignoring 39 // Starts or stops ignoring window activations. If no longer ignoring
56 // activations the currently active window is moved to the front of the 40 // activations the currently active window is moved to the front of the
57 // MRU window list. Used by WindowCycleList to avoid adding all cycled 41 // MRU window list. Used by WindowCycleList to avoid adding all cycled
58 // windows to the front of the MRU window list. 42 // windows to the front of the MRU window list.
59 void SetIgnoreActivations(bool ignore); 43 void SetIgnoreActivations(bool ignore);
60 44
61 private: 45 private:
62 // Updates the mru_windows_ list to insert/move |active_window| at/to the 46 // Updates the mru_windows_ list to insert/move |active_window| at/to the
63 // front. 47 // front.
64 void SetActiveWindow(aura::Window* active_window); 48 void SetActiveWindow(WmWindow* active_window);
65 49
66 // Overridden from aura::client::ActivationChangeObserver: 50 // Overridden from WmActivationObserver:
67 void OnWindowActivated( 51 void OnWindowActivated(WmWindow* gained_active,
68 aura::client::ActivationChangeObserver::ActivationReason reason, 52 WmWindow* lost_active) override;
69 aura::Window* gained_active,
70 aura::Window* lost_active) override;
71 53
72 // Overridden from WindowObserver: 54 // Overridden from WmWindowObserver:
73 void OnWindowDestroyed(aura::Window* window) override; 55 void OnWindowDestroyed(WmWindow* window) override;
74
75 // Uses the focus rules to check whether the window can be activateable,
76 // regardless of the state of the System modal dialog.
77 bool IsWindowConsideredActivateable(aura::Window* window) const;
78 56
79 // List of windows that have been activated in containers that we cycle 57 // List of windows that have been activated in containers that we cycle
80 // through, sorted by most recently used. 58 // through, sorted by most recently used.
81 std::list<aura::Window*> mru_windows_; 59 std::list<WmWindow*> mru_windows_;
82
83 aura::client::ActivationClient* activation_client_; // Not owned.
84
85 wm::AshFocusRules* focus_rules_; // Not owned.
86 60
87 bool ignore_window_activations_; 61 bool ignore_window_activations_;
88 62
89 DISALLOW_COPY_AND_ASSIGN(MruWindowTracker); 63 DISALLOW_COPY_AND_ASSIGN(MruWindowTracker);
90 }; 64 };
91 65
92 } // namespace ash 66 } // namespace ash
93 67
94 #endif // ASH_WM_MRU_WINDOW_TRACKER_H_ 68 #endif // ASH_WM_MRU_WINDOW_TRACKER_H_
OLDNEW
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc ('k') | ash/wm/mru_window_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698