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

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

Issue 2699033002: Replace WmWindowObserver with aura::WindowObserver. (Closed)
Patch Set: Check for null images in ShelfWindowWatcher. Created 3 years, 10 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_COMMON_WM_WINDOW_CYCLE_LIST_H_ 5 #ifndef ASH_COMMON_WM_WINDOW_CYCLE_LIST_H_
6 #define ASH_COMMON_WM_WINDOW_CYCLE_LIST_H_ 6 #define ASH_COMMON_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_cycle_controller.h" 12 #include "ash/common/wm/window_cycle_controller.h"
13 #include "ash/common/wm_window_observer.h"
14 #include "base/macros.h" 13 #include "base/macros.h"
15 #include "base/scoped_observer.h" 14 #include "base/scoped_observer.h"
16 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
16 #include "ui/aura/window_observer.h"
17 #include "ui/display/display_observer.h" 17 #include "ui/display/display_observer.h"
18 18
19 namespace display { 19 namespace display {
20 class Screen; 20 class Screen;
21 } 21 }
22 22
23 namespace views { 23 namespace views {
24 class Widget; 24 class Widget;
25 } 25 }
26 26
27 namespace ash { 27 namespace ash {
28 28
29 class WindowCycleView; 29 class WindowCycleView;
30 30
31 // Tracks a set of Windows that can be stepped through. This class is used by 31 // Tracks a set of Windows that can be stepped through. This class is used by
32 // the WindowCycleController. 32 // the WindowCycleController.
33 class ASH_EXPORT WindowCycleList : public WmWindowObserver, 33 class ASH_EXPORT WindowCycleList : public aura::WindowObserver,
34 public display::DisplayObserver { 34 public display::DisplayObserver {
35 public: 35 public:
36 using WindowList = std::vector<WmWindow*>; 36 using WindowList = std::vector<WmWindow*>;
37 37
38 explicit WindowCycleList(const WindowList& windows); 38 explicit WindowCycleList(const WindowList& windows);
39 ~WindowCycleList() override; 39 ~WindowCycleList() override;
40 40
41 bool empty() const { return windows_.empty(); } 41 bool empty() const { return windows_.empty(); }
42 42
43 // Cycles to the next or previous window based on |direction|. 43 // Cycles to the next or previous window based on |direction|.
44 void Step(WindowCycleController::Direction direction); 44 void Step(WindowCycleController::Direction direction);
45 45
46 int current_index() const { return current_index_; } 46 int current_index() const { return current_index_; }
47 47
48 void set_user_did_accept(bool user_did_accept) { 48 void set_user_did_accept(bool user_did_accept) {
49 user_did_accept_ = user_did_accept; 49 user_did_accept_ = user_did_accept;
50 } 50 }
51 51
52 private: 52 private:
53 friend class WindowCycleControllerTest; 53 friend class WindowCycleControllerTest;
54 54
55 static void DisableInitialDelayForTesting(); 55 static void DisableInitialDelayForTesting();
56 const views::Widget* widget() const { return cycle_ui_widget_; } 56 const views::Widget* widget() const { return cycle_ui_widget_; }
57 57
58 const WindowList& windows() const { return windows_; } 58 const WindowList& windows() const { return windows_; }
59 59
60 // WmWindowObserver overrides: 60 // aura::WindowObserver overrides:
61 // There is a chance a window is destroyed, for example by JS code. We need to 61 // There is a chance a window is destroyed, for example by JS code. We need to
62 // take care of that even if it is not intended for the user to close a window 62 // take care of that even if it is not intended for the user to close a window
63 // while window cycling. 63 // while window cycling.
64 void OnWindowDestroying(WmWindow* window) override; 64 void OnWindowDestroying(aura::Window* window) override;
65 65
66 // display::DisplayObserver overrides: 66 // display::DisplayObserver overrides:
67 void OnDisplayAdded(const display::Display& new_display) override; 67 void OnDisplayAdded(const display::Display& new_display) override;
68 void OnDisplayRemoved(const display::Display& old_display) override; 68 void OnDisplayRemoved(const display::Display& old_display) override;
69 void OnDisplayMetricsChanged(const display::Display& display, 69 void OnDisplayMetricsChanged(const display::Display& display,
70 uint32_t changed_metrics) override; 70 uint32_t changed_metrics) override;
71 71
72 // Returns true if the window list overlay should be shown. 72 // Returns true if the window list overlay should be shown.
73 bool ShouldShowUi(); 73 bool ShouldShowUi();
74 74
(...skipping 26 matching lines...) Expand all
101 101
102 // A timer to delay showing the UI. Quick Alt+Tab should not flash a UI. 102 // A timer to delay showing the UI. Quick Alt+Tab should not flash a UI.
103 base::OneShotTimer show_ui_timer_; 103 base::OneShotTimer show_ui_timer_;
104 104
105 DISALLOW_COPY_AND_ASSIGN(WindowCycleList); 105 DISALLOW_COPY_AND_ASSIGN(WindowCycleList);
106 }; 106 };
107 107
108 } // namespace ash 108 } // namespace ash
109 109
110 #endif // ASH_COMMON_WM_WINDOW_CYCLE_LIST_H_ 110 #endif // ASH_COMMON_WM_WINDOW_CYCLE_LIST_H_
OLDNEW
« no previous file with comments | « ash/common/wm/system_modal_container_layout_manager.cc ('k') | ash/common/wm/window_cycle_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698