Permission message rules: Each rule must have >= 1 required permissions
[chromium-blink-merge.git] / ash / wm / window_cycle_list.h
blob1318c42d2cd99c8ca283cc57dd4dbd97c55eb8ae
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.
5 #ifndef ASH_WM_WINDOW_CYCLE_LIST_H_
6 #define ASH_WM_WINDOW_CYCLE_LIST_H_
8 #include <vector>
10 #include "ash/ash_export.h"
11 #include "ash/wm/window_cycle_controller.h"
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "ui/aura/window_observer.h"
17 namespace ash {
19 class ScopedShowWindow;
21 // Tracks a set of Windows that can be stepped through. This class is used by
22 // the WindowCycleController.
23 class ASH_EXPORT WindowCycleList : public aura::WindowObserver {
24 public:
25 typedef std::vector<aura::Window*> WindowList;
27 explicit WindowCycleList(const WindowList& windows);
28 ~WindowCycleList() override;
30 bool empty() const { return windows_.empty(); }
32 // Cycles to the next or previous window based on |direction|.
33 void Step(WindowCycleController::Direction direction);
35 private:
36 friend class WindowCycleControllerTest;
37 const WindowList& windows() const { return windows_; }
39 // aura::WindowObserver overrides:
40 // There is a chance a window is destroyed, for example by JS code. We need to
41 // take care of that even if it is not intended for the user to close a window
42 // while window cycling.
43 void OnWindowDestroying(aura::Window* window) override;
45 // List of weak pointers to windows to use while cycling with the keyboard.
46 // List is built when the user initiates the gesture (i.e. hits alt-tab the
47 // first time) and is emptied when the gesture is complete (i.e. releases the
48 // alt key).
49 WindowList windows_;
51 // Current position in the |windows_|
52 int current_index_;
54 // Wrapper for the window brought to the front.
55 scoped_ptr<ScopedShowWindow> showing_window_;
57 DISALLOW_COPY_AND_ASSIGN(WindowCycleList);
60 } // namespace ash
62 #endif // ASH_WM_WINDOW_CYCLE_LIST_H_