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

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

Issue 2157393002: Moves WindowCycleList/Controller to ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback and std::move Created 4 years, 5 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
« no previous file with comments | « ash/wm/window_cycle_event_filter_aura.cc ('k') | ash/wm/window_cycle_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 ASH_WM_WINDOW_CYCLE_LIST_H_
6 #define ASH_WM_WINDOW_CYCLE_LIST_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "ash/ash_export.h"
12 #include "ash/common/wm_window_observer.h"
13 #include "ash/wm/window_cycle_controller.h"
14 #include "base/macros.h"
15
16 namespace views {
17 class Label;
18 class Widget;
19 }
20
21 namespace ash {
22
23 class ScopedShowWindow;
24 class WindowCycleView;
25
26 // Tracks a set of Windows that can be stepped through. This class is used by
27 // the WindowCycleController.
28 class ASH_EXPORT WindowCycleList : public WmWindowObserver {
29 public:
30 using WindowList = std::vector<WmWindow*>;
31
32 explicit WindowCycleList(const WindowList& windows);
33 ~WindowCycleList() override;
34
35 bool empty() const { return windows_.empty(); }
36
37 // Cycles to the next or previous window based on |direction|.
38 void Step(WindowCycleController::Direction direction);
39
40 int current_index() const { return current_index_; }
41
42 private:
43 friend class WindowCycleControllerTest;
44 const WindowList& windows() const { return windows_; }
45
46 // WmWindowObserver overrides:
47 // There is a chance a window is destroyed, for example by JS code. We need to
48 // take care of that even if it is not intended for the user to close a window
49 // while window cycling.
50 void OnWindowDestroying(WmWindow* window) override;
51
52 // Returns true if the window list overlay should be shown.
53 bool ShouldShowUi();
54
55 // List of weak pointers to windows to use while cycling with the keyboard.
56 // List is built when the user initiates the gesture (i.e. hits alt-tab the
57 // first time) and is emptied when the gesture is complete (i.e. releases the
58 // alt key).
59 WindowList windows_;
60
61 // Current position in the |windows_|. Can be used to query selection depth,
62 // i.e., the position of an active window in a global MRU ordering.
63 int current_index_;
64
65 // Wrapper for the window brought to the front.
66 std::unique_ptr<ScopedShowWindow> showing_window_;
67
68 // The top level View for the window cycle UI. May be null if the UI is not
69 // showing.
70 WindowCycleView* cycle_view_;
71
72 // The widget that hosts the window cycle UI.
73 std::unique_ptr<views::Widget> cycle_ui_widget_;
74
75 DISALLOW_COPY_AND_ASSIGN(WindowCycleList);
76 };
77
78 } // namespace ash
79
80 #endif // ASH_WM_WINDOW_CYCLE_LIST_H_
OLDNEW
« no previous file with comments | « ash/wm/window_cycle_event_filter_aura.cc ('k') | ash/wm/window_cycle_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698