Index: ash/shelf/shelf_widget.cc |
diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc |
index 8ec003f9138d8682e9c956234fa060788d8a4591..2a5e317c7a3035a3fe47e904edd07c8da4c1f369 100644 |
--- a/ash/shelf/shelf_widget.cc |
+++ b/ash/shelf/shelf_widget.cc |
@@ -5,6 +5,7 @@ |
#include "ash/shelf/shelf_widget.h" |
#include "ash/ash_switches.h" |
+#include "ash/aura/wm_shelf_aura.h" |
#include "ash/aura/wm_window_aura.h" |
#include "ash/common/shelf/shelf_constants.h" |
#include "ash/common/shelf/wm_shelf_util.h" |
@@ -715,12 +716,15 @@ bool ShelfWidget::GetDimsShelf() const { |
return delegate_view_->GetDimmed(); |
} |
-void ShelfWidget::CreateShelf() { |
+void ShelfWidget::CreateShelf(WmShelfAura* wm_shelf_aura) { |
DCHECK(!shelf_); |
Shell* shell = Shell::GetInstance(); |
ShelfDelegate* delegate = shell->GetShelfDelegate(); |
shelf_.reset(new Shelf(shell->shelf_model(), delegate, this)); |
+ // Must be initialized before the delegate is notified because the delegate |
+ // may try to access the WmShelf. |
+ wm_shelf_aura->SetShelf(shelf_.get()); |
delegate->OnShelfCreated(shelf_.get()); |
SetFocusCycler(shell->focus_cycler()); |