Index: chrome/browser/ui/toolbar/toolbar_actions_bar.cc |
diff --git a/chrome/browser/ui/toolbar/toolbar_actions_bar.cc b/chrome/browser/ui/toolbar/toolbar_actions_bar.cc |
index ca2b14cc049bea6618a9a73a5445407fa821e418..d0c307d0151543f57cf4a74b384164a4190244a8 100644 |
--- a/chrome/browser/ui/toolbar/toolbar_actions_bar.cc |
+++ b/chrome/browser/ui/toolbar/toolbar_actions_bar.cc |
@@ -202,7 +202,10 @@ size_t ToolbarActionsBar::GetIconCount() const { |
void ToolbarActionsBar::CreateActions() { |
DCHECK(toolbar_actions_.empty()); |
- if (!model_) |
+ // We wait for the extension system to be initialized before we add any |
+ // actions, as they rely on the extension system to function; we also have |
+ // to wait for the delegate to be ready to create any added views. |
+ if (!model_ || !model_->extensions_initialized() || !delegate_->IsReady()) |
Peter Kasting
2014/11/14 21:31:58
Hmm. Is there code somewhere that triggers anothe
Devlin
2014/11/14 22:00:37
Yep - the delegate (the view for the browser actio
|
return; |
{ |
@@ -429,9 +432,14 @@ void ToolbarActionsBar::ToolbarHighlightModeChanged(bool is_highlighting) { |
} |
void ToolbarActionsBar::OnToolbarModelInitialized() { |
- ToolbarVisibleCountChanged(); // We may not have resized since the start. |
- delegate_->Redraw(false); // Order didn't change. |
+ // We shouldn't have any actions before the model is initialized. |
+ DCHECK(toolbar_actions_.empty()); |
suppress_animation_ = false; |
+ CreateActions(); |
+ if (!toolbar_actions_.empty()) { |
+ delegate_->Redraw(false); |
+ ToolbarVisibleCountChanged(); |
+ } |
} |
void ToolbarActionsBar::OnToolbarReorderNecessary( |