diff options
author | kuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-26 18:43:09 +0000 |
---|---|---|
committer | kuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-26 18:43:09 +0000 |
commit | 8f5d9b53d113c26935205c71a128d055e60cd787 (patch) | |
tree | 075c2b44f651c3df937701fccb45b44cb4b84838 /chrome/browser/translate/translate_manager.cc | |
parent | 7a130f3789ad66ea6a3ed381c0a581ac3dab9bf3 (diff) | |
download | chromium_src-8f5d9b53d113c26935205c71a128d055e60cd787.zip chromium_src-8f5d9b53d113c26935205c71a128d055e60cd787.tar.gz chromium_src-8f5d9b53d113c26935205c71a128d055e60cd787.tar.bz2 |
fix bug where translate infobar gets stuck at "Loading..." between switching tabs.
- problem happened because infobars are destructed when switching between tabs, only the delegates persist. without the infobar to receive the PAGE_TRANSLATED notification to update the translate state, the infobar gets stuck at translating state when user switches back to the associated tab.
- fix was to update the state in the infobar delegate on receiving PAGE_TRANSLATE notification so that when a new translate infobar is created, its visual display will reflect the updated after-translate state.
BUG=36895
TEST=verify per bug report.
Review URL: http://codereview.chromium.org/660187
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40135 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/translate/translate_manager.cc')
-rw-r--r-- | chrome/browser/translate/translate_manager.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc index 8c90bdf..9435786 100644 --- a/chrome/browser/translate/translate_manager.cc +++ b/chrome/browser/translate/translate_manager.cc @@ -75,13 +75,17 @@ void TranslateManager::Observe(NotificationType type, } case NotificationType::PAGE_TRANSLATED: { // Only add translate infobar if it doesn't exist; if it already exists, - // it would have received the same notification and acted accordingly. + // just update the state, the actual infobar would have received the same + // notification and update the visual display accordingly. TabContents* tab = Source<TabContents>(source).ptr(); int i; for (i = 0; i < tab->infobar_delegate_count(); ++i) { - InfoBarDelegate* info_bar = tab->GetInfoBarDelegateAt(i); - if (info_bar->AsTranslateInfoBarDelegate()) + TranslateInfoBarDelegate* info_bar = + tab->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); + if (info_bar) { + info_bar->UpdateState(TranslateInfoBarDelegate::kAfterTranslate); break; + } } if (i == tab->infobar_delegate_count()) { NavigationEntry* entry = tab->controller().GetActiveEntry(); |