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

Unified Diff: chrome/browser/extensions/extension_install_ui.cc

Issue 165029: Fix a few bugs with the theme infobar: (Closed)
Patch Set: Created 11 years, 4 months 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/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);
}
« no previous file with comments | « no previous file | chrome/browser/tab_contents/tab_contents.h » ('j') | chrome/browser/tab_contents/tab_contents.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698