| Index: chrome/browser/extensions/extension_install_ui.cc
|
| diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc
|
| index 135aac7473850599ec547688a40a462f3db4d0e7..afa2c09a683dbff14e6897ea49d9b6d2983a931a 100644
|
| --- a/chrome/browser/extensions/extension_install_ui.cc
|
| +++ b/chrome/browser/extensions/extension_install_ui.cc
|
| @@ -110,16 +110,22 @@ void ExtensionInstallUI::ShowThemeInfoBar(Extension* extension) {
|
| if (!tab_contents)
|
| return;
|
|
|
| - // First remove any previous theme preview infobar.
|
| + // First find any previous theme preview infobars.
|
| + InfoBarDelegate* old_delegate = NULL;
|
| for (int i = 0; i < tab_contents->infobar_delegate_count(); ++i) {
|
| InfoBarDelegate* delegate = tab_contents->GetInfoBarDelegateAt(i);
|
| if (delegate->AsThemePreviewInfobarDelegate()) {
|
| - tab_contents->RemoveInfoBar(delegate);
|
| + old_delegate = delegate;
|
| break;
|
| }
|
| }
|
|
|
| - // Now add the new one.
|
| - tab_contents->AddInfoBar(new ThemePreviewInfobarDelegate(
|
| - tab_contents, extension->name()));
|
| + // Then either replace that old one or add a new one.
|
| + InfoBarDelegate* new_delegate = new ThemePreviewInfobarDelegate(tab_contents,
|
| + extension->name());
|
| +
|
| + if (old_delegate)
|
| + tab_contents->ReplaceInfoBar(old_delegate, new_delegate);
|
| + else
|
| + tab_contents->AddInfoBar(new_delegate);
|
| }
|
|
|