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

Unified Diff: chrome/browser/ui/toolbar/toolbar_actions_bar.cc

Issue 726813002: [Extensions Toolbar] Make the ExtensionToolbarModel icon count more stable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
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(

Powered by Google App Engine
This is Rietveld 408576698