| 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 2784abc2c823f16eb9a0697d1b23059634327f6a..8edd379c260118e9b9a41bc74a14a542f8969980 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) {
|
|
|