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

Unified Diff: chrome/browser/translate/translate_manager.cc

Issue 7810002: Move infobar handling to a tab helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update Created 9 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/translate/translate_manager.cc
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc
index 94a499c83e6616207262abbceb6c91b079c1b642..96b6fcc8882ca14bc7b94b0874de847fd1516bf2 100644
--- a/chrome/browser/translate/translate_manager.cc
+++ b/chrome/browser/translate/translate_manager.cc
@@ -14,6 +14,7 @@
#include "base/values.h"
#include "chrome/browser/autofill/autofill_manager.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/language_state.h"
@@ -512,9 +513,10 @@ void TranslateManager::InitiateTranslation(TabContents* tab,
}
// Prompts the user if he/she wants the page translated.
- wrapper->AddInfoBar(TranslateInfoBarDelegate::CreateDelegate(
- TranslateInfoBarDelegate::BEFORE_TRANSLATE, tab, language_code,
- target_lang));
+ wrapper->infobar_tab_helper()->AddInfoBar(
+ TranslateInfoBarDelegate::CreateDelegate(
+ TranslateInfoBarDelegate::BEFORE_TRANSLATE, tab, language_code,
+ target_lang));
}
void TranslateManager::InitiateTranslationPosted(
@@ -763,9 +765,9 @@ void TranslateManager::ShowInfoBar(TabContents* tab,
return;
if (old_infobar) {
// There already is a translate infobar, simply replace it.
- wrapper->ReplaceInfoBar(old_infobar, infobar);
+ wrapper->infobar_tab_helper()->ReplaceInfoBar(old_infobar, infobar);
} else {
- wrapper->AddInfoBar(infobar);
+ wrapper->infobar_tab_helper()->AddInfoBar(infobar);
}
}
@@ -802,9 +804,10 @@ TranslateInfoBarDelegate* TranslateManager::GetTranslateInfoBarDelegate(
if (!wrapper)
return NULL;
- for (size_t i = 0; i < wrapper->infobar_count(); ++i) {
+ for (size_t i = 0; i < wrapper->infobar_tab_helper()->infobar_count(); ++i) {
Peter Kasting 2011/08/31 18:47:32 Nit: Factor this infobar_tab_helper() out to a tem
TranslateInfoBarDelegate* delegate =
- wrapper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate();
+ wrapper->infobar_tab_helper()->GetInfoBarDelegateAt(i)->
+ AsTranslateInfoBarDelegate();
if (delegate)
return delegate;
}

Powered by Google App Engine
This is Rietveld 408576698