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

Side by Side Diff: ash/mus/window_manager.h

Issue 2302673002: mash: Avoid shelf crashes on display removal. (Closed)
Patch Set: minor cleanup. Created 4 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_MUS_WINDOW_MANAGER_H_ 5 #ifndef ASH_MUS_WINDOW_MANAGER_H_
6 #define ASH_MUS_WINDOW_MANAGER_H_ 6 #define ASH_MUS_WINDOW_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <set> 11 #include <set>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "mojo/public/cpp/bindings/binding.h"
15 #include "services/ui/common/types.h" 16 #include "services/ui/common/types.h"
16 #include "services/ui/public/cpp/window_manager_delegate.h" 17 #include "services/ui/public/cpp/window_manager_delegate.h"
17 #include "services/ui/public/cpp/window_observer.h" 18 #include "services/ui/public/cpp/window_observer.h"
18 #include "services/ui/public/cpp/window_tree_client_delegate.h" 19 #include "services/ui/public/cpp/window_tree_client_delegate.h"
20 #include "services/ui/public/interfaces/display.mojom.h"
19 #include "services/ui/public/interfaces/window_manager.mojom.h" 21 #include "services/ui/public/interfaces/window_manager.mojom.h"
20 22
21 namespace display { 23 namespace display {
22 class Display; 24 class Display;
23 class Screen; 25 class ScreenBase;
24 } 26 }
25 27
26 namespace shell { 28 namespace shell {
27 class Connector; 29 class Connector;
28 } 30 }
29 31
30 namespace views { 32 namespace views {
31 class PointerWatcherEventRouter; 33 class PointerWatcherEventRouter;
32 } 34 }
33 35
34 namespace ash { 36 namespace ash {
35 namespace mus { 37 namespace mus {
36 38
37 class AcceleratorHandler; 39 class AcceleratorHandler;
38 class RootWindowController; 40 class RootWindowController;
39 class ShadowController; 41 class ShadowController;
40 class WindowManagerObserver; 42 class WindowManagerObserver;
41 class WmShellMus; 43 class WmShellMus;
42 class WmLookupMus; 44 class WmLookupMus;
43 class WmTestHelper; 45 class WmTestHelper;
44 46
45 // WindowManager serves as the WindowManagerDelegate and 47 // WindowManager serves as the WindowManagerDelegate and
46 // WindowTreeClientDelegate for mash. WindowManager creates (and owns) 48 // WindowTreeClientDelegate for mash. WindowManager creates (and owns)
47 // a RootWindowController per Display. WindowManager takes ownership of 49 // a RootWindowController per Display. WindowManager takes ownership of
48 // the WindowTreeClient. 50 // the WindowTreeClient.
49 class WindowManager : public ui::WindowManagerDelegate, 51 class WindowManager : public ui::WindowManagerDelegate,
50 public ui::WindowObserver, 52 public ui::WindowObserver,
51 public ui::WindowTreeClientDelegate { 53 public ui::WindowTreeClientDelegate,
54 public ui::mojom::DisplayManagerObserver {
52 public: 55 public:
53 explicit WindowManager(shell::Connector* connector); 56 explicit WindowManager(shell::Connector* connector);
54 ~WindowManager() override; 57 ~WindowManager() override;
55 58
56 void Init(ui::WindowTreeClient* window_tree_client); 59 void Init(ui::WindowTreeClient* window_tree_client);
57 60
58 WmShellMus* shell() { return shell_.get(); } 61 WmShellMus* shell() { return shell_.get(); }
59 62
60 ui::WindowTreeClient* window_tree_client() { return window_tree_client_; } 63 ui::WindowTreeClient* window_tree_client() { return window_tree_client_; }
61 64
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 void OnWmNewDisplay(ui::Window* window, 117 void OnWmNewDisplay(ui::Window* window,
115 const display::Display& display) override; 118 const display::Display& display) override;
116 void OnWmPerformMoveLoop(ui::Window* window, 119 void OnWmPerformMoveLoop(ui::Window* window,
117 ui::mojom::MoveLoopSource source, 120 ui::mojom::MoveLoopSource source,
118 const gfx::Point& cursor_location, 121 const gfx::Point& cursor_location,
119 const base::Callback<void(bool)>& on_done) override; 122 const base::Callback<void(bool)>& on_done) override;
120 void OnWmCancelMoveLoop(ui::Window* window) override; 123 void OnWmCancelMoveLoop(ui::Window* window) override;
121 ui::mojom::EventResult OnAccelerator(uint32_t id, 124 ui::mojom::EventResult OnAccelerator(uint32_t id,
122 const ui::Event& event) override; 125 const ui::Event& event) override;
123 126
127 // ui::mojom::DisplayManager:
128 void OnDisplays(mojo::Array<ui::mojom::WsDisplayPtr> ws_displays) override;
129 void OnDisplaysChanged(
130 mojo::Array<ui::mojom::WsDisplayPtr> ws_displays) override;
131 void OnDisplayRemoved(int64_t id) override;
132
124 shell::Connector* connector_; 133 shell::Connector* connector_;
125 134
126 ui::WindowTreeClient* window_tree_client_ = nullptr; 135 ui::WindowTreeClient* window_tree_client_ = nullptr;
127 136
128 ui::WindowManagerClient* window_manager_client_ = nullptr; 137 ui::WindowManagerClient* window_manager_client_ = nullptr;
129 138
130 std::unique_ptr<views::PointerWatcherEventRouter> 139 std::unique_ptr<views::PointerWatcherEventRouter>
131 pointer_watcher_event_router_; 140 pointer_watcher_event_router_;
132 141
133 std::unique_ptr<ShadowController> shadow_controller_; 142 std::unique_ptr<ShadowController> shadow_controller_;
134 143
135 std::set<std::unique_ptr<RootWindowController>> root_window_controllers_; 144 std::set<std::unique_ptr<RootWindowController>> root_window_controllers_;
136 145
137 base::ObserverList<WindowManagerObserver> observers_; 146 base::ObserverList<WindowManagerObserver> observers_;
138 147
139 std::unique_ptr<display::Screen> screen_; 148 std::unique_ptr<display::ScreenBase> screen_;
149 mojo::Binding<ui::mojom::DisplayManagerObserver>
150 display_manager_observer_binding_;
140 151
141 std::unique_ptr<WmShellMus> shell_; 152 std::unique_ptr<WmShellMus> shell_;
142 153
143 std::unique_ptr<WmLookupMus> lookup_; 154 std::unique_ptr<WmLookupMus> lookup_;
144 155
145 std::map<uint16_t, AcceleratorHandler*> accelerator_handlers_; 156 std::map<uint16_t, AcceleratorHandler*> accelerator_handlers_;
146 uint16_t next_accelerator_namespace_id_ = 0u; 157 uint16_t next_accelerator_namespace_id_ = 0u;
147 158
148 DISALLOW_COPY_AND_ASSIGN(WindowManager); 159 DISALLOW_COPY_AND_ASSIGN(WindowManager);
149 }; 160 };
150 161
151 } // namespace mus 162 } // namespace mus
152 } // namespace ash 163 } // namespace ash
153 164
154 #endif // ASH_MUS_WINDOW_MANAGER_H_ 165 #endif // ASH_MUS_WINDOW_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698