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

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

Issue 2129773002: [CrOS] Initial rough cut of alt-tab window cycling UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: derat comments 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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_WINDOW_CYCLE_LIST_H_ 5 #ifndef ASH_WM_WINDOW_CYCLE_LIST_H_
6 #define ASH_WM_WINDOW_CYCLE_LIST_H_ 6 #define ASH_WM_WINDOW_CYCLE_LIST_H_
7 7
8 #include <memory> 8 #include <memory>
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_window_observer.h" 12 #include "ash/common/wm_window_observer.h"
13 #include "ash/wm/window_cycle_controller.h" 13 #include "ash/wm/window_cycle_controller.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 15
16 namespace views {
17 class Label;
18 class Widget;
19 }
20
16 namespace ash { 21 namespace ash {
17 22
18 class ScopedShowWindow; 23 class ScopedShowWindow;
24 class WindowCycleView;
19 25
20 // Tracks a set of Windows that can be stepped through. This class is used by 26 // Tracks a set of Windows that can be stepped through. This class is used by
21 // the WindowCycleController. 27 // the WindowCycleController.
22 class ASH_EXPORT WindowCycleList : public WmWindowObserver { 28 class ASH_EXPORT WindowCycleList : public WmWindowObserver {
23 public: 29 public:
24 using WindowList = std::vector<WmWindow*>; 30 using WindowList = std::vector<WmWindow*>;
25 31
26 explicit WindowCycleList(const WindowList& windows); 32 explicit WindowCycleList(const WindowList& windows);
27 ~WindowCycleList() override; 33 ~WindowCycleList() override;
28 34
29 bool empty() const { return windows_.empty(); } 35 bool empty() const { return windows_.empty(); }
30 36
31 // Cycles to the next or previous window based on |direction|. 37 // Cycles to the next or previous window based on |direction|.
32 void Step(WindowCycleController::Direction direction); 38 void Step(WindowCycleController::Direction direction);
33 39
34 int current_index() const { return current_index_; } 40 int current_index() const { return current_index_; }
35 41
36 private: 42 private:
37 friend class WindowCycleControllerTest; 43 friend class WindowCycleControllerTest;
38 const WindowList& windows() const { return windows_; } 44 const WindowList& windows() const { return windows_; }
39 45
40 // aura::WindowObserver overrides: 46 // aura::WindowObserver overrides:
41 // There is a chance a window is destroyed, for example by JS code. We need to 47 // There is a chance a window is destroyed, for example by JS code. We need to
42 // take care of that even if it is not intended for the user to close a window 48 // take care of that even if it is not intended for the user to close a window
43 // while window cycling. 49 // while window cycling.
44 void OnWindowDestroying(WmWindow* window) override; 50 void OnWindowDestroying(WmWindow* window) override;
45 51
52 // Returns true if the window list overlay should be shown.
53 bool ShouldShowUi();
varkha 2016/07/07 17:40:29 Maybe keep this in ash::MaterialDesignController (
54
46 // List of weak pointers to windows to use while cycling with the keyboard. 55 // List of weak pointers to windows to use while cycling with the keyboard.
47 // List is built when the user initiates the gesture (i.e. hits alt-tab the 56 // List is built when the user initiates the gesture (i.e. hits alt-tab the
48 // first time) and is emptied when the gesture is complete (i.e. releases the 57 // first time) and is emptied when the gesture is complete (i.e. releases the
49 // alt key). 58 // alt key).
50 WindowList windows_; 59 WindowList windows_;
51 60
52 // Current position in the |windows_|. Can be used to query selection depth, 61 // Current position in the |windows_|. Can be used to query selection depth,
53 // i.e., the position of an active window in a global MRU ordering. 62 // i.e., the position of an active window in a global MRU ordering.
54 int current_index_; 63 int current_index_;
55 64
56 // Wrapper for the window brought to the front. 65 // Wrapper for the window brought to the front.
57 std::unique_ptr<ScopedShowWindow> showing_window_; 66 std::unique_ptr<ScopedShowWindow> showing_window_;
58 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 views::Widget* cycle_ui_widget_;
74
59 DISALLOW_COPY_AND_ASSIGN(WindowCycleList); 75 DISALLOW_COPY_AND_ASSIGN(WindowCycleList);
60 }; 76 };
61 77
62 } // namespace ash 78 } // namespace ash
63 79
64 #endif // ASH_WM_WINDOW_CYCLE_LIST_H_ 80 #endif // ASH_WM_WINDOW_CYCLE_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698