Index: chrome/browser/ui/toolbar/toolbar_actions_model.cc |
diff --git a/chrome/browser/ui/toolbar/toolbar_actions_model.cc b/chrome/browser/ui/toolbar/toolbar_actions_model.cc |
index d0941201c8687a9ce7ed060f6dc1e7d3321012ad..7c8d51315a9de60782587d2c7fe4e11377c99a94 100644 |
--- a/chrome/browser/ui/toolbar/toolbar_actions_model.cc |
+++ b/chrome/browser/ui/toolbar/toolbar_actions_model.cc |
@@ -227,7 +227,19 @@ void ToolbarActionsModel::OnExtensionUnloaded( |
content::BrowserContext* browser_context, |
const extensions::Extension* extension, |
extensions::UnloadedExtensionInfo::Reason reason) { |
+ size_t index = 0u; |
+ while (toolbar_items().size() > index && |
+ toolbar_items()[index].id != extension->id()) |
+ ++index; |
+ bool was_visible_and_has_overflow = |
+ index < visible_icon_count() && !all_icons_visible(); |
Finnur
2016/04/07 10:14:13
Nit: I wonder if this should be a private util fun
Devlin
2016/04/07 17:16:48
Since it's only used here (that I saw), I think it
|
RemoveExtension(extension); |
+ // If the extension was previously visible and there are overflowed |
+ // extensions, and this extension is being uninstalled, we reduce the visible |
+ // count so that we don't pop out a previously-hidden extension. |
+ if (was_visible_and_has_overflow && |
+ reason == extensions::UnloadedExtensionInfo::REASON_UNINSTALL) |
+ SetVisibleIconCount(visible_icon_count() - 1); |
} |
void ToolbarActionsModel::OnExtensionUninstalled( |