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

Unified Diff: ash/shelf/shelf_layout_manager.cc

Issue 1916913007: mus/ash: WmRootWindowController can be null in mus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_layout_manager.cc
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index efb1a9349bd1d251c08d31fe361ec2314758efe3..d2bde3ec515e6e1ab5dbed142d43f9dbe232857e 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -229,13 +229,18 @@ ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf)
gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN),
update_shelf_observer_(NULL),
chromevox_panel_height_(0),
- duration_override_in_ms_(0),
- root_window_controller_observer_(
- new RootWindowControllerObserverImpl(this)) {
+ duration_override_in_ms_(0) {
Shell::GetInstance()->AddShellObserver(this);
- wm::WmWindowAura::Get(root_window_)
- ->GetRootWindowController()
- ->AddObserver(root_window_controller_observer_.get());
+
+ wm::WmRootWindowController* controller =
+ wm::WmWindowAura::Get(root_window_)->GetRootWindowController();
+ if (controller) {
+ root_window_controller_observer_.reset(
+ new RootWindowControllerObserverImpl(this));
+ controller->AddObserver(root_window_controller_observer_.get());
+ } else {
+ DCHECK(Shell::GetInstance()->in_mus());
sky 2016/04/28 15:23:12 What about wrapping this whole thing in !Shell::Ge
sadrul 2016/04/28 15:28:51 Done.
+ }
Shell::GetInstance()->lock_state_controller()->AddObserver(this);
aura::client::GetActivationClient(root_window_)->AddObserver(this);
Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(this);
@@ -250,9 +255,11 @@ ShelfLayoutManager::~ShelfLayoutManager() {
Shell::GetInstance()->lock_state_controller()->RemoveObserver(this);
Shell::GetInstance()->
session_state_delegate()->RemoveSessionStateObserver(this);
- wm::WmWindowAura::Get(root_window_)
- ->GetRootWindowController()
- ->RemoveObserver(root_window_controller_observer_.get());
+ if (root_window_controller_observer_) {
+ wm::WmWindowAura::Get(root_window_)
+ ->GetRootWindowController()
+ ->RemoveObserver(root_window_controller_observer_.get());
+ }
}
void ShelfLayoutManager::PrepareForShutdown() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698