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

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

Issue 230453004: Remove InfoBarDelegate::web_contents() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile Created 6 years, 8 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_infobar_delegate.cc
diff --git a/chrome/browser/translate/translate_infobar_delegate.cc b/chrome/browser/translate/translate_infobar_delegate.cc
index 877f72f3311ca8e05020ba3b662265a1cd996467..728a747837e3820dd983b25ebc3c17e4cd3f22ff 100644
--- a/chrome/browser/translate/translate_infobar_delegate.cc
+++ b/chrome/browser/translate/translate_infobar_delegate.cc
@@ -133,7 +133,7 @@ void TranslateInfoBarDelegate::RevertTranslation() {
void TranslateInfoBarDelegate::ReportLanguageDetectionError() {
TranslateManager* manager =
- TranslateTabHelper::GetManagerFromWebContents(web_contents());
+ TranslateTabHelper::GetManagerFromWebContents(GetWebContents());
if (!manager)
return;
manager->ReportLanguageDetectionError();
@@ -145,7 +145,7 @@ void TranslateInfoBarDelegate::TranslationDeclined() {
bool TranslateInfoBarDelegate::IsTranslatableLanguageByPrefs() {
Profile* profile =
- Profile::FromBrowserContext(web_contents()->GetBrowserContext());
+ Profile::FromBrowserContext(GetWebContents()->GetBrowserContext());
Profile* original_profile = profile->GetOriginalProfile();
scoped_ptr<TranslatePrefs> translate_prefs(
TranslateTabHelper::CreateTranslatePrefs(original_profile->GetPrefs()));
@@ -255,7 +255,7 @@ void TranslateInfoBarDelegate::MessageInfoBarButtonPressed() {
}
// This is the "Try again..." case.
TranslateManager* manager =
- TranslateTabHelper::GetManagerFromWebContents(web_contents());
+ TranslateTabHelper::GetManagerFromWebContents(GetWebContents());
DCHECK(manager);
manager->TranslatePage(
original_language_code(), target_language_code(), false);
@@ -267,18 +267,22 @@ bool TranslateInfoBarDelegate::ShouldShowMessageInfoBarButton() {
bool TranslateInfoBarDelegate::ShouldShowNeverTranslateShortcut() {
DCHECK_EQ(translate::TRANSLATE_STEP_BEFORE_TRANSLATE, step_);
- return !web_contents()->GetBrowserContext()->IsOffTheRecord() &&
+ return !GetWebContents()->GetBrowserContext()->IsOffTheRecord() &&
(prefs_->GetTranslationDeniedCount(original_language_code()) >=
kNeverTranslateMinCount);
}
bool TranslateInfoBarDelegate::ShouldShowAlwaysTranslateShortcut() {
DCHECK_EQ(translate::TRANSLATE_STEP_BEFORE_TRANSLATE, step_);
- return !web_contents()->GetBrowserContext()->IsOffTheRecord() &&
+ return !GetWebContents()->GetBrowserContext()->IsOffTheRecord() &&
(prefs_->GetTranslationAcceptedCount(original_language_code()) >=
kAlwaysTranslateMinCount);
}
+content::WebContents* TranslateInfoBarDelegate::GetWebContents() {
+ return InfoBarService::WebContentsFromInfoBar(infobar());
+}
+
// static
base::string16 TranslateInfoBarDelegate::GetLanguageDisplayableName(
const std::string& language_code) {

Powered by Google App Engine
This is Rietveld 408576698