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 feb8ca9f0dc80ae6053cf448a39a65c4ce8ea298..a25ca9db46f71c56d928a2e30574b8fd5334070f 100644 |
--- a/chrome/browser/translate/translate_infobar_delegate.cc |
+++ b/chrome/browser/translate/translate_infobar_delegate.cc |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright 2012 The Chromium Authors. All rights reserved. |
tfarina
2014/05/15 17:43:38
Leave the (c). I know the new policy is without. B
|
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -9,16 +9,14 @@ |
#include "base/i18n/string_compare.h" |
#include "base/metrics/histogram.h" |
#include "base/prefs/pref_service.h" |
-#include "chrome/browser/browser_process.h" |
#include "chrome/browser/infobars/infobar_service.h" |
-#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/translate/translate_tab_helper.h" |
#include "components/infobars/core/infobar.h" |
#include "components/translate/core/browser/translate_accept_languages.h" |
#include "components/translate/core/browser/translate_download_manager.h" |
#include "components/translate/core/browser/translate_manager.h" |
#include "components/translate/core/common/translate_constants.h" |
-#include "content/public/browser/navigation_entry.h" |
+#include "content/public/browser/browser_context.h" |
#include "content/public/browser/web_contents.h" |
#include "grit/generated_resources.h" |
#include "grit/theme_resources.h" |
@@ -144,13 +142,13 @@ void TranslateInfoBarDelegate::TranslationDeclined() { |
} |
bool TranslateInfoBarDelegate::IsTranslatableLanguageByPrefs() { |
- Profile* profile = |
- Profile::FromBrowserContext(GetWebContents()->GetBrowserContext()); |
- Profile* original_profile = profile->GetOriginalProfile(); |
+ TranslateTabHelper* translate_tab_helper = |
+ TranslateTabHelper::FromWebContents(GetWebContents()); |
scoped_ptr<TranslatePrefs> translate_prefs( |
- TranslateTabHelper::CreateTranslatePrefs(original_profile->GetPrefs())); |
+ TranslateTabHelper::CreateTranslatePrefs( |
+ translate_tab_helper->GetPrefs())); |
blundell
2014/05/15 15:33:48
what about this?
droger
2014/05/15 15:42:27
Yes, it works. The implementation of this is:
Pro
|
TranslateAcceptLanguages* accept_languages = |
- TranslateTabHelper::GetTranslateAcceptLanguages(original_profile); |
+ translate_tab_helper->GetTranslateAcceptLanguages(); |
droger
2014/05/15 14:05:37
This is fine because the TranslateAcceptLanguagesF
|
return translate_prefs->CanTranslateLanguage(accept_languages, |
original_language_code()); |
} |
@@ -284,13 +282,6 @@ content::WebContents* TranslateInfoBarDelegate::GetWebContents() { |
} |
// static |
-base::string16 TranslateInfoBarDelegate::GetLanguageDisplayableName( |
blundell
2014/05/15 15:33:48
This was just dead code?
droger
2014/05/15 15:42:27
yes
|
- const std::string& language_code) { |
- return l10n_util::GetDisplayNameForLocale( |
- language_code, g_browser_process->GetApplicationLocale(), true); |
-} |
- |
-// static |
void TranslateInfoBarDelegate::GetAfterTranslateStrings( |
std::vector<base::string16>* strings, |
bool* swap_languages, |