OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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 ASH_WM_WINDOW_CYCLE_LIST_H_ | |
6 #define ASH_WM_WINDOW_CYCLE_LIST_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "ash/ash_export.h" | |
11 #include "base/basictypes.h" | |
12 #include "base/compiler_specific.h" | |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "ui/aura/window_observer.h" | |
15 | |
16 namespace ash { | |
17 class ScopedShowWindow; | |
18 | |
19 // Tracks a set of Windows that can be stepped through. This class is used by | |
20 // the WindowCycleController. | |
21 class ASH_EXPORT WindowCycleList : public aura::WindowObserver { | |
22 public: | |
23 typedef std::vector<aura::Window*> WindowList; | |
24 | |
25 enum Direction { | |
26 FORWARD, | |
27 BACKWARD | |
28 }; | |
29 | |
30 explicit WindowCycleList(const WindowList& windows); | |
31 virtual ~WindowCycleList(); | |
32 | |
33 bool empty() const { return windows_.empty(); } | |
34 | |
35 // Cycles to the next or previous window based on |direction|. | |
36 void Step(Direction direction); | |
37 | |
38 const WindowList& windows() const { return windows_; } | |
39 | |
40 private: | |
41 // Returns the index of |window| in |windows_| or -1 if it isn't there. | |
42 int GetWindowIndex(aura::Window* window); | |
43 | |
44 // aura::WindowObserver overrides: | |
45 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | |
tdanderson
2014/05/01 18:51:39
IIUC, a WindowCycleList only exists while Alt+Tab
Nina
2014/05/01 20:41:16
Some factors like JS close method can trigger a wi
tdanderson
2014/05/01 21:58:33
OK, sounds good. Does a similar possibility exist
Nina
2014/05/02 13:27:33
Done. I don't know if it's possible to observe the
| |
46 | |
47 // List of weak pointers to windows to use while cycling with the keyboard. | |
48 // List is built when the user initiates the gesture (e.g. hits alt-tab the | |
49 // first time) and is emptied when the gesture is complete (e.g. releases the | |
50 // alt key). | |
51 WindowList windows_; | |
52 | |
53 // Current position in the |windows_| list or -1 if we're not cycling. | |
tdanderson
2014/05/01 18:51:39
Similar comment to the one above: if this object e
Nina
2014/05/02 13:27:33
Done.
| |
54 int current_index_; | |
55 | |
56 // Wrapper for the window brought to the front. | |
57 scoped_ptr<ScopedShowWindow> showing_window_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(WindowCycleList); | |
60 }; | |
61 | |
62 } // namespace ash | |
63 | |
64 #endif // ASH_WM_WINDOW_CYCLE_LIST_H_ | |
OLD | NEW |