OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 ATHENA_WM_MRU_WINDOW_TRACKER_H_ | |
6 #define ATHENA_WM_MRU_WINDOW_TRACKER_H_ | |
7 | |
8 #include <list> | |
9 | |
10 #include "athena/wm/public/window_list_provider.h" | |
11 #include "ui/aura/window_observer.h" | |
12 | |
13 namespace aura { | |
14 class Window; | |
15 } | |
16 | |
17 namespace athena { | |
18 | |
19 // Maintains a most recently used list of windows. This is used for window | |
20 // cycling and overview mode. | |
21 class MruWindowTracker : public WindowListProvider, | |
22 public aura::WindowObserver { | |
23 public: | |
24 explicit MruWindowTracker(aura::Window* container); | |
25 virtual ~MruWindowTracker(); | |
26 | |
27 // Overridden from WindowListProvider | |
28 virtual aura::Window::Windows GetWindowList() const OVERRIDE; | |
29 | |
30 // Updates the mru_windows_ list to move |window| to the front. | |
31 // |window| must be the child of |container_|. | |
32 virtual void MoveToFront(aura::Window* window) OVERRIDE; | |
33 | |
34 private: | |
35 // Overridden from WindowObserver: | |
36 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE; | |
37 virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE; | |
38 | |
39 // List of windows that have been used in the container, sorted by most | |
40 // recently used. | |
41 std::list<aura::Window*> mru_windows_; | |
42 aura::Window* container_; | |
43 | |
44 DISALLOW_COPY_AND_ASSIGN(MruWindowTracker); | |
45 }; | |
46 | |
47 } // namespace athena | |
48 | |
49 #endif // ATHENA_WM_MRU_WINDOW_TRACKER_H_ | |
OLD | NEW |