Commit 151eaa00 authored by droger@chromium.org's avatar droger@chromium.org

Remove most of chrome/ and content/ usage from TranslateInfoBarDelegate

The only problematic dependencies left are WebContents (only needed for
the GetWebContents() method, which is only used by OptionsMenuModel),
and InfoBarService, which is only used to implement GetWebContents().

BUG=371845
TBR=rohitrao

Review URL: https://codereview.chromium.org/291503008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271205 0039d316-1c4b-4281-b951-d872f2087c98
parent 3795c04d
...@@ -6,11 +6,8 @@ ...@@ -6,11 +6,8 @@
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/translate/translate_infobar_delegate.h" #include "chrome/browser/translate/translate_infobar_delegate.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "grit/component_strings.h" #include "grit/component_strings.h"
#include "grit/locale_settings.h" #include "grit/locale_settings.h"
...@@ -39,8 +36,7 @@ OptionsMenuModel::OptionsMenuModel( ...@@ -39,8 +36,7 @@ OptionsMenuModel::OptionsMenuModel(
// Populate the menu. // Populate the menu.
// Incognito mode does not get any preferences related items. // Incognito mode does not get any preferences related items.
if (!translate_delegate->GetWebContents()->GetBrowserContext()-> if (!translate_delegate->is_off_the_record()) {
IsOffTheRecord()) {
if (!autodetermined_source_language) { if (!autodetermined_source_language) {
AddCheckItem(IDC_TRANSLATE_OPTIONS_ALWAYS, AddCheckItem(IDC_TRANSLATE_OPTIONS_ALWAYS,
l10n_util::GetStringFUTF16(IDS_TRANSLATE_INFOBAR_OPTIONS_ALWAYS, l10n_util::GetStringFUTF16(IDS_TRANSLATE_INFOBAR_OPTIONS_ALWAYS,
......
...@@ -10,13 +10,14 @@ ...@@ -10,13 +10,14 @@
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "base/prefs/pref_service.h" #include "base/prefs/pref_service.h"
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/translate/translate_tab_helper.h"
#include "components/infobars/core/infobar.h" #include "components/infobars/core/infobar.h"
#include "components/translate/core/browser/language_state.h"
#include "components/translate/core/browser/translate_accept_languages.h" #include "components/translate/core/browser/translate_accept_languages.h"
#include "components/translate/core/browser/translate_client.h"
#include "components/translate/core/browser/translate_download_manager.h" #include "components/translate/core/browser/translate_download_manager.h"
#include "components/translate/core/browser/translate_driver.h"
#include "components/translate/core/browser/translate_manager.h" #include "components/translate/core/browser/translate_manager.h"
#include "components/translate/core/common/translate_constants.h" #include "components/translate/core/common/translate_constants.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "grit/component_strings.h" #include "grit/component_strings.h"
#include "grit/theme_resources.h" #include "grit/theme_resources.h"
...@@ -51,14 +52,20 @@ TranslateInfoBarDelegate::~TranslateInfoBarDelegate() { ...@@ -51,14 +52,20 @@ TranslateInfoBarDelegate::~TranslateInfoBarDelegate() {
} }
// static // static
void TranslateInfoBarDelegate::Create(bool replace_existing_infobar, void TranslateInfoBarDelegate::Create(
content::WebContents* web_contents, bool replace_existing_infobar,
const base::WeakPtr<TranslateManager>& translate_manager,
InfoBarService* infobar_service,
bool is_off_the_record,
translate::TranslateStep step, translate::TranslateStep step,
const std::string& original_language, const std::string& original_language,
const std::string& target_language, const std::string& target_language,
TranslateErrors::Type error_type, TranslateErrors::Type error_type,
PrefService* prefs, PrefService* prefs,
bool triggered_from_menu) { bool triggered_from_menu) {
DCHECK(translate_manager);
DCHECK(infobar_service);
// Check preconditions. // Check preconditions.
if (step != translate::TRANSLATE_STEP_TRANSLATE_ERROR) { if (step != translate::TRANSLATE_STEP_TRANSLATE_ERROR) {
DCHECK(TranslateDownloadManager::IsSupportedLanguage(target_language)); DCHECK(TranslateDownloadManager::IsSupportedLanguage(target_language));
...@@ -73,19 +80,15 @@ void TranslateInfoBarDelegate::Create(bool replace_existing_infobar, ...@@ -73,19 +80,15 @@ void TranslateInfoBarDelegate::Create(bool replace_existing_infobar,
} }
// Do not create the after translate infobar if we are auto translating. // Do not create the after translate infobar if we are auto translating.
if ((step == translate::TRANSLATE_STEP_AFTER_TRANSLATE) || if (((step == translate::TRANSLATE_STEP_AFTER_TRANSLATE) ||
(step == translate::TRANSLATE_STEP_TRANSLATING)) { (step == translate::TRANSLATE_STEP_TRANSLATING)) &&
TranslateTabHelper* translate_tab_helper = translate_manager->translate_client()->GetTranslateDriver()
TranslateTabHelper::FromWebContents(web_contents); ->GetLanguageState().InTranslateNavigation()) {
if (!translate_tab_helper ||
translate_tab_helper->GetLanguageState().InTranslateNavigation())
return; return;
} }
// Find any existing translate infobar delegate. // Find any existing translate infobar delegate.
infobars::InfoBar* old_infobar = NULL; infobars::InfoBar* old_infobar = NULL;
InfoBarService* infobar_service =
InfoBarService::FromWebContents(web_contents);
TranslateInfoBarDelegate* old_delegate = NULL; TranslateInfoBarDelegate* old_delegate = NULL;
for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
old_infobar = infobar_service->infobar_at(i); old_infobar = infobar_service->infobar_at(i);
...@@ -100,8 +103,8 @@ void TranslateInfoBarDelegate::Create(bool replace_existing_infobar, ...@@ -100,8 +103,8 @@ void TranslateInfoBarDelegate::Create(bool replace_existing_infobar,
// Add the new delegate. // Add the new delegate.
scoped_ptr<infobars::InfoBar> infobar(CreateInfoBar( scoped_ptr<infobars::InfoBar> infobar(CreateInfoBar(
scoped_ptr<TranslateInfoBarDelegate>(new TranslateInfoBarDelegate( scoped_ptr<TranslateInfoBarDelegate>(new TranslateInfoBarDelegate(
web_contents, step, old_delegate, original_language, translate_manager, is_off_the_record, step, old_delegate,
target_language, error_type, prefs, original_language, target_language, error_type, prefs,
triggered_from_menu)))); triggered_from_menu))));
if (old_delegate) if (old_delegate)
infobar_service->ReplaceInfoBar(old_infobar, infobar.Pass()); infobar_service->ReplaceInfoBar(old_infobar, infobar.Pass());
...@@ -130,11 +133,8 @@ void TranslateInfoBarDelegate::RevertTranslation() { ...@@ -130,11 +133,8 @@ void TranslateInfoBarDelegate::RevertTranslation() {
} }
void TranslateInfoBarDelegate::ReportLanguageDetectionError() { void TranslateInfoBarDelegate::ReportLanguageDetectionError() {
TranslateManager* manager = if (translate_manager_)
TranslateTabHelper::GetManagerFromWebContents(GetWebContents()); translate_manager_->ReportLanguageDetectionError();
if (!manager)
return;
manager->ReportLanguageDetectionError();
} }
void TranslateInfoBarDelegate::TranslationDeclined() { void TranslateInfoBarDelegate::TranslationDeclined() {
...@@ -142,13 +142,10 @@ void TranslateInfoBarDelegate::TranslationDeclined() { ...@@ -142,13 +142,10 @@ void TranslateInfoBarDelegate::TranslationDeclined() {
} }
bool TranslateInfoBarDelegate::IsTranslatableLanguageByPrefs() { bool TranslateInfoBarDelegate::IsTranslatableLanguageByPrefs() {
TranslateTabHelper* translate_tab_helper = TranslateClient* client = GetTranslateClient();
TranslateTabHelper::FromWebContents(GetWebContents()); scoped_ptr<TranslatePrefs> translate_prefs(client->GetTranslatePrefs());
scoped_ptr<TranslatePrefs> translate_prefs(
TranslateTabHelper::CreateTranslatePrefs(
translate_tab_helper->GetPrefs()));
TranslateAcceptLanguages* accept_languages = TranslateAcceptLanguages* accept_languages =
translate_tab_helper->GetTranslateAcceptLanguages(); client->GetTranslateAcceptLanguages();
return translate_prefs->CanTranslateLanguage(accept_languages, return translate_prefs->CanTranslateLanguage(accept_languages,
original_language_code()); original_language_code());
} }
...@@ -252,10 +249,8 @@ void TranslateInfoBarDelegate::MessageInfoBarButtonPressed() { ...@@ -252,10 +249,8 @@ void TranslateInfoBarDelegate::MessageInfoBarButtonPressed() {
return; return;
} }
// This is the "Try again..." case. // This is the "Try again..." case.
TranslateManager* manager = DCHECK(translate_manager_);
TranslateTabHelper::GetManagerFromWebContents(GetWebContents()); translate_manager_->TranslatePage(
DCHECK(manager);
manager->TranslatePage(
original_language_code(), target_language_code(), false); original_language_code(), target_language_code(), false);
} }
...@@ -265,14 +260,14 @@ bool TranslateInfoBarDelegate::ShouldShowMessageInfoBarButton() { ...@@ -265,14 +260,14 @@ bool TranslateInfoBarDelegate::ShouldShowMessageInfoBarButton() {
bool TranslateInfoBarDelegate::ShouldShowNeverTranslateShortcut() { bool TranslateInfoBarDelegate::ShouldShowNeverTranslateShortcut() {
DCHECK_EQ(translate::TRANSLATE_STEP_BEFORE_TRANSLATE, step_); DCHECK_EQ(translate::TRANSLATE_STEP_BEFORE_TRANSLATE, step_);
return !GetWebContents()->GetBrowserContext()->IsOffTheRecord() && return !is_off_the_record_ &&
(prefs_->GetTranslationDeniedCount(original_language_code()) >= (prefs_->GetTranslationDeniedCount(original_language_code()) >=
kNeverTranslateMinCount); kNeverTranslateMinCount);
} }
bool TranslateInfoBarDelegate::ShouldShowAlwaysTranslateShortcut() { bool TranslateInfoBarDelegate::ShouldShowAlwaysTranslateShortcut() {
DCHECK_EQ(translate::TRANSLATE_STEP_BEFORE_TRANSLATE, step_); DCHECK_EQ(translate::TRANSLATE_STEP_BEFORE_TRANSLATE, step_);
return !GetWebContents()->GetBrowserContext()->IsOffTheRecord() && return !is_off_the_record_ &&
(prefs_->GetTranslationAcceptedCount(original_language_code()) >= (prefs_->GetTranslationAcceptedCount(original_language_code()) >=
kAlwaysTranslateMinCount); kAlwaysTranslateMinCount);
} }
...@@ -317,7 +312,8 @@ void TranslateInfoBarDelegate::GetAfterTranslateStrings( ...@@ -317,7 +312,8 @@ void TranslateInfoBarDelegate::GetAfterTranslateStrings(
} }
TranslateInfoBarDelegate::TranslateInfoBarDelegate( TranslateInfoBarDelegate::TranslateInfoBarDelegate(
content::WebContents* web_contents, const base::WeakPtr<TranslateManager>& translate_manager,
bool is_off_the_record,
translate::TranslateStep step, translate::TranslateStep step,
TranslateInfoBarDelegate* old_delegate, TranslateInfoBarDelegate* old_delegate,
const std::string& original_language, const std::string& original_language,
...@@ -326,22 +322,32 @@ TranslateInfoBarDelegate::TranslateInfoBarDelegate( ...@@ -326,22 +322,32 @@ TranslateInfoBarDelegate::TranslateInfoBarDelegate(
PrefService* prefs, PrefService* prefs,
bool triggered_from_menu) bool triggered_from_menu)
: infobars::InfoBarDelegate(), : infobars::InfoBarDelegate(),
is_off_the_record_(is_off_the_record),
step_(step), step_(step),
background_animation_(NONE), background_animation_(NONE),
ui_delegate_(TranslateTabHelper::FromWebContents(web_contents), ui_delegate_(translate_manager->translate_client(),
TranslateTabHelper::GetManagerFromWebContents(web_contents), translate_manager.get(),
original_language, original_language,
target_language), target_language),
translate_manager_(translate_manager),
error_type_(error_type), error_type_(error_type),
prefs_(TranslateTabHelper::CreateTranslatePrefs(prefs)), prefs_(translate_manager->translate_client()->GetTranslatePrefs()),
triggered_from_menu_(triggered_from_menu) { triggered_from_menu_(triggered_from_menu) {
DCHECK_NE((step_ == translate::TRANSLATE_STEP_TRANSLATE_ERROR), DCHECK_NE((step_ == translate::TRANSLATE_STEP_TRANSLATE_ERROR),
(error_type_ == TranslateErrors::NONE)); (error_type_ == TranslateErrors::NONE));
DCHECK(translate_manager_);
if (old_delegate && (old_delegate->is_error() != is_error())) if (old_delegate && (old_delegate->is_error() != is_error()))
background_animation_ = is_error() ? NORMAL_TO_ERROR : ERROR_TO_NORMAL; background_animation_ = is_error() ? NORMAL_TO_ERROR : ERROR_TO_NORMAL;
} }
TranslateClient* TranslateInfoBarDelegate::GetTranslateClient() {
if (!translate_manager_)
return NULL;
return translate_manager_->translate_client();
}
// TranslateInfoBarDelegate::CreateInfoBar() is implemented in platform-specific // TranslateInfoBarDelegate::CreateInfoBar() is implemented in platform-specific
// files. // files.
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "components/infobars/core/infobar_delegate.h" #include "components/infobars/core/infobar_delegate.h"
#include "components/translate/core/browser/translate_prefs.h" #include "components/translate/core/browser/translate_prefs.h"
#include "components/translate/core/browser/translate_step.h" #include "components/translate/core/browser/translate_step.h"
...@@ -18,7 +19,10 @@ ...@@ -18,7 +19,10 @@
#include "components/translate/core/common/translate_constants.h" #include "components/translate/core/common/translate_constants.h"
#include "components/translate/core/common/translate_errors.h" #include "components/translate/core/common/translate_errors.h"
class InfoBarService;
class PrefService; class PrefService;
class TranslateClient;
class TranslateManager;
namespace content { namespace content {
class WebContents; class WebContents;
...@@ -50,7 +54,9 @@ class TranslateInfoBarDelegate : public infobars::InfoBarDelegate { ...@@ -50,7 +54,9 @@ class TranslateInfoBarDelegate : public infobars::InfoBarDelegate {
// infobar already present there. Otherwise, the infobar will only be added // infobar already present there. Otherwise, the infobar will only be added
// if there is no other translate infobar already present. // if there is no other translate infobar already present.
static void Create(bool replace_existing_infobar, static void Create(bool replace_existing_infobar,
content::WebContents* web_contents, const base::WeakPtr<TranslateManager>& translate_manager,
InfoBarService* infobar_service,
bool is_off_the_record,
translate::TranslateStep step, translate::TranslateStep step,
const std::string& original_language, const std::string& original_language,
const std::string& target_language, const std::string& target_language,
...@@ -73,6 +79,8 @@ class TranslateInfoBarDelegate : public infobars::InfoBarDelegate { ...@@ -73,6 +79,8 @@ class TranslateInfoBarDelegate : public infobars::InfoBarDelegate {
translate::TranslateStep translate_step() const { return step_; } translate::TranslateStep translate_step() const { return step_; }
bool is_off_the_record() { return is_off_the_record_; }
TranslateErrors::Type error_type() const { return error_type_; } TranslateErrors::Type error_type() const { return error_type_; }
size_t original_language_index() const { size_t original_language_index() const {
...@@ -168,7 +176,9 @@ class TranslateInfoBarDelegate : public infobars::InfoBarDelegate { ...@@ -168,7 +176,9 @@ class TranslateInfoBarDelegate : public infobars::InfoBarDelegate {
bool autodetermined_source_language); bool autodetermined_source_language);
protected: protected:
TranslateInfoBarDelegate(content::WebContents* web_contents, TranslateInfoBarDelegate(
const base::WeakPtr<TranslateManager>& translate_manager,
bool is_off_the_record,
translate::TranslateStep step, translate::TranslateStep step,
TranslateInfoBarDelegate* old_delegate, TranslateInfoBarDelegate* old_delegate,
const std::string& original_language, const std::string& original_language,
...@@ -185,6 +195,9 @@ class TranslateInfoBarDelegate : public infobars::InfoBarDelegate { ...@@ -185,6 +195,9 @@ class TranslateInfoBarDelegate : public infobars::InfoBarDelegate {
static scoped_ptr<infobars::InfoBar> CreateInfoBar( static scoped_ptr<infobars::InfoBar> CreateInfoBar(
scoped_ptr<TranslateInfoBarDelegate> delegate); scoped_ptr<TranslateInfoBarDelegate> delegate);
// May return NULL if the client has been destroyed.
TranslateClient* GetTranslateClient();
// InfoBarDelegate: // InfoBarDelegate:
virtual void InfoBarDismissed() OVERRIDE; virtual void InfoBarDismissed() OVERRIDE;
virtual int GetIconID() const OVERRIDE; virtual int GetIconID() const OVERRIDE;
...@@ -192,6 +205,7 @@ class TranslateInfoBarDelegate : public infobars::InfoBarDelegate { ...@@ -192,6 +205,7 @@ class TranslateInfoBarDelegate : public infobars::InfoBarDelegate {
virtual bool ShouldExpire(const NavigationDetails& details) const OVERRIDE; virtual bool ShouldExpire(const NavigationDetails& details) const OVERRIDE;
virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate() OVERRIDE; virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate() OVERRIDE;
bool is_off_the_record_;
translate::TranslateStep step_; translate::TranslateStep step_;
// The type of fading animation if any that should be used when showing this // The type of fading animation if any that should be used when showing this
...@@ -199,6 +213,7 @@ class TranslateInfoBarDelegate : public infobars::InfoBarDelegate { ...@@ -199,6 +213,7 @@ class TranslateInfoBarDelegate : public infobars::InfoBarDelegate {
BackgroundAnimationType background_animation_; BackgroundAnimationType background_animation_;
TranslateUIDelegate ui_delegate_; TranslateUIDelegate ui_delegate_;
base::WeakPtr<TranslateManager> translate_manager_;
// The error that occurred when trying to translate (NONE if no error). // The error that occurred when trying to translate (NONE if no error).
TranslateErrors::Type error_type_; TranslateErrors::Type error_type_;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/prefs/pref_service.h" #include "base/prefs/pref_service.h"
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/translate/translate_accept_languages_factory.h" #include "chrome/browser/translate/translate_accept_languages_factory.h"
#include "chrome/browser/translate/translate_infobar_delegate.h" #include "chrome/browser/translate/translate_infobar_delegate.h"
...@@ -178,7 +179,9 @@ void TranslateTabHelper::ShowTranslateUI(translate::TranslateStep step, ...@@ -178,7 +179,9 @@ void TranslateTabHelper::ShowTranslateUI(translate::TranslateStep step,
Profile* original_profile = profile->GetOriginalProfile(); Profile* original_profile = profile->GetOriginalProfile();
TranslateInfoBarDelegate::Create( TranslateInfoBarDelegate::Create(
step != translate::TRANSLATE_STEP_BEFORE_TRANSLATE, step != translate::TRANSLATE_STEP_BEFORE_TRANSLATE,
web_contents(), translate_manager_->GetWeakPtr(),
InfoBarService::FromWebContents(web_contents()),
profile->IsOffTheRecord(),
step, step,
source_language, source_language,
target_language, target_language,
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#import "chrome/browser/ui/cocoa/infobars/translate_infobar_base.h" #import "chrome/browser/ui/cocoa/infobars/translate_infobar_base.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "components/translate/core/browser/translate_language_list.h" #include "components/translate/core/browser/translate_language_list.h"
#include "components/translate/core/browser/translate_manager.h"
#import "content/public/browser/web_contents.h" #import "content/public/browser/web_contents.h"
#include "ipc/ipc_message.h" #include "ipc/ipc_message.h"
#import "testing/gmock/include/gmock/gmock.h" #import "testing/gmock/include/gmock/gmock.h"
...@@ -40,7 +41,10 @@ class MockTranslateInfoBarDelegate : public TranslateInfoBarDelegate { ...@@ -40,7 +41,10 @@ class MockTranslateInfoBarDelegate : public TranslateInfoBarDelegate {
translate::TranslateStep step, translate::TranslateStep step,
TranslateErrors::Type error, TranslateErrors::Type error,
PrefService* prefs) PrefService* prefs)
: TranslateInfoBarDelegate(web_contents, : TranslateInfoBarDelegate(
TranslateTabHelper::GetManagerFromWebContents(
web_contents)->GetWeakPtr(),
false,
step, step,
NULL, NULL,
"en", "en",
......
...@@ -75,6 +75,10 @@ TranslateManager::TranslateManager( ...@@ -75,6 +75,10 @@ TranslateManager::TranslateManager(
translate_driver_(translate_client_->GetTranslateDriver()), translate_driver_(translate_client_->GetTranslateDriver()),
weak_method_factory_(this) {} weak_method_factory_(this) {}
base::WeakPtr<TranslateManager> TranslateManager::GetWeakPtr() {
return weak_method_factory_.GetWeakPtr();
}
void TranslateManager::InitiateTranslation(const std::string& page_lang) { void TranslateManager::InitiateTranslation(const std::string& page_lang) {
// Short-circuit out if not in a state where initiating translation makes // Short-circuit out if not in a state where initiating translation makes
// sense (this method may be called muhtiple times for a given page). // sense (this method may be called muhtiple times for a given page).
...@@ -239,12 +243,9 @@ void TranslateManager::TranslatePage(const std::string& original_source_lang, ...@@ -239,12 +243,9 @@ void TranslateManager::TranslatePage(const std::string& original_source_lang,
// The script is not available yet. Queue that request and query for the // The script is not available yet. Queue that request and query for the
// script. Once it is downloaded we'll do the translate. // script. Once it is downloaded we'll do the translate.
TranslateScript::RequestCallback callback = TranslateScript::RequestCallback callback = base::Bind(
base::Bind(&TranslateManager::OnTranslateScriptFetchComplete, &TranslateManager::OnTranslateScriptFetchComplete, GetWeakPtr(),
weak_method_factory_.GetWeakPtr(), translate_driver_->GetCurrentPageID(), source_lang, target_lang);
translate_driver_->GetCurrentPageID(),
source_lang,
target_lang);
script->Request(callback); script->Request(callback);
} }
......
...@@ -35,6 +35,12 @@ class TranslateManager { ...@@ -35,6 +35,12 @@ class TranslateManager {
const std::string& accept_language_pref_name); const std::string& accept_language_pref_name);
virtual ~TranslateManager(); virtual ~TranslateManager();
// Returns a weak pointer to this instance.
base::WeakPtr<TranslateManager> GetWeakPtr();
// Cannot return NULL.
TranslateClient* translate_client() { return translate_client_; }
// Returns the language to translate to. The language returned is the // Returns the language to translate to. The language returned is the
// first language found in the following list that is supported by the // first language found in the following list that is supported by the
// translation service: // translation service:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment