diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-01 21:52:15 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-01 21:52:15 +0000 |
commit | e5a6310ba2adb86cc39603dc104f49e86e83bb05 (patch) | |
tree | 0c4908eb37f00472bd8851f4186264fa0059620c /chrome | |
parent | 86ef30236f2db1a6a55045fb3d8adb903f0d6026 (diff) | |
download | chromium_src-e5a6310ba2adb86cc39603dc104f49e86e83bb05.zip chromium_src-e5a6310ba2adb86cc39603dc104f49e86e83bb05.tar.gz chromium_src-e5a6310ba2adb86cc39603dc104f49e86e83bb05.tar.bz2 |
The "after infobar" could be sticky in some cases.
Make sure we always remove it before showing a new "before translate" infobar.
BUG=34076
TEST=See bug.
Review URL: http://codereview.chromium.org/552258
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37746 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/translate/translate_manager.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc index 5a7938a..b566033 100644 --- a/chrome/browser/translate/translate_manager.cc +++ b/chrome/browser/translate/translate_manager.cc @@ -96,6 +96,17 @@ void TranslateManager::InitiateTranslation(TabContents* tab, return; } + // If we already have an "after translate" infobar, it sometimes might be + // sticky when running in frames. So we need to proactively remove any + // translate related infobars as they would prevent any new infobar from + // showing. (As TabContents will not add an infobar if there is already one + // showing equal to the one being added.) + for (int i = 0; i < tab->infobar_delegate_count(); ++i) { + InfoBarDelegate* info_bar = tab->GetInfoBarDelegateAt(i); + if (info_bar->AsTranslateInfoBarDelegate()) + tab->RemoveInfoBar(info_bar); + } + // Prompts the user if he/she wants the page translated. tab->AddInfoBar(new BeforeTranslateInfoBarDelegate(tab, prefs, entry->url(), |