diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-07 01:29:47 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-07 01:29:47 +0000 |
commit | f81821cd9abdabf27c751dc42b84023098769c66 (patch) | |
tree | 8ab796226cbbf4068e78592972f00a42d20563f2 /chrome/browser/extensions/extension_install_ui.cc | |
parent | 0e80dfe1bc81e7f13f56f6812a25c04b7947a698 (diff) | |
download | chromium_src-f81821cd9abdabf27c751dc42b84023098769c66.zip chromium_src-f81821cd9abdabf27c751dc42b84023098769c66.tar.gz chromium_src-f81821cd9abdabf27c751dc42b84023098769c66.tar.bz2 |
Fix a few bugs with the theme infobar:
* Don't animate the infobar closing and opening when switching
between themes.
* Don't show multiple infobars when intalling themes in rapid
succession.
BUG=18213
Review URL: http://codereview.chromium.org/165029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22711 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_install_ui.cc')
-rw-r--r-- | chrome/browser/extensions/extension_install_ui.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc index 7d879c5..cfc5e54 100644 --- a/chrome/browser/extensions/extension_install_ui.cc +++ b/chrome/browser/extensions/extension_install_ui.cc @@ -112,16 +112,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); } |