OLD | NEW |
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 #include "ash/mus/window_manager.h" | 5 #include "ash/mus/window_manager.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 void WindowManager::OnEmbed(ui::Window* root) { | 207 void WindowManager::OnEmbed(ui::Window* root) { |
208 // WindowManager should never see this, instead OnWmNewDisplay() is called. | 208 // WindowManager should never see this, instead OnWmNewDisplay() is called. |
209 NOTREACHED(); | 209 NOTREACHED(); |
210 } | 210 } |
211 | 211 |
212 void WindowManager::OnDidDestroyClient(ui::WindowTreeClient* client) { | 212 void WindowManager::OnDidDestroyClient(ui::WindowTreeClient* client) { |
213 // Destroying the roots should result in removal from | 213 // Destroying the roots should result in removal from |
214 // |root_window_controllers_|. | 214 // |root_window_controllers_|. |
215 DCHECK(root_window_controllers_.empty()); | 215 DCHECK(root_window_controllers_.empty()); |
216 | 216 |
| 217 // Observers can rely on WmShell from the callback. So notify the observers |
| 218 // before destroying it. |
| 219 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, |
| 220 OnWindowTreeClientDestroyed()); |
| 221 |
217 lookup_.reset(); | 222 lookup_.reset(); |
218 shell_->Shutdown(); | 223 shell_->Shutdown(); |
219 shell_.reset(); | 224 shell_.reset(); |
220 shadow_controller_.reset(); | 225 shadow_controller_.reset(); |
221 | 226 |
222 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, | |
223 OnWindowTreeClientDestroyed()); | |
224 | |
225 pointer_watcher_event_router_.reset(); | 227 pointer_watcher_event_router_.reset(); |
226 | 228 |
227 window_tree_client_ = nullptr; | 229 window_tree_client_ = nullptr; |
228 window_manager_client_ = nullptr; | 230 window_manager_client_ = nullptr; |
229 } | 231 } |
230 | 232 |
231 void WindowManager::OnPointerEventObserved(const ui::PointerEvent& event, | 233 void WindowManager::OnPointerEventObserved(const ui::PointerEvent& event, |
232 ui::Window* target) { | 234 ui::Window* target) { |
233 pointer_watcher_event_router_->OnPointerEventObserved(event, target); | 235 pointer_watcher_event_router_->OnPointerEventObserved(event, target); |
234 } | 236 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 const ui::Event& event) { | 308 const ui::Event& event) { |
307 auto iter = accelerator_handlers_.find(GetAcceleratorNamespaceId(id)); | 309 auto iter = accelerator_handlers_.find(GetAcceleratorNamespaceId(id)); |
308 if (iter == accelerator_handlers_.end()) | 310 if (iter == accelerator_handlers_.end()) |
309 return ui::mojom::EventResult::HANDLED; | 311 return ui::mojom::EventResult::HANDLED; |
310 | 312 |
311 return iter->second->OnAccelerator(id, event); | 313 return iter->second->OnAccelerator(id, event); |
312 } | 314 } |
313 | 315 |
314 } // namespace mus | 316 } // namespace mus |
315 } // namespace ash | 317 } // namespace ash |
OLD | NEW |